check_ping Plugin - choose interface

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
pippopippo
Posts: 1
Joined: Mon Apr 25, 2016 7:41 am

check_ping Plugin - choose interface

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_ping Plugin - choose interface

Post 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.
Former Nagios Employee
Locked