I have 3 machines, all remote IPs and all of them running nsclient++ with remote and local IP addresses:


I want nagios/icinga to remotely ping other local machines to see whether VLAN is working correctly.

Is there a way to tell nagios/icinga to use machine and to ping and ? check_ping is pinging only machine defined in host_name from icinga server. Icinga is on completely different ip range 92.*.*.*

Is there a way to do this to see VLAN workes fine?


As you are using nsclient++, I assume these are Windows hosts, and other remote execution options (e.g., push_check) are not available. However, nsclient++ has its own remote execution built-in. See details here: http://www.nsclient.org/nscp/wiki/CheckExternalScripts, for example, in the nsclient++ configuration, include

[External Scripts]
ping_remote=.\scripts\ping.bat $ARG1$

and a simple batch file scripts\ping.bat under the nsclient++ folder along these lines:

ping %1

This will exit with code 0 (Nagios "OK") if the host is reachable and code 1 (Nagios "Warning") if not. You could build a more elaborate batch script to do something a bit cleverer with the output.

Nagios's NRPE check can trigger this script. Define a command as follows:

define command {
    command_name check_ping_remote
    command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c ping_remote -a $ARG1$

And then fire it from the host configuration for one of your host machines with:

define service{
    host_name                       your_host_name
    service_description             Ping VPN
    check_command                   check_ping_remote!
    use                             generic-service
  • You would need "-a $ARG1$" in your above example. FYI, You can further abstract this to: command_line check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ and check_command check_nrpe_chain!check_ping! (or similar) – Keith Jan 11 '12 at 17:14
  • Thanks, I've fixed the check_nrpe syntax so that the example as given (hopefully) works now. Good point about defining a more general check_nrpe_chain command, though personally I find it less readable to have generic commands like that. – Dan Jan 12 '12 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.