SNMP Plugin for Nagios, Mini Server Environment Monitoring Power Reboot

Server Environment Monitoring, Secure Remote

NTI SNMP plugin for Nagios

Integrate the ENVIROMUX monitoring systems with the Nagios open source monitoring package


View Online Demo

SNMP plugin for Nagios

Installing the Plugin

To make use of the NTI SNMP plugin for Nagios, it must be properly inserted into your Nagios installation.  Plugins are usually installed in the libexec directory of your Nagios installation (i.e. /usr/local/nagios/libexec).  Simply copy the plugin (check_nti_snmp.pl) to the libexec directory of your installation.  Be sure to change its permissions to match those of the other plugins.

Configuring a Nagios Command

Next, you’ll need to add a Nagios command which will call the script.  To do this, you must add the contents of Listing 1 to your Nagios configuration.  The simplest method is to add the contents of Listing 1 to the file commands.cfg, which is often found in /usr/local/nagios/etc/object/commands.cfg.
# Command definition for Network Technologies Inc SNMP plugin
 define command{
       command_name    check_nti_snmp
       command_line    $USER1$/check_nti_snmp.pl -H $HOSTADDRESS$ $ARG1$
       }
Listing 1: Nagios command definition

Generating a Product Configuration

To monitor NTI products with the NTI SNMP plugin for Nagios, you should first use the script to assist in generating a proper configuration.  Using the script to generate the proper configuration greatly eases the burden of deciphering the MIB, interpreting sensor values, etc. To generate a configuration using the script, pass the –m config option, as shown in Listing 2.
root@dev:/usr/local/nagios/libexec# ./check_nti_snmp.pl -m config
Listing 2: Calling the script to generate a configuration

The script will then ask for some information required to generate a configuration, such as product type, IP address, and SNMP community string. The script can generate two types of configurations: one service for the entire device, and one service for each sensor. Generating one service for the entire device will create a single service entry in Nagios in which all sensors on the unit will be queried. Generating a service for each sensor will allow you finer grained control over which sensors are queried. An example of the information requested by the script is shown in Listing 3.
What product type are we configuring for Nagios?
 		1) ENVIROMUX-MINI-LXO
 		2) ENVIROMUX-2D
 		3) ENVIROMUX-16D
 		4) ENVIROMUX-5D
 		5) ENVIROMUX-MICRO
 		6) ENVIROMUX-MINI
 		7) ENVIROMUX-SEMS-16
 		8) IPDU-S2
Enter choice [1]:
Listing 3: Information requested by the script to create a product configuration

After entering all requested information, the script will generate an appropriate configuration based on your input and print it to the screen.  An example of such a configuration is shown in Listing 4.
# You need to define this command exactly once to monitor NTI products.
# define command{
#       command_name    check_nti_snmp
#       command_line    $USER1$/check_nti_snmp.pl -H $HOSTADDRESS$ $ARG1$
#       }
#

define host{
        use                    generic-host
        host_name              enviromuxMini_192.168.1.100
        alias                  ENVIROMUX-MINI 192.168.1.100
        address                192.168.1.100
        max_check_attempts     5
        }

define service{
        use                    generic-service
        host_name              enviromuxMini_192.168.1.100
        service_description    ALL_SENSORS
        check_command          check_nti_snmp!-m batch -C public -p enviromuxMini
        }  
Listing 4: Example configuration generated by the script

Installing Product Configuration into Nagios

The configuration generated by the script must now be added to Nagios. One way to accomplish this is to create a directory for all NTI product configurations and inform Nagios of this directory. For this example, we'll add the directory /usr/local/nagios/etc/objects/networktechinc/ to Nagios and then create a separate file for each device we wish to monitor. To do this, add the text as shown in Listing 5 to the file /usr/local/nagios/etc/nagios.cfg.
# Directory for Network Technologies Inc device configurations
cfg_dir=/usr/local/nagios/etc/objects/networktechinc
Listing 5: Adding a configuration directory to Nagios

Copy the previously generated configuration and place it in a new file in the directory /usr/local/nagios/etc/objects/networktechinc.  You can give this file any name you wish.  With this new file in place, you can now verify your configuration and restart Nagios.  Your newly added devices and services should now be monitored with Nagios.

Troubleshooting

After completing all steps, it's possible that you may run into some issues. When viewing the Service Detail page in Nagios, these are some common errors which may be seen and their most common causes.
  • Plugin output says: Return code of 126 is out of bounds - plugin may be missing
    • Usually indicates a permission issue with the plugin script. Verify the proper user and group are set on check_nti_snmp.pl. Also verify that the script has execute permissions.

  • Plugin output says: Return code of 127 is out of bounds - plugin may be missing
    • Usually indicates a mismatch between the command definition and the actual script filename. Verify that the check check_nti_snmp command definition specifies the correct filename (check_nti_snmp.pl).

  • Plugin output says: ERROR - unable to acquire sensor data!
    • Indicates that the script was unable to read sensor data from the device. Make sure that the device is powered. Make sure that the device IP is correct. Make sure that the device's SNMP agent is enabled.
Depending on your system, you may run into other problems when running the script.
  • -bash: ./check_nti_snmp.pl: /usr/bin/perl: bad interpreter: No such file or directory
    • The script expects perl to be installed at /usr/bin/perl. Verify that perl is installed. If it is, provide the correct path on the first line of the script.

  • ERROR: You do NOT have the Net::SNMP library
    • The script requires the Net::SNMP module for perl. Verify that this module is installed.
For more information regarding installing, configuring, and operating Nagios, please refer to the Nagios documentation.