2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/network/fping_

51 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#
# Description : Plugin to monitor a server/network availability.
# Author : Thomas VIAL
# Usage : ln -s /path/to/fping_ /etc/munin/fping_www.google.com
# Explaination : Will graph connection to www.google.com
# Requirements :
# * fping
#
target=`basename $0 | sed 's/^fping_//g'`
item=`echo $target | sed -e 's/\.//g'`
#
# Config
#
if [ "$1" = "config" ]; then
echo "graph_title ${target} availability"
echo "graph_args -l 0 -u 100"
echo "graph_vlabel Availability"
echo "graph_category network"
echo "graph_info Displays Network Availability"
# Success
echo "fping_${item}_success.label Reachable"
#echo "fping_${item}_success.type GAUGE"
echo "fping_${item}_success.colour 00CC00CC"
# Failure
echo "fping_${item}_failure.label Unreachable"
echo "fping_${item}_failure.type AREA"
echo "fping_${item}_failure.colour ff0000"
exit 0
fi
#
# Let's go!
#
fping -q $target
status=$?
if [ $status -eq 0 ]; then
# Success
echo "fping_${item}_success.value 100"
echo "fping_${item}_failure.value 0"
else
# Failure
echo "fping_${item}_success.value 0"
echo "fping_${item}_failure.value 100"
fi