2010-05-25 09:48:00 +02:00
|
|
|
#!/bin/sh
|
2013-06-02 22:09:43 +02:00
|
|
|
#
|
|
|
|
# Plugin to monitor total ARP entries
|
|
|
|
#
|
|
|
|
# Parameters understood:
|
|
|
|
#
|
|
|
|
# config (required)
|
|
|
|
# autoconf (optional)
|
|
|
|
#
|
|
|
|
# Made by Sven Hartge (sven AT svenhartge DOT de)
|
|
|
|
#
|
2010-05-25 09:48:00 +02:00
|
|
|
|
|
|
|
#%# family=contrib
|
|
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
2013-06-02 22:09:43 +02:00
|
|
|
# Search for arp
|
2010-05-25 09:48:00 +02:00
|
|
|
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'
|
2013-06-02 22:09:43 +02:00
|
|
|
echo 'graph_scale no'
|
2010-05-25 09:48:00 +02:00
|
|
|
echo 'graph_info This graph shows the number of ARP entries registered by the system.'
|
|
|
|
echo 'entries.label ARP entries'
|
2013-06-02 22:09:43 +02:00
|
|
|
echo 'entries.draw LINE2'
|
2010-05-25 09:48:00 +02:00
|
|
|
echo 'entries.type GAUGE'
|
|
|
|
echo 'entries.info Number of ARP entries'
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2013-06-02 22:09:43 +02:00
|
|
|
arp -an | awk 'BEGIN { regex="<incomplete>";} { if (!match($4,regex)) { a[$4] }} END{for(i in a){n++};print "entries.value " n}'
|