Page 3 of 4

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Tue May 19, 2015 2:21 am
by xerez

Code: Select all

# LOG FACILITY
# The syslog facility that should be used for logging purposes.

log_facility=daemon

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Tue May 19, 2015 2:39 am
by Box293
For NRPE debug logging I believe these additional steps are required:

Add an option to the rsyslog server so it sends debug messages
Type vi /etc/rsyslogd.conf and press Enter
Now we are editing the config file
Type /var/log/messages and press Enter
This takes you to the line in the config file we are after, it will look like:
*.info;mail.none;authpriv.none;cron.none /var/log/messages
We need to add ";daemon.debug" to the line:
*.info;mail.none;authpriv.none;cron.none;daemon.debug /var/log/messages
Press i on the keyboard to begin editing
Make the change shown above
Press Esc on the keyboard to end editing
Type :wq and press Enter
Type service rsyslog restart and press Enter

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Tue May 19, 2015 3:56 am
by xerez
Thanks!

Code: Select all

usuario@debian:~$ su -c "tail /var/log/messages"
Contraseña:
May 19 09:32:12 debian nrpe[19857]: Added command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
May 19 09:32:12 debian nrpe[19857]: Added command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
May 19 09:32:12 debian nrpe[19857]: Added command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
May 19 09:32:12 debian nrpe[19857]: Added command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
May 19 09:32:12 debian nrpe[19857]: Added command[check_uptime]=/usr/local/nagios/libexec/check_uptime -w 5 -c 10
May 19 09:32:12 debian nrpe[19857]: Added command[check_mem]=/usr/lib/nagios/plugins/check_mem -w 80 -c 90
May 19 09:32:12 debian nrpe[19857]: Added command[check_ssh]=/usr/lib/nagios/plugins/check_ssh -w 5 -c 15
May 19 09:32:12 debian nrpe[19857]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
May 19 09:32:12 debian nrpe[19858]: Starting up daemon
May 19 09:32:12 debian nrpe[19858]: Network server bind failure (98: Address already in use)

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Tue May 19, 2015 9:30 am
by jdalrymple
xerez

It looks like you're not successfully restarting nrpe and that could be the entire problem if the config file isn't getting reread.

Are you certain that you're not running nrpe under xinetd? If so then the config file should get reread every time an NRPE request comes in. If you're certain it's not, do a pkill -9 nrpe and then run your service start command.

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Wed May 20, 2015 3:36 am
by xerez
On my host Linux, I'm sure that NRPE isn't running under xinetd. I didn't installed there.

Code: Select all

usuario@linux:~$ su -c "pkill -9 nrpe"
Contraseña:
usuario@linux:~$ su -c "/etc/init.d/nagios-nrpe-server start"
Contraseña:
[ ok ] Starting nagios-nrpe: nagios-nrpe.
usuario@linux:~$ su -c "tail /var/log/messages"
Contraseña:
May 20 09:07:11 debian nrpe[26980]: Listening for connections on port 5666
May 20 09:07:11 debian nrpe[26980]: Allowing connections from: 127.0.0.1,<host ip>
May 20 09:08:00 debian nrpe[27001]: Connection from <host ip> port 9897
May 20 09:08:00 debian nrpe[27001]: Host address is in allowed_hosts
May 20 09:08:00 debian nrpe[27001]: Handling the connection...
May 20 09:08:00 debian nrpe[27001]: Host is asking for command 'check_load' to be run...
May 20 09:08:00 debian nrpe[27001]: Running command: /usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
May 20 09:08:00 debian nrpe[27001]: Command completed with return code 0 and output: OK - load average: 0.00, 0.01, 0.05|load1=0.000;15.000;30.000;0; load5=0.010;10.000;25.000;0; load15=0.050;5.000;20.000;0;
May 20 09:08:00 debian nrpe[27001]: Return Code: 0, Output: OK - load average: 0.00, 0.01, 0.05|load1=0.000;15.000;30.000;0; load5=0.010;10.000;25.000;0; load15=0.050;5.000;20.000;0;
May 20 09:08:00 debian nrpe[27001]: Connection from <host ip> closed.
Now the uptime is OK, but in Status Information shows "(Return code of 255 is out of bounds)"

Edit:
It changed to OK. Thanks!! But, what happened?

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Wed May 20, 2015 9:14 am
by jdalrymple
xerez wrote: Edit:
It changed to OK. Thanks!! But, what happened?
Hard for us to say - you may still have issues. Did you verify that xinetd is not launching nrpe also?

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Thu May 21, 2015 2:14 am
by xerez
How I verify that?

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Thu May 21, 2015 9:46 am
by jdalrymple
2 steps:

1)

Code: Select all

[root@localhost ~]# /etc/init.d/xinetd status
xinetd (pid  1125) is running...
If it's running then:
2)

Code: Select all

[root@localhost ~]# for line in `grep -Rl nrpe /etc/xinetd.*`; do grep disable $line; done
        disable         = no
If your system matches mine (besides the pid part of course) then it's enabled via xinetd

If it doesn't match, you're in good shape.

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Fri May 22, 2015 2:19 am
by xerez

Code: Select all

root@linux:/# /etc/init.d/xinetd status
bash: /etc/init.d/xinetd: No existe el fichero o el directorio
I said that xinetd isn't installed. So, what was the problem? Thanks.

Re: Error with check_uptime: NRPE: Unable to read output

Posted: Fri May 22, 2015 9:16 am
by jdalrymple
There is no problem then ... Unless you're continuing to have difficulties I'd like to close the topic.