Projet

Général

Profil

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

root / plugins / network / net_hosts_ @ c3660c2a

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

1
#!/bin/sh
2
# munin plugin to show number of online network hosts on a subnet (needs fping)
3
# link with subnet name as suffix like _192.168.1
4
# will most likely need a custom timeout setting in /etc/munin/plugin-conf.d/munin-node
5
# for example:
6
# [net_hosts_*]
7
# timeout 20
8
#
9
# (c) 2011 jon@jon.bpa.nu
10
#%# family=manual
11

    
12
SUBNET=`echo $0 | cut -d'_' -f3`
13
TIMEOUT=50 # ms
14
RETRIES=0
15

    
16
case $1 in
17
	config)
18
	cat <<CFG
19
graph_title hosts on network $SUBNET.
20
graph_vlabel hosts
21
graph_category network
22
hosts.label hosts
23
CFG
24
	exit 0;;
25
esac
26

    
27
if [ $SUBNET != "" ]; then
28
	echo "hosts.value `fping -t $TIMEOUT -r $RETRIES -ga \"$SUBNET.0/24\" 2>/dev/null | wc -l`"
29
else
30
	echo "could not get subnet name ($SUBNET)"
31
fi