Page 1 of 4

Monitoring remote hosts using NRPE on another remote host

Posted: Thu Feb 05, 2015 3:13 am
by Apurv
Hello All,

What I want to implement is as below :

I have a nagios monitoring server (Say A). I have a remote linux host with NRPE installed on it(Say B). Now I want to monitor another remote linux/windows host (Say C) using the NRPE installed on Host B.

Is this possible for linux and windows server? If yes, then please please provide me the the steps / links on how to get this configured.

Thanks in advance for any help you provide.

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Thu Feb 05, 2015 12:05 pm
by tmcdonald
I can't say we have documentation exactly for this scenario, but in this case you would just define the NRPE commands on the NRPE host (B) to be whatever check you would like to run against (C), then call this as usual from Core (A).

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Feb 11, 2015 9:58 pm
by Apurv
Thank you for your reply tmcdonald.

So as I understand, I need to add some service definitions on Host(B) to check the services on Host(C) using NRPE on Host(B) itself.

Can you please provide me an example of a service definition that can be added on Host(B) to check the services on Host(C) using the NRPE service on Host(B) itself?

Thanks for your help in advance!

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Feb 11, 2015 10:38 pm
by Box293
Here is a generic command that I will use as an example:

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
So Host(C) will have this in their nrpe.cfg file.


On Host(B) you will have this in the nrpe.cfg file:

Code: Select all

command[check_remote]=/usr/local/nagios/libexec/check_nrpe -H $ARG1$ -t 30 -c $ARG2$

Then from Core(A) you would execute the following command:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H host_B_address -t 30 -c check_remote host_C_address check_load
Core(A) will request Host(B) to execute a check which in turn requests Host(C) to execute the check check_load

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Feb 11, 2015 10:53 pm
by Apurv
Got ya!! Box293...

And if we have to do this check for a windows server ?

Assuming that the nagios server(Host A) and remote windows server (Host B) are in same network. Remote windows server(Host C) is in a different network. How would we be able to monitor the stats on (Host C) using the NSCP++ client on (Host B).

Can anyone of you please guide me on achieving results on the above situation?

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Thu Feb 12, 2015 12:19 am
by Box293
It's basically the same concept but I'm unsure how to get NSClient++ to run check_nrpe from Host(B). I'm sure NSClient++ has the ability to do this, just not sure what it is.

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Feb 25, 2015 3:23 am
by Apurv
Thank you very much Box293 and tmcdonald for ur help.

I was able to implement indirect checks using the guidelines provided by you.

Now I wanna try to do indirect host check using NSCP++ client on windows servers.

Could you please assist me with any other guidelines to achieve the indirect checks using NSCP++?

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Feb 25, 2015 11:22 am
by lmiltchev
Could you please assist me with any other guidelines to achieve the indirect checks using NSCP++?
Can you give us an example of what type of checks you want to implement? Are you talking about running indirect checks against Windows or Linux machines? What metrics would you like to monitor?

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Feb 25, 2015 8:51 pm
by Box293
Apurv wrote:Thank you very much Box293 and tmcdonald for ur help.

I was able to implement indirect checks using the guidelines provided by you.

Now I wanna try to do indirect host check using NSCP++ client on windows servers.

Could you please assist me with any other guidelines to achieve the indirect checks using NSCP++?
OK So I did some research on this and came up with this article which is exactly what you want to do.

Code: Select all

http://www.medin.name/blog/2012/12/16/putting-some-client-into-nsclient/
So let's do some basic checks.

FIRST I will make it clear, Host(B) is using NSClient++ 0.4.1.105 for my tests below.

My host(B) is 10.25.14.2 and will respond to a check_nrpe request:

Code: Select all

check_nrpe -H 10.25.14.2
I (0,4,1,105 2014-04-28) seem to be doing fine...
My host(C) is 10.25.14.1 and will respond to a check_nrpe request:

Code: Select all

check_nrpe -H 10.25.14.1
I (0,4,1,73 2012-12-17) seem to be doing fine...
OK so now let's get Host(B) to do that check of Host(C)
Logon to the windows server Host(B)
Open a command prompt

Code: Select all

cd "\Program Files\NSClient++\" 
nscp client -M NRPEClient -H 10.25.14.1
lots of output which ends with:
I (0,4,1,73 2012-12-17) seem to be doing fine...
So I've proved that Host(B) can perform an NRPE check against Host(C).

Lets do a real check.

Code: Select all

nscp client -M NRPEClient -H 10.25.14.1 -c CheckCPU --arguments warn=80 crit=90 time=1m time=5m time=15m
lots of output which ends with:
OK CPU Load ok.|'1m'=2%;80;90 '5m'=0%;80;90 '15m'=0%;80;90
Excellent, so we know it works with real checks. Now we just need to configure the Host(B) nsclient.ini file to allow the use of NRPEClient.

Logon to the windows server Host(B)
Open a command prompt

Code: Select all

cd "\Program Files\NSClient++\" 
nscp settings --activate-module NRPEClient
nscp service --stop
nscp service --start
Now from Host(A) execute this command:

Code: Select all

check_nrpe -H 10.25.14.2 -c nrpe_query -a host=10.25.14.1 query-command=CheckCPU query-arguments="warn=80" query-arguments="crit=90" query-arguments="time=1m" query-arguments="time=5m" query-arguments="time=15m"

Which should output:
OK CPU Load ok.|'1m'=0%;80;90 '5m'=0%;80;90 '15m'=0%;80;90
-H 10.25.14.2 = Host(B)
-a host=10.25.14.1 = Host(C)

It's a simple as that. Even I learnt something new today :)

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Mar 04, 2015 3:47 am
by Apurv
Wow!!!!!! Box293..... Ur way tooo good with nagios...

Thanks for the above reply... Now I have learnt how to perform an indirect check from nagios server to a windows server... :D :D :D



Do u have any idea about using graphite to generate real time graphs? If yes, then I would like to know how to implement graphite to generate real time graphs using nagios data.


Counting on you.... Thanks for your help in advance....