nagios工作正常,各個監控頁面也可以正常顯示,唯獨maps無法顯示,提示The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server。進到/nagios/cgi-bin/文件夾中發現果然沒有statusmap.cgi。
上網查了一下,說是可能缺下面的安裝包,
gd
gd-devel
libpng
libpng-devel
libjpeg
libjpeg-devel
zlib
zlib-devel
雖然不知道這些安裝包到底有什麼用,還是查查看到底哪個沒裝。
用rpm -qa | grep 命令挨個安裝包查一遍,原來gd-devel沒裝
用yum install -y gd-devel命令安裝,裝好後回到nagios解壓的目錄執行以下命令:
#make devclean
# ./configure --with-gd-lib=/usr/lib --with-gd-inc=/usr/include
#./configure --with-command-group=nagcmd
#make all; make install; makeinstall-init; make install-config; make install-commandmode; makeinstall-webconf
完事之後重啓nagios服務,ok,maps可以正常顯示了!
不過突然發現監控主機少了一臺,只剩下localhost了,另外一臺遠程主機看不到了!
是不是重新編譯nagios把舊的配置文件覆蓋了呢?查看nagios.cfg配置文件,
#vi /usr/local/nagios/etc/nagios.cfg
果然遠程監控主機的信息沒有了,添加
cfg_file=/usr/local/nagios/etc/objects/mylinux.cfg
重啓nagios服務之後居然報錯了,類似於這種錯誤
Error: Service check command 'check_nrpe!check_load' specified in service 'CPU Load' for host 'lucas_nj' not defined anywhere!
Error: Service check command 'check_nrpe!check_users' specified in service 'Current Users' for host 'lucas_nj' not defined anywhere!
Error: Service check command 'check_nrpe!check_total_procs' specified in service 'Total Processes' for host 'lucas_nj' not defined anywhere!
Error: Service check command 'check_nrpe!check_zombie_procs' specified in service 'Zombie Processes' for host 'lucas_nj' not defined anywhere!
意思說服務沒定義, 難不成commands.cfg也被覆蓋了?查看commands.cfg文件
#vi /usr/local/nagios/etc/objects/commands.cfg
乖乖,果然也覆蓋掉了,在commands.cfg文件重新添加
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe-H $HOSTADDRESS$ -c $ARG1$
}
重啓nagios服務,工作正常。