Monitoring remote hosts using NRPE on another remote host

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.
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Monitoring remote hosts using NRPE on another remote host

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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).
Former Nagios employee
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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++?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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 :)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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....
Locked