Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Contents

Table of Contents

...

Overview

The purpose of this article is to outline steps to easily deploy a trap listener in your infrastructure to drive SNMP trap alerts into upUptime Infrastructure Monitor. time. Although the article utilizes Trap Receiver to snmptrapd provided by Net-SNMP to receive SNMP Traps traps and execute scripts, one can use any SNMP trap receiver as long as it can execute scripts when traps are received.  The steps provided in this article were applied to a Windows server.  Identical steps can be applied to a Linux server running Uptime Infrastructure Monitor.  Contact Uptime Support at [email protected] if you have any issues.

Net-SNMP is an SNMP application suite supported on numerous platforms including Windows and Linux (the two platforms the Uptime Infrastructure Monitor Monitoring Station is supported on)Trap Receiver is a utility for Windows. If the up.time Monitoring Station is on Windows, you may choose to install it on the same server. Here is a brief summary of what happens when an SNMP trap is sent:

  • the SNMP-enabled device sends an SNMP trap to the SNMP Trap Receiver
  • Trap Receiver reviews the list of configured Actions and executes Action(s) if the trap meets the filter
  • the Trap Receiver Action executes the Trap_Receiver.bat script, which is a wrapper for Trap_Receiver.vbs
  • snmptrapd service
  • snmptrapd compares the trap to the list of filters in the snmptrapd.conf file
  • when the trap matches the uptime filter, the trap_to_ext_event.pl perl script is executed
  • trap_to_ext_event.pl calls the Uptime Infrastructure Monitor Trap_Receiver.vbs calls up.time API to update the status of the External Check monitor associated with the device
  • if an Alert Profile is associated with the monitor, an alert notification is sent out

Below is a diagram depicting the process:

 

 

SNMP Trap Scripts Configuration

  1. Download the SNMP Trap Receiver Scripts
  2. Extract Trap_Receiver_Scripts.zip file
  3. Put the files in an appropriate directory (e.g. C:uptime)
  4. Open Trap_Receiver.bat and look for the “SCRIPT_DIR” variable. Change it to where you have put the scripts in step 2.
  5. Open Trap_Receiver.vbs and modify a few variables if needed:
    1. MonitoringStationHost
      …this is where the up.time Monitoring Station is installed. Make certain the hostname/IP used can communicate from where the scripts are to the Monitoring Station.

    2. MonitoringStationPort
      …this is the port up.time uses for the API. By default it’s 9996.

    3. AlertStatus
      …this is the severity of the alert in up.time when an SNMP trap is received.

      The value can be one of the following integers:

      • 0=OK
      • 1=Warning
      • 2=Critical
      • 3=Unknown

Trap Receiver Configuration

...

Install Net-SNMP and Perl

  1. Download Net-SNMP from http://sourceforge.net/projects/net-snmp/files/net-snmp%20binaries/5.6.1.1-binaries/net-snmp-5.6.1.1-1.x86.exe/download
  2. Download Strawberry Perl from http://strawberryperl.com/download/5.20.1.1/strawberry-perl-5.20.1.1-64bit.msi 
  3. Execute the Net-SNMP installer and accept the defaults.
  4. Execute the Strawberry Perl installer and accept the defaults

 

...

Create a snmptrapd configuration file and Perl script

  1. create a new file called snmptrapd.conf in the C:\usr\etc\snmp directory with contents similar to the following ("public" on the first line is the SNMP community string - feel free to changed accordingly, and the path to Uptime Infrastructure Monitor on the second line should be changed accordingly):

    Code Block
    authCommunity log,execute,net public 
    traphandle default C:\Strawberry\perl\bin\perl.exe "C:\Program Files\uptime software\uptime\scripts\snmp-trap-script\trap_to_ext_event.pl"
  2. in the Start menu, select the Net-SNMP folder, right click Register Trap Service and choose Run As Administrator
  3. start the "Net-SNMP Trap Handler" service 
  4. create the directory "C:\Program Files\uptime software\uptime\scripts\snmp-trap-script"
  5. download and copy this file, trap_to_ext_event.pl, to the directory mentioned in the previous step

