Skip to content

Instantly share code, notes, and snippets.

@mateusza
Created September 5, 2013 21:51
Show Gist options
  • Save mateusza/6456699 to your computer and use it in GitHub Desktop.
Save mateusza/6456699 to your computer and use it in GitHub Desktop.
config_arp_hosts(){
echo "graph_title ARP hosts
graph_args --base 1000 -l 0
graph_vlabel hosts
graph_scale no
graph_category network"
for IFACE in $( ifconfig | grep -B 1 "inet addr" | grep Link | grep -v "^lo" | cut -d " " -f 1 )
do
echo "$IFACE.label $IFACE"
echo "$IFACE.warning 10"
echo "$IFACE.critical 11"
done
echo "any.label All interfaces"
echo "any.warning 20"
echo "any.critical 22"
echo "graph_info Visible hosts on each interface"
}
fetch_arp_hosts(){
for IFACE in $( ifconfig | grep -B 1 "inet addr" | grep Link | grep -v "^lo" | cut -d " " -f 1 )
do
echo "$IFACE.value" $( cat /proc/net/arp | grep "$IFACE" | wc -l )
done
echo "any.value $( cat /proc/net/arp | grep "^[0-9]" | wc -l )"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment