資源描述:
《nagios+nagios-plugins+nrpe監(jiān)控整理版》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在應用文檔-天天文庫。
1、Nagios+nagios-plugins+nrpe一、A=監(jiān)控主機;B=被監(jiān)控主機二、安裝部署nagios1、A:安裝Nagios+nagios-plugins+nrpe監(jiān)控主機安裝nrpe:tarzxvfnrpe-2.12.tar.gzcdnrpe-2.12./configuremakeallmakeinstall-pluginmakeinstall-daemonmakeinstall-daemon-config2、B:安裝nagios-plugins+nrpe(1)在被監(jiān)控機上安裝nagios插件和nrpetarzxvfnagios-plugins-1.4.1
2、5.tar.gzcdnagios-plugins-1.4.15./configure--with-nagios-user=nagios--with-nagios-group=nagiosmakemakeinstall安裝nrpe的方法與監(jiān)控主機的nrpe安裝方法一樣(2)檢查目錄及文件:ll/usr/local/nagios/libexec看看里面是不是有一大堆check的什么東西,如果有就對了三、配置A主機使得A可以監(jiān)控B主機,具體配置見如下步驟。大家注意一下這6補配置只能監(jiān)控B主機的服務或者聯(lián)通狀態(tài),但是無法監(jiān)控B主機本地的例如cpu、內(nèi)存、硬盤等使用情況。如果
3、要監(jiān)控這些本地的信息,就要借助于nrpe這個插件了。詳細配置請參看(第四部分)1、修改cgi.cfg配置文件vi/usr/local/nagios/etc/cgi.cfg添加:refresh_rate=30#nagios主頁的刷新時間,我設置成30秒自動刷新use_authentication=0#關閉認證功能,當nagios配置好后,建議開回來2、修改nagios.cfg配置文件vi/usr/local/nagios/etc/nagios.cfgcfg_file=/usr/local/nagios/etc/objects/commands.cfg#nagios可調(diào)
4、用的監(jiān)控命令cfg_file=/usr/local/nagios/etc/objects/contacts.cfg#聯(lián)系人配置cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg#監(jiān)控時間配置cfg_file=/usr/local/nagios/etc/objects/templates.cfg#模板配置cfg_dir=/usr/local/nagios/etc/services#新添加,把需要添加的主機文件放進去,就不必在這里一行行添加(這一行雖然簡單,但是經(jīng)過我的實踐把配置直接指向services組無法進行
5、識別,nagios啟動失敗,所以建議這樣寫cfg_file=/usr/local/nagios/etc/services/$B-ip.cfg)cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg#新添加,主機組配置(host組,經(jīng)過實踐我暫時沒有成功,有待驗證)cfg_file=/usr/local/nagios/etc/objects/localhost.cfg#本地信息監(jiān)迭3、添加被監(jiān)控主機配置文件既然上一步在nagios.cfg中指定了監(jiān)控$B的配置文件,下面我們就來建立這個配置文件,#vi$B-ip.cf
6、gdefinehost{uselinux-serverhost_name192.168.1.211alias192.168.1.211address192.168.1.211}defineservice{usegeneric-servicehost_name192.168.1.211service_descriptioncheck_pingcheck_commandcheck_ping!100.0,20%!200.0,50%max_check_attempts5normal_check_interval1}defineservice{usegeneric-servi
7、cehost_name192.168.1.211service_descriptioncheck_ftpcheck_commandcheck_ftp!21max_check_attempts5normal_check_interval1}defineservice{usegeneric-servicehost_name192.168.1.211service_descriptioncheck_sshcheck_commandcheck_sshmax_check_attempts5normal_check_interval1}defineservice{usege