Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

46.*.*.1/192.168.1.1
46.*.*.2/192.168.1.2
46.*.*.3/192.168.1.3

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 192.168.1.1 and to ping 192.168.1.2 and 192.168.1.3 ? 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?

share|improve this question
add comment

1 Answer

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!192.168.1.2
    use                             generic-service
}
share|improve this answer
    
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!192.168.1.2 (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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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