Error with check_uptime: NRPE: Unable to read output

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post by xerez »

Code: Select all

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

log_facility=daemon
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post 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)
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post 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?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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?
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post by xerez »

How I verify that?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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.
xerez
Posts: 77
Joined: Wed Apr 22, 2015 7:50 am

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

Post 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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post by jdalrymple »

There is no problem then ... Unless you're continuing to have difficulties I'd like to close the topic.
Locked