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!
- 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:
- Ubuntu: uname -v | awk '{ print $1 }'
- SuSe: lsb_release -d | awk '{ print $2, $4, $5, $6}'
- 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
- 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. - 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 - 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 - 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
- Go to Settings, Manager Pollers, and create a new poller.
- Technology is "Node Details"
- On the next screen, you'll select "MachineType" and define a new data source
- Cancel out of the "Set a constant value"
- Click "Select an OID"
- Scroll to the bottom and check the "Looking for an OID..." box
- Give the OID a name (I like "osname")
- 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.
- Also note you have to pick a new SysObjectID - which I hard-coded as "Linux-SuSe" (or Linux-Ubuntu)
- Did I mention you should test this a few times?
- 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.