cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

No More Net-SNMP Nodes

As an avowed Linux-head and long-time *nix Sysadmin wanna be, I'm more than a little miffed to see all of my pretty pretty non-windows servers lumped into this big bucket of "net-snmp" in the machine-type list.

With the new NPM 11.5 feature of being able to assign standard elements to different OIDS, plus just a touch of Linux and net-snmp wizardry, this is a thing of the past.

What We're Gonna Do:

  • set up a script on the target node (ultimately this will exist on ALL your target nodes) that responds to the command "osname" with the actual distribution and version.
  • edit the net-snmp config to run that script when a specific OID is polled
  • Assign that OID in NPM to replace the existing machine type.

Step 1 -  Get Scripting!

  1. Depending on your distribution, you might use uname, or lsb_release, or some other method. The upshot is that you want the command to output the OS name. For example the two commands I tried out where:
    1. Ubuntu: uname -v | awk '{ print $1 }'
    2. SuSe: lsb_release -d | awk '{ print $2, $4, $5, $6}'
  2. Create a script and roll it out to all systems
    Once you have a script that works (even if it's different for different Unix/Linux flavors), create a script (or scripts) that do that command. For example:
    #!/bin/bash
    uname -v | awk '{ print $1 }'
    then place this script in the SAME DIRECTORY on all systems.
    So it doesn't matter if the SuSe version does different commands than it's Ubuntu counterpart. It matters that it's always called /usr/bin/osname.sh

Step 2 - update your SNMP configuration

  1. in /etc/snmp/snmpd.conf file, add the following line:
    extend osname /usr/bin/osname.sh
    restart the snmp service each time you make this update.
  2. test test test!
    This is going to involve running "snmpwalk" a lot to make sure you can get SNMP to display this new value. Start with:
    snmpwalk -v2c -c <rocommunity> <hostname>
    and once you don't get errors, try:
    snmpwalk -v2c -c <rocommunity> <hostname> NET-SNMP-EXTEND-MIB::nsExtendObjects
    and finally:
    snmpwalk -v2c -c <rocommunity> <hostname> NET-SNMP-EXTEND-MIB::nsExtendOutLine.\"osname\".1
  3. test some more
    Once that works, you'll need to get the OID of your new object. While you can use "snmptranslate" for that, you may be better off using the snmpwalk.exe utility built into SolarWinds. That will also verify that you can walk this new object FROM the SolarWinds poller. (it's typically found in C:\program files(x86)\solarwinds\orion\snmpwalk.exe
  4. roll that change out to all systems
    Now that you have the snmpd.conf file working, roll it out to all your other *nix systems as well.

Add the poller to NPM

  1. Go to Settings, Manager Pollers, and create a new poller.
    1. Technology is "Node Details"
    2. On the next screen, you'll select "MachineType" and define a new data source
      1. Cancel out of the "Set a constant value"
      2. Click "Select an OID"
      3. Scroll to the bottom and check the "Looking for an OID..." box
      4. Give the OID a name (I like "osname")
      5. Enter the actual OID you discovered in step 4 above. It may take some trial and error since the snmpwalk is going to provide a VERY long number. You will take a portion of it. On my system, I grabbed 1.3.6.1.4.1.8072.1.3.2.3.1.1.
    3. Also note you have to pick a new SysObjectID - which I hard-coded as "Linux-SuSe" (or Linux-Ubuntu)
  2. Did I mention you should test this a few times?
  3. Apply the new poller to the appropriate *nix devices in your environment

There is one thing I haven't cracked yet - I know there is a way to make the net-snmp "extend" command respond to a SPECIFIC OID rather than a system-assigned one. If anyone else has done this, feel free to post in the commands and I'll update this post.

Labels (2)
Comments

I did a little research and found that the OID for the net-snmp extend is indexed based on the name of the used in the configuration. That is, each letter in the name is converted to its ASCII equivalent. If I’m reading this correctly, this should guarantee that the OID’s assignment will persist regardless of reboots, script changes, etc, so long as it remains defined on the target server with the same name. Source article is at http://www.adventuresinoss.com/2009/09/30/the-many-uses-of-net-snmp/

If you want to use a different OID, however, it looks like you can follow the steps listed here: Extensible SNMP Agents (Essential SNMP)‌.

I can't get this to work for some reason.

On the linux node everything seems to be working as intended:

$ snmpwalk -v2c -c public 127.0.0.1 nsExtendOutLine.\"osname\".1

NET-SNMP-EXTEND-MIB::nsExtendOutLine."osname".1 = STRING: Ubuntu 12.04.3 LTS


This is what I get from snmpwalk when using root OID 1.3.6.1.4.1.8072.1.3.2.2:

.1.3.6.1.4.1.8072.1.3.2.2.1.2.6.111.115.110.97.109.101 = STRING: "/usr/bin/osname.sh"

.1.3.6.1.4.1.8072.1.3.2.2.1.3.6.111.115.110.97.109.101 = STRING: ""

.1.3.6.1.4.1.8072.1.3.2.2.1.4.6.111.115.110.97.109.101 = STRING: ""

.1.3.6.1.4.1.8072.1.3.2.2.1.5.6.111.115.110.97.109.101 = INTEGER: 5

.1.3.6.1.4.1.8072.1.3.2.2.1.6.6.111.115.110.97.109.101 = INTEGER: 1

.1.3.6.1.4.1.8072.1.3.2.2.1.7.6.111.115.110.97.109.101 = INTEGER: 1

.1.3.6.1.4.1.8072.1.3.2.2.1.20.6.111.115.110.97.109.101 = INTEGER: 4

.1.3.6.1.4.1.8072.1.3.2.2.1.21.6.111.115.110.97.109.101 = INTEGER: 1

It seems as though I can only get the command, but not the output of the command?

I've configured the poller as described in your tutorial.

When activating the "osname" poller on the Linux node it looks like this:

osname.png

What am I missing?

Solution:

Seems I took away too much of the OID:

.1.3.6.1.4.1.8072.1.3.2.3.1.1.6.111.115.110.97.109.101 = STRING: "Ubuntu 12.04.3 LTS"

For BusyBox embedded Linux distributions uname and lsb_release won't work for step #1. Instead, you'll need to use the following command in its place.

busybox | head -1 | awk '{ print $1 " " $2}'

SAM 6.3 Beta 2 is now available which includes a Linux Agent for Node, Volume, Interface, and Application monitoring. This agent should address many of the shortcomings associated with monitoring Linux host via SNMP, up to and including properly reflecting the Linux distribution and version running. If you already own Server & Application Monitor and are under active maintenance, you can sign-up to participate in the beta at the link below.

I'm not seeing the place to create a new Poller in NPM 12. Do I need to create a new Universal Device Poller? If so, the info above doesn't apply/is different.

This works exactly as described. Thanks!

With redhat distros, we used command 'cat /etc/redhat-release'

Question though. When applying the poller to nodes...two things occur:

  1. The node name gets changed to be the IP address so we need to edit rename it back to the dns name.
  2. It ignores the syslocation, syscontact variables from the snmpd.conf that were previously being populated.
Version history
Revision #:
1 of 1
Last update:
‎03-30-2015 04:16 PM
Updated by: