Projet

Général

Profil

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

root / plugins / network / ping_host @ dd4afac8

Historique | Voir | Annoter | Télécharger (768 octets)

1 e1e38ea0 Paul Mansfield
#!/bin/sh
2
3
H=`echo $0 | awk -F_ '{print $2}'`
4
5
if [ "$1" = "config" ] ; then
6
7
	echo "graph_title Ping RTT $H"
8
	echo "graph_category network"
9
	echo "graph_info this graph shows the average RTT of five pings to $H"
10
	echo "graph_vlabel ping_rtt"
11
	echo "ping_rtt.label ms"
12
	echo "ping_rtt.warning 12"
13
	echo "ping_rtt.critical 15"
14
	echo "ping_loss.warning 40"
15
	echo "ping_loss.critical 60"
16
	exit
17
fi
18
19
/sbin/ping -W 1 -c 5 $H > /tmp/munin-node-ping-$H
20
21
RTTAVG=`sed -n '2,6p' /tmp/munin-node-ping-$H | sed -e 's/.*time=//g' -e 's/ ms//g' | awk '{ ORS= "" ; print $1 " " }' | sed -e 's#$# + + + + 3 k 4 / p#g' | dc`
22
PKTLOSS=`sed -n 9p /tmp/munin-node-ping-$H | sed -e 's/.*received, //g' -e 's/% packet loss//g'`
23
24
echo "ping_rtt.value $RTTAVG"
25
echo "ping_loss.value $PKTLOSS"