Consider the following scenario: Open a command prompt with Administrator rights
Host_A ---> Host_B ---> Host_C In all examples I'm using Host_xxx instead of an IP Address. Please replace any examples with an IP Address. This just makes it easier to read. Host_C Host_C is running Windows 2008 R2 and has NSClient++ 0.4.1.105 installed as per these instructions. Host_C has allowed Host_B to connect to it as per:
Restart the NSClient++ service if you make any changes to nsclient.ini. Host_B Host_B is running Windows 2008 R2 and has NSClient++ installed as per these instructions. Host_B has allowed Host_A to connect to it as per:
cd "\Program Files\NSClient++\" Command:
Output:
Now we need to configure NSClient++ on Host_B to listen for requests from Host_A to execute checks on Host_C. In the command prompt you have open:
Then restart the NSClient++ service
The next step will be to test this from Host_A. Host_A Host_A is the nagios server. Lets execute check_nrpe to Host_B to execute the command npre_query command which in turn will contact Host_C. Command:
Output:
How easy was that! All checks work in a similar fashion: Command:
Output:
Command:
Output:
Command:
Output:
Command:
Output:
What About Host Ping Checks???Normally when you monitor hosts with Nagios, you ping the host to make sure it's up or down. We can do the same thing in this scenario by using Host_B to ping Host_C. Host_C There is nothing special required here. Host_B NSClient++ comes with a script called check_ping.bat which can ping an address and return an OK or CRITICAL result. We need to enable some extra settings on Host_B. Open a command prompt with Administrator rights and type the following commands:
Then restart the NSClient++ service
The next step will be to test this from Host_A. Host_A Host_A is the nagios server. Lets execute check_nrpe to Host_B to execute the script check_ping which in turn will ping Host_C. Command:
Output IF Host_C is Up:
Yes, I did notice the spelling mistake! Output IF Host_C is Down:
NOTE: While creating this guide, it identified two issues with the check_ping.bat script.
Can I Also Query NPRE Clients On Linux From NSClient++???Yes, yes you can! Host_D Host_D is running CentOS 6.5 and has the NRPE client installed as per these instructions. On Host_D, these commands are already defined as part of the client install as per the instructions.
Host_D has allowed Host_B to connect to it as per the If you need to make any changes then restart the NRPE service afterwards:
The next step will be to test this from Host_A. Command:
Output:
How easy was that! All checks work in a similar fashion: Command:
Output:
Command:
Output:
Command:
Output:
Command:
Output:
NotesIf you followed the guide for NRPE then you know we couldn't pass any arguments that have a minus sign. This is not a problem in this scenario as NSClient++ has no problems receiving arguments that have a minus sign (and passing them on). In relation to the Host_A IP Address. In the scenario where Host_A is and Host_B have the internet between them, the IP Address that Host_B will see requests coming from is more than likely the WAN IP of the firewall at the Host_A site. |