This approach assumes that your SNMP trap service monitors all have the same name, "SNMP Trap (member)", and are managed via a Service Group.

There are two logs that are created with this solution, one when traps are received by the Net-SNMP Trap Handler service and another when the trap is sent into Uptime Infrastructure Monitor by the perl script. This helps to narrow down an issue if one arises.

...

Uptime Infrastructure Monitor Configuration

Create a new monitor called "SNMP Trap" and assign it to a Service Group, so that it can be applied to numerous Elements in Uptime Infrastructure Monitor.

  1. Create a Service Group for your devices that will send SNMP traps to Uptime Infrastructure Monitor.
    1. Click on the “Services” button at the top
    2. Click the "Add Service Group" link in the menu on the left
    3. Select "Regular" from the drop down and click the "Continue..." button
    4. Enter "SNMP Trap Group" as the name for the Service Group and, optionally, a description for the group
    5. In the "Available Element Groups" and "Available Elements" lists, choose the Element Groups and Elements that you want to have SNMP Trap monitors created for
    6. Click the "Finish" button and close the dialogue window
  2. Create an External Check monitor and assign it to the "SNMP Trap Group" Service Group.
  3. Download Trap Receiver from the following website:

    http://www.trapreceiver.com

  4. Install Trap Receiver
  5. Launch the Trap Receiver UI
  6. Click on the “Configure” button:

    Image Removed

  7. You should be at the “Actions” tab. Click “Add”:

    Image Removed

  8. Since the IP of the device sending out SNMP traps might be displayed differently in up.time, a separate action should be created for each device so that the proper hostname can be passed to up.time.
    To add a new action tied to a particular IP:
      1. Under “Watch”, select “Sender IP”.
      2. Under “Equals”, input the IP Address of the device that will be sending the SNMP Traps.
      3. Check the “Execute” checkbox and click “Configure”

    Image Removed

      1. Click on the “…” button and select the “Trap_Receiver.bat” from SNMP Trap Scripts Configuration Step 2
      2. In the Arguments box, type the following:
        --hostname=yourDeviceName
        
        …where “yourDeviceName” is the “Host Name” in up.time. The “Host Name” can be found under the “Info” tab in up.time. For example:

        Image Removed

      3. Check the “Include Trap Data” checkbox. See below:

    Image Removed

    1. Click “OK”
    2. Click “Update” to get back to the Configure Trap Receiver window.
  9. Go to the “Trap Data” tab
    1. Check the “Pass to Command Line” checkbox
    2. Click “Specify Parameters”

      Image Removed

    3. Make sure the following lines are checked and the Command Line Flags are as follow:
      VariableCommand Line Flags
      Ip AddressIpAddress
      Varbind DataVarbindData
      Varbind OIDVarbindOID

       

      The end result should look like this:

      Image Removed

    4. Click “OK” when complete
  10. The SNMP variables, by default, will be shown as numbers (e.g. 1.3.6…). To show more meaningful variable names, you will need to load the appropriate MIBs from your devices.
    Go to the “Mibs” tab in the “Configure Trap Receiver” window
    1. Check the “Translate OIDs” checkbox
    2. Obtain vendor-specific MIBs and load them by clicking the “Load MIB” button

      Image Removed

    3. Click “OK” when finish loading MIBs

    up.time Configuration

    Add an “External Check” Service Monitor in up.time:
    1. Click on the “Services” button at the top
    2. Click “Add Service Monitor” on the left
    3. Select “External Check” from the list of available Service Monitors and click “Continue…”
    4. Input “SNMP - Trap” as the Service Name
    5. From the drop down menu where it says "Select a System", select the host/device that will be sending the SNMP trap
    6. Click “Finish”
    7. Select the "Service Group" radio button and choose "SNMP Trap Group" from the drop down.
    8. Choose an Alert Profile to have alert messages sent to the appropriate users.
    9. Click “Finish”

Now when traps are received by the Net-SNMP snmptrapd service, the appropriate "SNMP Trap (member)" service monitor will be set to CRIT and an alert will be sent out.  When the status is acknowledged in the Uptime Infrastructure Monitor UI (click the ACK button), the status will be set back to OK.