Page 1 of 1

check_ping Plugin - choose interface

Posted: Mon Apr 25, 2016 7:53 am
by pippopippo
Hi,

My host (a Raspberry PI) has 2 network interfaces (wlan0 - WIFI and eth1 - 3G dongle).

I need to check each different interface pinging 8.8.8.8 and taking packet loss % in order to understand if the interface is ok:

check wlan0 ----->ping -c 5 -q -I wlan0 8.8.8.8| grep -oP '\d+(?=% packet loss) --->if !=100 then interface wlan0 is ok

check eth1 ----->ping -c 5 -q -I eth1 8.8.8.8| grep -oP '\d+(?=% packet loss) --->if !=100 then interface eth1 is ok


Haw can have in Nagios the above informations ?

tks,

Pippo

Re: check_ping Plugin - choose interface

Posted: Mon Apr 25, 2016 10:33 am
by rkennedy
You'd want to create a wrapper plugin, that executes ping and your grep. You'll then need to assign warning / crit values for it. See this for more information -
https://nagios-plugins.org/doc/guidelin ... PLUGOUTPUT

This guide has a more in depth explanation -
http://www.yourownlinux.com/2014/06/how ... cript.html

Then, create a command definition to use this plugin in Nagios. (usually commands.cfg)

Once the command is defined, you can then assign it to any service needed in Nagios.