1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-24 18:07:20 +00:00

Initial version

This commit is contained in:
jon 2011-04-01 17:46:44 +02:00 committed by Steve Schnepp
parent d27dd18580
commit 4a6b888ddc

35
plugins/other/net_hosts_ Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
# munin plugin to show number of online network hosts on a subnet (needs fping)
# link with subnet name as suffix like _192.168.1
# (c) 2011 jon@jon.bpa.nu
#%# family=auto
#%# capabilities=autoconf
SUBNET=`echo $0 | cut -d'_' -f3`
TIMEOUT=50 # ms
RETRIES=0
case $1 in
config)
cat <<CFG
graph_title hosts on network
graph_vlabel hosts
graph_category network
hosts.label hosts
CFG
exit 0;;
autoconf)
fping -h 2>/dev/null
if [ $? -eq 127 ]; then
echo "no (fping not present)"
exit 1
fi
echo yes
exit 0;;
esac
if [ $SUBNET != "" ]; then
echo "hosts.value `fping -t $TIMEOUT -r $RETRIES -ga \"$SUBNET.0/24\" 2>/dev/null | wc -l`"
else
echo "could not get subnet name ($SUBNET)"
fi