Custom command - check_nrpe

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.
Locked
ricardoheyn
Posts: 3
Joined: Mon Nov 10, 2014 1:24 pm

Custom command - check_nrpe

Post by ricardoheyn »

Hello,

I have a problem with a custom command to count PHP process. It's working locally but remotely this problem is happening:

- Command tested remotely (not working):
/usr/lib/nagios/plugins/check_nrpe -H SERVER.COM.BR -n -c check_pool_www
NRPE: Command 'check_pool_www' not defined

- Command tested locally (working):
/etc/nagios/check_pool_www
OK - 4 of php (pool www) used.

Master is allowed, permissions and configurations are fine, port is openned and listening.

& netstat -nap | grep nrpe
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 10770/nrpe
tcp6 0 0 :::5666 :::* LISTEN 10770/nrpe

it's funny because the remote command just don't work only in one host! :o

The Master is running NRPE 2.13 and Child is running NRPE 2.15, this is the only thing different of the others Children hosts which are working. The others Children hosts are running NRPE 2.12.

I appreciate any help.

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

Re: Custom command - check_nrpe

Post by Box293 »

Your nrpe.cfg file on your remote host does not have a command definition for check_pool_www.

This document has a lot of troubleshooting tips for these issues:

http://assets.nagios.com/downloads/nagi ... utions.pdf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ricardoheyn
Posts: 3
Joined: Mon Nov 10, 2014 1:24 pm

Re: Custom command - check_nrpe

Post by ricardoheyn »

Hi,

The command is defined, I changed for another command. Let me show the example:

- Child /etc/nagios/nrpe.cfg definitions:
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 200 -c 400
command[check_www_procs]=/usr/lib/nagios/plugins/check_procs -w 200 -c 400

- Master /etc/nagios3/providers/amazon/a105.cfg definitions:
define service{
use ckb-service ; Name of service template to use
host_name MY_SERVER
service_description Total Processes
check_command check_nrpe_ckb!MY_SERVER!check_total_procs
}
define service{
use ckb-service ; Name of service template to use
host_name MY_SERVER
service_description Total PHP pool www Processes
check_command check_nrpe_ckb!MY_SERVER!check_www_procs
}

/usr/local/nagios/bin/nagios -v /etc/nagios3/nagios.cfg
Total Warnings: 0
Total Errors: 0

/etc/init.d/nagios-nrpe-server restart
and
/etc/init.d/nagios3 restart

tail -f /var/log/syslog | grep nrpe
Nov 14 15:27:53 a105 nrpe[21840]: Added command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 200 -c 400
Nov 14 15:27:53 a105 nrpe[21840]: Added command[check_www_procs]=/usr/lib/nagios/plugins/check_procs -w 200 -c 400
Nov 14 15:27:53 a105 nrpe[21840]: INFO: SSL/TLS NOT initialized. Network encryption DISABLED.
Nov 14 15:27:53 a105 nrpe[21841]: Starting up daemon
Nov 14 15:27:53 a105 nrpe[21841]: Server listening on 0.0.0.0 port 5666.
Nov 14 15:27:53 a105 nrpe[21841]: Server listening on :: port 5666.
Nov 14 15:27:53 a105 nrpe[21841]: Listening for connections on port 0
Nov 14 15:27:53 a105 nrpe[21841]: Allowing connections from: 127.0.0.1,MY_IP_SERVER

I guess everything is OK, but is not when I execute the remote command:

/usr/lib/nagios/plugins/check_nrpe -H MY_SERVER -n -c check_www_procs
NRPE: Command 'check_www_procs' not defined
/usr/lib/nagios/plugins/check_nrpe -H MY_SERVER -n -c check_total_procs
PROCS OK: 5 processes

The "old" command works fine, but the "new" command is not working. I really don't understand what is happening. :(

Regards,
Last edited by ricardoheyn on Mon Nov 17, 2014 8:19 am, edited 1 time in total.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Custom command - check_nrpe

Post by Box293 »

I know this is a basic question but is the host name you're checking resolving to the ip address of the remote server?

I ask this because I notice you're using a dns name instead of ip address in your check_nrpe command and it could be possible that the nagios server is resolving that dns name to an ip address of another server (not the one you're updating nrpe.cfg on).

ALSO, while logged onto the remote server execute this command on the remote server:
/usr/lib/nagios/plugins/check_nrpe -H 127.0.0.1 -n -c check_www_procs

This means you're executing the check locally (still with nrpe) and removing nagios from the picture altogether.

Finally, make sure you're restarting nrpe on the remote server after changing the nrpe.cfg file.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ricardoheyn
Posts: 3
Joined: Mon Nov 10, 2014 1:24 pm

Re: Custom command - check_nrpe

Post by ricardoheyn »

Hi,

Thank you for the patience.

The problem was solved! The host was appointed for wrong IP address. Why I didn't check this before (SHAME ON ME) :roll:

Thank you again!

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

Re: Custom command - check_nrpe

Post by Box293 »

No worries, a second pair of eyes can save hours of pointless troubleshooting.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked