checking BGP states on Cisco routers

m.hertrick at neovera.com m.hertrick at neovera.com
Wed Sep 24 22:21:34 CEST 2003


JC,

I've been watching this thread since the beginning and I think you've been creating more work for yourself than necessary.  I have an alternative you might consider trying that perhaps will put the simple back into SNMP.

Cisco provides details on the bgp mib you can use to finish the script.  (I don't know if these are vendor specific or not, but other vendors should freely provide their MIBs.)
http://www.cisco.com/pcgi-bin/Support/Mibbrowser/unity.pl?o=1.3.6.1.2.1.15&t=yes&st=3#oid

Here's a rough example:  (By no means should this be considered a working script... it's just to demonstrate the use of programs probably already on your monitoring system instead of heaps of unnecessary code.  With a little thought and effort, one could have a production worthy shell script in a reasonably short time.)

#!/bin/sh
                                                                                                                            
#
# Template for monitoring BGP;
# Possible usage:  "./bgpquery.sh 192.168.0.1 as 65233"
# Possible output:  "bgpLocalAs 65233 - OK"
#
#
# By Michael Hertrick
# License:  Just give me credit in the final script if you use this, or any portions of it.

#
ok=$3
warning=$4
critical=$5
#
                                                                                                                          
# Path
sp=/usr/pkg/bin
                                                                                                                            
# Binary
sb=snmpwalk
                                                                                                                            
# Arguments
sa='-Ov -c public -v1'
                                                                                                                            
# Target
st=$1
                                                                                                                            
# Relative OID
sr=15
                                                                                                                            
# Actual OIDs
case $2 in
    ver)
        msg=bgpVersion
        oid=1
    ;;
    as) 
        msg=bgpLocalAs
        oid=2
    ;;
esac
                                                                                                                            
output=`$sp/$sb $sa $st $sr.$oid`

case $output in
  $ok)
    echo "$msg $output - OK"
    exit 0
  ;;
  $warning)
    echo "$msg $output - WARNING"
    exit 1
  ;;
  $critical)
    echo "$msg $output - CRITICAL"
    exit 2
  ;;
  *)
    echo "Something didn't work right. - $output"
    exit 1
  ;;
esac


If you have questions, feel free to ask.

~Mike.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list