Reputation: 1070
I am new to snmp, and I am trying to figure out what OID's I should get/trap to see if my printers, switches (and servers) is running? I do not need to know the details - just a simple test. I have successfully med get, getbulk, (and walk) request from a device, both from bash and iReasoning MIB browser.
Edit:
Maybe the
.1.3.6.1.2.1.1.3.0
Name/OID: sysUpTime.0; Value (TimeTicks): 194 hours 43 seconds (69844352)
is used for just that!? What happens when something is wrong? -will this be reset immediately? -or will it just stop counting? or is it just the time since last power on?
Upvotes: 3
Views: 9457
Reputation: 43097
You should use the Printer MIBv2 to monitior printer error status for jams...
hrPrinterDetectedErrorState
reports printer errors such as low toner, jams, etc... the RFC contains details on what specific codes meanhrDeviceStatus
will reveal the big picture ability of the printer to handle tasks. For more info, see Printer MIBv2, Section 2.2.13.2sysUpTime.0
is an OID that reports the time a system's SNMP stack has been up (reference RFC 1213: MIB-II). If this value is returned and incrementing, it's a 99% safe bet that a printer is up. Most people use sysUpTime
to detect whether the device has rebooted for some reason; if that happens, you'll see a sudden decrease in sysUpTime.0
, unless your last value was around 248 days (where a 32-bit counter would roll).
Checking the basic health of ethernet switches is usually done with checks to sysDescr.0
or sysUpTime.0
; the problem with this heuristic comes if you care about the up/down status of particular links... at that point, you need to check values from ifOperStatus
, which is indexed by ifIndex
and uses interface names from ifName
. See the following examples...
[mpenning@Hotcoffee ~]$ ## Walk ifName correlated to ifIndex
[mpenning@Hotcoffee ~]$ snmpwalk -v 2c -c Public 172.25.116.6 .1.3.6.1.2.1.31.1.1.1.1
iso.3.6.1.2.1.31.1.1.1.1.1 = STRING: "Fa0/0"
iso.3.6.1.2.1.31.1.1.1.1.2 = STRING: "Nu0"
[mpenning@Hotcoffee ~]$ ## Walk ifOperStatus (up==1)
[mpenning@Hotcoffee ~]$ snmpwalk -v 2c -c Public 172.25.116.6 .1.3.6.1.2.1.2.2.1.8
iso.3.6.1.2.1.2.2.1.8.1 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.2 = INTEGER: 1
[mpenning@Hotcoffee ~]$
Thus we know from the example that both interface "Fa0/0" (index: 1) and "Nu0" (index: 2) have an ifOperStatus of "up"; the index value is the last integer returned in the OID of the results.
I assume you will use bash
for your monitoring scripts; if so, check out Net-SNMP for your SNMP manager
Upvotes: 3