Page 1 of 1

NAgios Core - NRPE Remote IP Monitoring

Posted: Wed May 16, 2018 4:13 pm
by ss3217
Greetings!

New to this forum, but I've been using Nagios for some time.

Question about configuring NRPE to monitor remote IP's through a NRPE Remote Server.

Is there a way to specify the remote IP that I'd like to monitor on the Nagios Server?

Currently, the Nagios server has a .cfg file Service Definition that looks like:

define service {
use generic-service
host_name <hostname>
service_description <hostname_Prod_Ping>
check_command check_nrpe!check_ping_<hostname>

The <hostname> is the actual hostname that I'm monitoring it's "production" IP.
The check_ping_<hostname> is the entry in the nrpe.cfg on the NRPE Remote Host.

The check_ping_<hostname> on the NRPE Remote Server contains the hardcoded IP that I'd like to check and it looks like:

command[check_ping_<hostname>]=/usr/local/nagios/libexec/check_ping -H <IP> -w 3000.0,80% -c 5000.0,100% -p 5

check_ping_<hostname> where <hostname> is the actual server name
<IP> is the actual IP that I am checking on

What I'm trying to determine is whether I'll need to enter every <hostname> and <IP> on the NRPE Remote Host, or if I can
pass those variables from the Nagios Server? I have a few hundred hosts, so I'm trying to make it a little more efficient! :)

From the Nagios Server itself, I can monitor what we call the Management IP's which can be ping'd from the network the Nagios
Server is on, however the Production IP's are on a private network not visible to the Server, but visible to the NRPE Remote Host.

Thank you.

Steve

Re: NAgios Core - NRPE Remote IP Monitoring

Posted: Thu May 17, 2018 3:26 pm
by tgriep
Passing the IP address from the Nagios server as an argument is possible to do as long as the NRPE agent on the remote system is setup to receive Arguments.
To enable it, you would edit the nrpe.cfg file and enable this option.

Code: Select all

dont_blame_nrpe=1
# Values: 0=do not allow arguments, 1=allow command arguments
Then edit the command on the remote server and change it from

Code: Select all

command[check_ping_<hostname>]=/usr/local/nagios/libexec/check_ping -H <IP> -w 3000.0,80% -c 5000.0,100% -p 5
to

Code: Select all

command[check_ping]=/usr/local/nagios/libexec/check_ping -H $ARG1$ -w 3000.0,80% -c 5000.0,100% -p 5
This will make it a generic command as the <hostname> cannot be passed.

Save and restart the NRPE agent.

This will allow the command to accept an argument.

Then on the Nagios server the check_command would look like the following, replace xxx.xxx.xxx.xxx with the IP address you want to test.

Code: Select all

check_command check_nrpe!check_ping!-a xxx.xxx.xxx.xxx
And the check_nrpe command will have to be defined like this to accept the extra arguments.

Code: Select all

command_line                    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ $ARG2$ $ARG3$
Try that out and let us know if you have any further questions.

Re: NAgios Core - NRPE Remote IP Monitoring

Posted: Fri May 18, 2018 8:16 am
by ss3217
Will do.

Thank you!

Steve

Re: NAgios Core - NRPE Remote IP Monitoring

Posted: Fri May 18, 2018 9:55 am
by scottwilkerson
Let us know if you have any further questions.