Nagios ping fails

I recently setup NagiosXI with their provided amazon ami. It was very simple to setup and everything looked good. Added a couple servers and they all could not be pinged from Nagios. I couldn’t ping them from Nagios’ ping tool. I could ping them from the command line so I knew it was a configuration error.

First I tried:

$ /usr/local/nagios/libexec/check_ping -H www.google.com -c 100,90% -w 100,90%
CRITICAL - Network Unreachable (www.google.com)

Then I saw I needed to add the -4 to the command.

$ sudo vim /usr/local/nagios/etc/commands.cfg

Go to line 221 and add the “-4”

define command {
       command_name                             check_ping
       command_line                             $USER1$/check_ping -4 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}

Then you’ll need to restart Nagios.

$ sudo service nagios restart