Dynamically monitor interfaces with Nagios

  • by Patrick Ogenstad
  • January 26, 2015

Network switchesWhen you’re setting up your monitoring configuration for Nagios or compatible software it can be a hassle to decide which interfaces you actually want to monitor. Well rather how to monitor those interfaces. The nm_check_admin_up_oper_down plugin (part of Nelmon) checks the configuration of your network devices and reports a problem if you’ve indicated that the interface should be up.

How does it work?

The plugin uses SNMP to find which interfaces have been configured to be enabled, on a Cisco device this would be an interface where you’ve run the command “no shutdown”. This is done by polling ifAdminStatus. The resulting list of interfaces are then compared to the interfaces which are down by polling ifOperStatus. If there are any interfaces which are enabled but reported to be down the plugin tries to find the name and description of those interfaces and prints out this information to your Nagios console.

How to use the plugin

Before you can use the plugin you have to install the Nelmon module.

You would then define a command which uses this plugin.

# check_admin_up_oper_down using SNMPv2
define command{
  command_name  check_admin_up_oper_down_v2
  command_line  $USER1$/nm_check_admin_up_oper_down -H $HOSTADDRESS$ -P 2c -C $ARG1$ $ARG2$

In this example $ARG1$ would be your SNMPv2 Community string and $ARG2$ would be either -w or -c depending on the exit status you want the plugin to return if it finds any interfaces which are down. The plugin also supports SNMPv3.

A service which is using this command could look like this:

define service{
  hostgroup_name         base-switches
  use                    base-network-connectivity
  service_description    Interfaces Down
  check_command          check_admin_up_oper_down_v2!cisco!-c

In this example I use a service template called base-network-connectivity.

When is the plugin useful?

The plugin is meant to be used against network equipment where you know that an interface which is down will indicate some sort of error condition. This means that you shouldn’t use the plugin against access switches where your end users are connected. That way you would be bombarded with errors when your user go home for the day.


Download Nelmon - The nm_check_admin_up_oper_down is located in the plugins directory.