NAgios Core - NRPE Remote IP Monitoring

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

NAgios Core - NRPE Remote IP Monitoring

Postby ss3217 » Wed May 16, 2018 4:13 pm

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
ss3217
 
Posts: 2
Joined: Wed Aug 20, 2014 3:42 pm

Re: NAgios Core - NRPE Remote IP Monitoring

Postby tgriep » Thu May 17, 2018 3:26 pm

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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 6658
Joined: Thu Oct 30, 2014 9:02 am

Re: NAgios Core - NRPE Remote IP Monitoring

Postby ss3217 » Fri May 18, 2018 8:16 am

Will do.

Thank you!

Steve
ss3217
 
Posts: 2
Joined: Wed Aug 20, 2014 3:42 pm

Re: NAgios Core - NRPE Remote IP Monitoring

Postby scottwilkerson » Fri May 18, 2018 9:55 am

Let us know if you have any further questions.
User avatar
scottwilkerson
CTO
 
Posts: 9131
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: Mysteoa and 28 guests