2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/other/bgpd
2011-12-18 15:10:34 +01:00

40 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# bgpd.sh
#
#
# Created by spleen.
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title bgp pfxs'
echo 'graph_args -l 0'
echo 'graph_vlabel PfxRcvd'
echo 'graph_category System'
echo 'graph_scale no'
echo 'graph_info show ip bgp summary'
mfs=0
/usr/local/bin/vtysh -c "sh ip bgp su" | /usr/bin/awk '{ if (( $2 == "4" ) || ( $2 == "6")) print $1 }' | while read i; do
case $i in
*) name=`echo $i | /usr/bin/awk '{ gsub("[^a-zA-Z0-9_]", root_, $1); print $1 }'` ;;
esac
dn=`echo $i | sed 's/_/ /g'`
echo "$name.label $dn"
done
exit 0
fi
/usr/local/bin/vtysh -c "sh ip bgp su" | /usr/bin/awk '{ if (( $2 == "4" ) || ( $2 == "6")) print $1,$10 }' | while read i; do
case $i in
*) name=`echo $i | /usr/bin/awk '{ gsub("[^a-zA-Z0-9_]", root_, $1); print $1 }'` ;;
esac
dn=`echo $i | awk '{print $2}'`
echo "$name.value $dn"
done