2013年8月17日星期六

nagios nrpe 无法启动一例


今天看到有几台机器的nagios 报警,上服务器上看,发现 nrpe 的服务挂掉,于是启动
nrpe 的服务
 
[root@jietu-mbs-bak tmp]# /etc/init.d/nrpe start
Starting nrpe:                                             [  OK  ]
[root@jietu-mbs-bak tmp]# 
 
ps 查看进程,发现还是没有启动:
 
[root@jietu-mbs-bak nagios]# ps -ef |grep nrpe
root     26911 15184  0 14:26 pts/2    00:00:00 grep nrpe
[root@jietu-mbs-bak nagios]#
 
找了一下nrpe 的配置文件,由于通过xinetd 启动的,于是看了一下 /var/log/messages 
的内容,发现以下错误:
 
May 10 14:26:27 jietu-mbs-bak nrpe[26909]: There's already an NRPE server running (PID 0).  Bailing out...
 
[root@jietu-mbs-bak nagios]# /usr/local/nagios/bin/nrpe -n -c /usr/local/nagios/etc/nrpe.cfg -d
[root@jietu-mbs-bak nagios]# ps -ef |grep nrpe
root     26911 15184  0 14:26 pts/2    00:00:00 grep nrpe
[root@jietu-mbs-bak nagios]#
 
重启了两次,nrpe 的进程还是没有,于是又查了一下nrpe 的配置文件 /usr/local/nagios/etc/nrpe.cfg
看到 pid 文件位置
pid_file=/tmp/nrpe.pid
 
顺便ls 看了一下 /tmp/
[root@jietu-mbs-bak tmp]# ls
checkdisk.err  lost+found  nrpe.pid  ping_gateway.txt  top.txt  vmstat.txt
竟然发现pid 文件存在,果断先将其删除,然后重启服务
[root@jietu-mbs-bak tmp]# rm -rf nrpe.pid
[root@jietu-mbs-bak tmp]#/etc/init.d/nrpe start
Starting nrpe:                                             [  OK  ]
再ps 看发现有了:
[root@jietu-mbs-bak tmp]# ps -ef |grep nrpe
nagios   27499     1  0 14:36 ?        00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
root     27502 15184  0 14:36 pts/2    00:00:00 grep nrpe
[root@jietu-mbs-bak tmp]#
 
启动脚本应该有bug, 没有检查pid 是否存在
 

没有评论:

发表评论