1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-09-18 16:48:44 +00:00

Plugin-Gallery: Better 2nd level headings

This commit is contained in:
dipohl 2017-02-24 03:40:55 +01:00
parent ae4e85ab60
commit e10e386b02
10 changed files with 7 additions and 2 deletions

41
plugins/arp/arp Executable file
View file

@ -0,0 +1,41 @@
#!/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}'

67
plugins/arp/arp_ Executable file
View file

@ -0,0 +1,67 @@
#!/bin/sh
#
# Plugin to monitor ARP entries per interface
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# Made by Sven Hartge (sven AT svenhartge DOT de)
# change to iproute by Martin89 (martin AT martin89 DOT de)
#
#
#%# family=contrib
#%# capabilities=autoconf suggest
case "$1" in
autoconf)
# Search for ip
which ip >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "no (can't find ip binary)"
exit 1
fi
# ...or success
echo 'yes'
exit 0
;;
suggest)
if [ ! -r /proc/net/dev ]; then
exit 1
fi
awk '$1~ /^(eth|wlan|ath|ra)[0-9]+(\.[0-9]+)?/ { gsub(":", ""); gsub("\.", "_"); print $1 }' /proc/net/dev
exit 0
;;
config)
INTERFACE="$(basename $0 | sed 's/^arp_//g' | tr '_' '.')"
if [ -z "$INTERFACE" ]; then
exit 1
fi
echo "graph_title ARP/NDP entries for $INTERFACE"
cat <<'EOM'
graph_args --base 1000 -l 0
graph_vlabel Entries
graph_category network
graph_scale no
graph_info This graph shows the number of ARP and NDP entries for a interface.
entries4.label ARP entries
entries4.info Number of ARP entries
entries6global.label NDP global entries
entries6global.info Number of NDP entries for global IPv6 address
entries6local.label NDP local entries
entries6local.info Number of NDP entries for link-local IPv6 address (fe80::/64)
EOM
exit 0
;;
esac
INTERFACE="$(basename $0 | sed 's/^arp_//g' | tr '_' '.')"
if [ -z "$INTERFACE" ]; then
exit 1
fi
ip neigh show dev "$INTERFACE" | awk 'BEGIN { a=0; b=0; c=0 }
/(REACHABLE|DELAY|STALE)/ { if ($1~ /^fe80:/){c++} else{if ($1~ /^[0-9]+\./) {a++} else{b++} } }
END { print "entries4.value", a "\nentries6global.value", b, "\nentries6local.value", c }'

54
plugins/arp/arp_bsd_ Normal file
View file

@ -0,0 +1,54 @@
#!/bin/sh
#
# Wildcard-plugin to monitor arp on interfaces. To monitor an
# interface, link arp_bsd_<interface> to this file. E.g.
#
# ln -s /usr/local/share/munin/plugins/arp_bsd_ /usr/local/etc/munin/plugins/arp_bsd_vlanX
#
# ...will monitor arp on interface vlanX.
#
# Any device found in /sbin/ifconfig can be monitored.
#
# Bugs : This plugins has been tested extensively on FreeBSD only
#
# Author : Luc Duchosal <luc.duchosal (at) arcantel (dot) ch>
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf suggest
INTERFACE=`basename $0 | sed 's/^arp_bsd_//g'`
if [ "$1" = "autoconf" ]; then
if [ -x /sbin/ifconfig ]; then
echo yes
exit 0
else
echo "no (/sbin/ifconfig not found)"
exit 0
fi
fi
if [ "$1" = "suggest" ]; then
if [ -x /sbin/ifconfig ]; then
/sbin/ifconfig -a | /usr/bin/grep -E '^[a-z]' | /usr/bin/awk -F\: '{print $1;}'
exit 0
else
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo "graph_title $INTERFACE arp"
echo 'graph_args --base 1000'
echo 'graph_vlabel arp per ${graph_period}'
echo 'graph_category network'
echo 'arp.label arp'
exit 0
fi
/usr/sbin/arp -an | /usr/bin/grep $INTERFACE | /usr/bin/wc -l | /usr/bin/awk '{ print "arp.value", $1;}'