mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 10:28:36 +00:00
Merge pull request #94 from shartge/for-upstream
simple plugins to monitor a hosts ARP cache
This commit is contained in:
commit
25069428a5
2 changed files with 97 additions and 0 deletions
42
plugins/arp/arp
Executable file
42
plugins/arp/arp
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor total ARP entries
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional)
|
||||
#
|
||||
# Made by Sven Hartge (sven AT svenhartge DOT de)
|
||||
#
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
# Search for arp
|
||||
which arp >/dev/null 2>/dev/null || (echo "no (can't find arp binary)" && exit 1)
|
||||
|
||||
# ...or success
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title ARP entries'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel Entries'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_info This graph shows the number of ARP entries registered by the system.'
|
||||
echo 'entries.label ARP entries'
|
||||
echo 'entries.draw LINE2'
|
||||
echo 'entries.type GAUGE'
|
||||
echo 'entries.info Number of ARP entries'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
arp -an | awk 'BEGIN { regex="<incomplete>";} { if (!match($4,regex)) { a[$4] }} END{for(i in a){n++};print "entries.value " n}'
|
||||
|
55
plugins/arp/arp_
Executable file
55
plugins/arp/arp_
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor ARP entries per interface
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional)
|
||||
#
|
||||
# Made by Sven Hartge (sven AT svenhartge DOT de)
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
INTERFACE=`basename $0 | sed 's/^arp_//g' | tr '_' '.'`
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
# Search for arp
|
||||
which arp >/dev/null 2>/dev/null || (echo "no (can't find arp binary)" && exit 1)
|
||||
|
||||
# ...or success
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "suggest" ]; then
|
||||
if [ -r /proc/net/dev ]; then
|
||||
egrep '^ *(eth|wlan|ath|ra)[0-9]+(\.[0-9]+)?:' /proc/net/dev | cut -f1 -d: | sed 's/ //g' | tr '.' '_'
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_title ARP entries for $INTERFACE"
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel Entries'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_scale no'
|
||||
echo "graph_info This graph shows the number of ARP entries registered by the system for interface $INTERFACE."
|
||||
echo 'entries.label ARP entries'
|
||||
echo 'entries.draw LINE2'
|
||||
echo 'entries.type GAUGE'
|
||||
echo 'entries.info Number of ARP entries'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
arp -an -i $INTERFACE | awk 'BEGIN { regex="<incomplete>";} { if (!match($4,regex)) { a[$4] }} END{for(i in a){n++};print "entries.value " n}'
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue