root / plugins / ping / fping_ @ 17f78427
Historique | Voir | Annoter | Télécharger (1,06 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# |
| 3 |
# Description : Plugin to monitor a server/network availability. |
| 4 |
# Author : Thomas VIAL |
| 5 |
# Author URL : http://tvi.al |
| 6 |
# Usage : ln -s /path/to/fping_ /etc/munin/plugins/fping_www.google.com |
| 7 |
# Explanation : Will graph connection to www.google.com |
| 8 |
# Requirements : |
| 9 |
# * fping |
| 10 |
# |
| 11 |
|
| 12 |
target=`basename $0 | sed 's/^fping_//g'` |
| 13 |
item=`echo $target | sed -e 's/\.//g'` |
| 14 |
|
| 15 |
# |
| 16 |
# Config |
| 17 |
# |
| 18 |
|
| 19 |
if [ "$1" = "config" ]; then |
| 20 |
echo "graph_title ${target} availability"
|
| 21 |
echo "graph_args --base 1000 -r -l 0 -u 100" |
| 22 |
echo "graph_vlabel Availability in %" |
| 23 |
echo "graph_category network" |
| 24 |
echo "graph_info Displays Network Availability" |
| 25 |
# Failure |
| 26 |
echo "failure.label Unreachable" |
| 27 |
echo "failure.draw AREA" |
| 28 |
echo "failure.colour ff0000" |
| 29 |
# Success |
| 30 |
echo "success.label Reachable" |
| 31 |
echo "success.draw STACK" |
| 32 |
echo "success.colour 00CC00CC" |
| 33 |
exit 0 |
| 34 |
fi |
| 35 |
|
| 36 |
# |
| 37 |
# Let's go! |
| 38 |
# |
| 39 |
|
| 40 |
fping -q $target |
| 41 |
status=$? |
| 42 |
|
| 43 |
if [ $status -eq 0 ]; then |
| 44 |
# Success |
| 45 |
echo "success.value 100" |
| 46 |
echo "failure.value 0" |
| 47 |
else |
| 48 |
# Failure |
| 49 |
echo "success.value 0" |
| 50 |
echo "failure.value 100" |
| 51 |
fi |
