2013-08-20 21:31:15 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2013-08-20 22:48:47 +02:00
|
|
|
# Description : Plugin to monitor a server/network availability.
|
|
|
|
# Author : Thomas VIAL
|
2013-08-21 12:03:09 +02:00
|
|
|
# Author URL : http://tvi.al
|
2013-08-22 23:53:28 +02:00
|
|
|
# Usage : ln -s /path/to/fping_ /etc/munin/plugins/fping_www.google.com
|
2013-08-20 22:48:47 +02:00
|
|
|
# Explaination : Will graph connection to www.google.com
|
|
|
|
# Requirements :
|
2013-08-20 21:31:15 +02:00
|
|
|
# * fping
|
|
|
|
#
|
|
|
|
|
|
|
|
target=`basename $0 | sed 's/^fping_//g'`
|
2013-08-20 22:48:47 +02:00
|
|
|
item=`echo $target | sed -e 's/\.//g'`
|
|
|
|
|
|
|
|
#
|
|
|
|
# Config
|
|
|
|
#
|
2013-08-20 21:31:15 +02:00
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
echo "graph_title ${target} availability"
|
2013-08-21 12:03:09 +02:00
|
|
|
echo "graph_args --base 1000 -r -l 0 -u 100"
|
|
|
|
echo "graph_vlabel Availability in %"
|
2013-08-20 21:31:15 +02:00
|
|
|
echo "graph_category network"
|
2013-08-20 22:48:47 +02:00
|
|
|
echo "graph_info Displays Network Availability"
|
2013-08-20 21:31:15 +02:00
|
|
|
# Failure
|
2013-08-21 12:03:09 +02:00
|
|
|
echo "failure.label Unreachable"
|
|
|
|
echo "failure.draw AREA"
|
|
|
|
echo "failure.colour ff0000"
|
|
|
|
# Success
|
|
|
|
echo "success.label Reachable"
|
|
|
|
echo "success.draw STACK"
|
|
|
|
echo "success.colour 00CC00CC"
|
2013-08-20 21:31:15 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2013-08-20 22:48:47 +02:00
|
|
|
#
|
|
|
|
# Let's go!
|
|
|
|
#
|
2013-08-20 21:31:15 +02:00
|
|
|
|
|
|
|
fping -q $target
|
|
|
|
status=$?
|
|
|
|
|
|
|
|
if [ $status -eq 0 ]; then
|
2013-08-20 22:48:47 +02:00
|
|
|
# Success
|
2013-08-21 12:03:09 +02:00
|
|
|
echo "success.value 100"
|
|
|
|
echo "failure.value 0"
|
2013-08-20 21:31:15 +02:00
|
|
|
else
|
2013-08-20 22:48:47 +02:00
|
|
|
# Failure
|
2013-08-21 12:03:09 +02:00
|
|
|
echo "success.value 0"
|
|
|
|
echo "failure.value 100"
|
2013-08-20 21:31:15 +02:00
|
|
|
fi
|