Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / network / bgpd @ d7f54f3e

Historique | Voir | Annoter | Télécharger (1,12 ko)

1 a80edcab spleen
#!/bin/sh
2
3
# bgpd.sh
4 17f78427 Lars Kruse
#
5 a80edcab spleen
#
6
# Created by spleen.
7
8
if [ "$1" = "autoconf" ]; then
9
        echo yes
10
        exit 0
11
fi
12
13
if [ "$1" = "config" ]; then
14
15
        echo 'graph_title bgp pfxs'
16
        echo 'graph_args -l 0'
17
        echo 'graph_vlabel PfxRcvd'
18
        echo 'graph_category System'
19
        echo 'graph_scale no'
20
        echo 'graph_info show ip bgp summary'
21
        mfs=0
22
        /usr/local/bin/vtysh -c "sh ip bgp su" | /usr/bin/awk '{ if (( $2 == "4" ) || ( $2 == "6")) print $1 }' | while read i; do
23
                case $i in
24
                *) name=`echo $i | /usr/bin/awk '{ gsub("[^a-zA-Z0-9_]", root_, $1); print $1 }'` ;;
25
                esac
26
                dn=`echo $i | sed 's/_/ /g'`
27
                echo "$name.label $dn"
28
        done
29
        exit 0
30
fi
31
32
/usr/local/bin/vtysh -c "sh ip bgp su" | /usr/bin/awk '{ if (( $2 == "4" ) || ( $2 == "6")) print $1,$10 }' | while read i; do
33
                case $i in
34
                *) name=`echo $i | /usr/bin/awk '{ gsub("[^a-zA-Z0-9_]", root_, $1); print $1 }'` ;;
35
                esac
36
                dn=`echo $i | awk '{print $2}'`
37
                echo "$name.value $dn"
38
        done