#!/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