Monday, September 09, 2013

Monitoring BGP using NAGIOS

We can use check_bgp NAGIOS plugin for monitoring BGP. Visit for more details.

How to install and configure check_bgp plugin?

In the demonstration, I will be using NAGIOS server installed in Ubuntu Linux, and i want to monitor BGP in a Cisco ASR 1006 router. Since this plugin uses BGP4-MIB and SNMP, It can be used to monitor any router with SNMP.
  1. Download perl script from the link given above. 0.4 is the recent version.
  2. Now move this perl script to /usr/lib/nagios/plugins directory using the command
    sudo mv /usr/lib/nagios/plugins
  3. Make the perl script executable.
     sudo chmod +x /usr/lib/nagios/plugins/
  4. Now before adding the command definition to NAGIOS, test the plugin from BASH terminal. Syntax is as follows:
     /usr/lib/nagios/plugins/ -H <Router IP> -C <SNMP communitystring configured in router> -p <BGP Neighbour IP to monitor>

    If you get output from the plugin, you can proceed to add command definition and Service definition in NAGIOS.
  5. Now define a command and a service for the host object Router in NAGIOS as follows:
     define command {
       command_name check_bgp
       command_line /usr/lib/nagios/plugins/ -H $HOSTADDRESS$ -C    $ARG1$ -p $ARG2$
    define service{
       use     generic-service         ; Name of service template to use
       host_name   corerouter
       service_description   BGP states-iBGP
       check_command         check_bgp!iol!