I converted the script I wrote to monitor BGP on Cisco routers via SNMP into Nagios plugin. I did not like check_bgp plugin which comes with Nagios, because it requires username and password to access a router to be stored in plain text.

Here is how to configure Nagios to use my plugin:
copy check_bgp_snmp.pl into nagios/libexec directory. Then, add the following to Nagios config


define command{
command_name check_bgp_snmp
command_line $USER1$/check_bgp_snmp.pl -r $HOSTADDRESS$ -c $ARG1$
}



define service{
host_name router1
service_description BGP CHECK
check_command check_bgp_snmp!public
max_check_attempts 2
normal_check_interval 5
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
notifications_enabled 0
contact_groups admins
}

replace "router1" with your router IP address and "public" with appropriate
SNMP community string


Download check_bgp_snmp.pl