Is there a correct/better way of determining the correct OID to use for SNMP monitoring?
I was able to download the MIB directly from the device, but I am lost on finding the correct OID from the list of hundreds of OIDs. All forums that I've come across have a different model OID, or simply say "use the OID and you'll be good" without details...
Steps Taken
- downloaded the MIB from the device
- Verified I could ping the device
- Verified I could run snmpwalk on the device (NOTE I am not familiar with all features and usage of snmpwalk)
From my experience, sadly no, I had to get the MIB and try to find in them the correct thing I need to query. (I used a simple mib browser)
For the OID you found, temperature too high, be sure it’s not a boolean value that set it at on/1 when it trigger, it could explain why you read nothing if the device is operating under normal temperature.
Sadly OID usage and documentation is underated online and not popular. I used to create monitoring templates inside a monitoring tool for unknown device from the tool, and I was seen as a black magic user to do so..
The only tip I can tell is watch for the return value, some are string even if they are wrote as a number, and other are simply integer.
While a MIB browser can indeed help, you can do a lot of parsing with the NET-SNMP
snmptranslate
command. There are quite a few options, so consult its man page, but here are a couple of examples.Let's say I have downloaded MIBs for a Synology device and want to monitor it. I can use snmptranslate to take a peek in the MIBs in a more user-friendly way than just reading the raw MIB file.
To start, I will check out SYNOLOGY-SYSTEM-MIB.txt I have downloaded.
Let's find out the actual name of the MIB. Sometimes it is the same as the name of the MIB file, but not always. Statement
DEFINITIONS
is used to define the name of the MIB.So now I know that the MIB is called
SYNOLOGY-SYSTEM-MIB
.Next, I will look inside to find the top OID defined in it:
The last line is the intersting one, specifically
synoSystem
. This is the top OID which I can now use to get the structure of the MIB.When polling an OID in text form,
MIB::OID
notation should be used. This is so snmp command knows which MIB to use to translate the OID into numerical form which agents understand (very similar to the principle of DNS translation):And the output is:
Now, let's say that I am interested in OID
upgradeAvailable
so that I can tell when I can upgrade the DSM on this box. I can find more details about it by running:And the output is:
So now when I actually poll the device, I know I am running the latest DSM:
Hope this helps someone.