Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / network / fping_ @ c3660c2a

Historique | Voir | Annoter | Télécharger (1,06 ko)

1 12d632ca Thomas VIAL
#!/bin/sh
2
#
3 29be1c00 tomav
# Description  : Plugin to monitor a server/network availability.
4
# Author       : Thomas VIAL
5 5cbdd737 Thomas VIAL
# Author URL   : http://tvi.al
6 5cfe8f9a Thomas VIAL
# Usage        : ln -s /path/to/fping_ /etc/munin/plugins/fping_www.google.com
7 fba800ae Veres Lajos
# Explanation : Will graph connection to www.google.com  
8 29be1c00 tomav
# Requirements :
9 12d632ca Thomas VIAL
# * fping
10
#
11
12
target=`basename $0 | sed 's/^fping_//g'`
13 29be1c00 tomav
item=`echo $target | sed -e 's/\.//g'`
14
15
#
16
# Config
17
#
18 12d632ca Thomas VIAL
19
if [ "$1" = "config" ]; then
20
  echo "graph_title ${target} availability"
21 5cbdd737 Thomas VIAL
  echo "graph_args --base 1000 -r -l 0 -u 100"
22
  echo "graph_vlabel Availability in %"
23 12d632ca Thomas VIAL
  echo "graph_category network"
24 29be1c00 tomav
  echo "graph_info Displays Network Availability"
25 12d632ca Thomas VIAL
  # Failure
26 5cbdd737 Thomas VIAL
  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 12d632ca Thomas VIAL
  exit 0
34
fi
35
36 29be1c00 tomav
#
37
# Let's go!
38
#
39 12d632ca Thomas VIAL
40
fping -q $target
41
status=$?
42
43
if [ $status -eq 0 ]; then
44 29be1c00 tomav
    # Success
45 5cbdd737 Thomas VIAL
    echo "success.value 100"
46
    echo "failure.value 0"
47 12d632ca Thomas VIAL
else
48 29be1c00 tomav
    # Failure
49 5cbdd737 Thomas VIAL
    echo "success.value 0"
50
    echo "failure.value 100" 
51 12d632ca Thomas VIAL
fi