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:
    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/

Step 2 - update your SNMP configuration

  1. in /etc/snmp/snmpd.conf file, add the following line:
    extend osname /usr/bin/
    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
    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.

Parents Reply Children
No Data