Page 1 of 1

check_snmp help (missing MIB?)

Posted: Wed Aug 20, 2014 2:58 pm
by jbennett
I am trying to create a few more SNMP checks for our UPSs, but am running into issues. Please note: I am NOT trying to utilize traps. I've tried this in the past but they never seemd to update once issues had cleared so it was not a viable option for us.

When I look at the current checks, I see the following:

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_snmp -H 10.100.84.172 -C public -o upsBatteryStatus -m USHA-MIB -c 2:2
This check returns results successfully and all is fine. However,

Looking at the USHA-MIB file that I want to use, I see the following trap:

Code: Select all

ushaUpsFailed       TRAP-TYPE
        ENTERPRISE      upsTrapGroup
        DESCRIPTION
                "SEVERE: The ups is not working fine."
        ::= 6
If I try and do the following:

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_snmp -H 10.100.84.172 -C public -o ushaUpsFailed -m USHA-MIB -c 2:2
It returns with:

Code: Select all

OUTPUT: External command error: Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: USHA-MIB::ushaUpsFailed
I went into the mib folder (/usr/share/snmp/mibs) to pull up the USHA-MIB.mib file and it doesn't exist...

So now I'm really confused. Per the first check command, we are looking at the MIB file titled USHA-MIB. However, it doesn't exist...so A) how is it looking at it B) where is it?

Re: check_snmp help (missing MIB?)

Posted: Wed Aug 20, 2014 10:17 pm
by Box293
This website is of great help:
http://www.net-snmp.org/wiki/index.php/ ... cations_09

Code: Select all

For non-table objects ("scalars"), this instance subidentifier will always be '.0', and it must be included when making a GET request. 
So your command should be:

Code: Select all

/usr/local/nagios/libexec/check_snmp -H 10.100.84.172 -C public -o ushaUpsFailed.0 -m USHA-MIB -c 2:2
I added .0 to ushaUpsFailed


Does this fix your problem?

Re: check_snmp help (missing MIB?)

Posted: Thu Aug 21, 2014 8:24 am
by jbennett

Code: Select all

OUTPUT: External command error: Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: USHA-MIB::ushaUpsFailed.0
Unfortunately, I'm still getting the same message.

Re: check_snmp help (missing MIB?)

Posted: Thu Aug 21, 2014 3:09 pm
by sreinhardt
I don't think this is going to work. One thing to note is that traps are not generally, its possible but not done often, made available via snmp get requests. Traps are intended to always be asynchronously sent from the "client" device to the receiver and not requested. Are there other non-trap-type or non-notification-type traps that might provide the same or similar information?

Re: check_snmp help (missing MIB?)

Posted: Fri Sep 19, 2014 11:08 am
by jbennett
I'd really just prefer to use traps if at all possible, but they just don't seem to update. I can have a UPS send out a trap that a UPS has gone into bypass, but then once it's resolved, it doesn't update with a resolved message. It will stay there until there's another failure. I would think that there's a section within the MIB that I haven't edited correctly? Is that it or is this a normal issue?

Re: check_snmp help (missing MIB?)

Posted: Fri Sep 19, 2014 12:33 pm
by sreinhardt
Actually if you would like the check to auto-resolve after a period of time, I would suggest setting a freshness check of say 1 hour, and use check_dummy to return OK with a message of "Cleared down trap" or something along those lines that gives you a clear message. All this will do is tell core to clear the trap if nothing has come in for 1 hour, allowing you to receive another alert when a new trap comes in as warning or critical. I believe this is what you were asking, but correct me if that is not the case.

Re: check_snmp help (missing MIB?)

Posted: Fri Sep 19, 2014 4:55 pm
by rseiwert
Yes that Trap is not a MIB variable. You can poll MIB variables not traps. I typically test with snmpwalk and see what I get starting with enterprises. You will need the mib in your mibs directory.

You probably can query the upsBatteryGroupStatus object and get good feedback

Code: Select all

upsBatteryGroupStatus OBJECT-TYPE
     SYNTAX     INTEGER {
           unknown(1),
           batteryNormal(2),
           batteryLow(3),
           batteryDepleted(4),
           batteryDischarging(5),
           batteryFailure(6)
     }
     ACCESS read-only
     STATUS mandatory
     DESCRIPTION
               "The indication of the status in the UPS system's batteries."
     ::= { upsBatteryGroup 1 }

Re: check_snmp help (missing MIB?)

Posted: Fri Sep 19, 2014 5:01 pm
by rseiwert
Also I would be checking and grabbing perf data from
Sorry to spam the forum but it looks like you can query a lot of useful info.

Code: Select all

UpsInputGroupEntry ::=
    SEQUENCE {
             upsInputGroupLineIndex   PositiveInteger,
             upsInputGroupFrequency   NonNegativeInteger,
             upsInputGroupVoltage     NonNegativeInteger,
             upsInputGroupCurrent     NonNegativeInteger,
             upsInputGroupTruePower   NonNegativeInteger,
             upsInputGroupVoltageMax  NonNegativeInteger,
             upsInputGroupVoltageMin  NonNegativeInteger
             }

Code: Select all

UpsOutputGroupEntry ::=
    SEQUENCE {
             upsOutputGroupLineIndex   PositiveInteger,
             upsOutputGroupVoltage     NonNegativeInteger,
             upsOutputGroupCurrent     NonNegativeInteger,
             upsOutputGroupPower       NonNegativeInteger,
             upsOutputGroupPercentLoad INTEGER
             }

Code: Select all

upsTestBatteryTestResult OBJECT-TYPE
        SYNTAX  INTEGER {
                donePassed(1),
                doneWarning(2),
                doneError(3),
                aborted(4),
                inProgress(5),
                noTestsInitiated(6)
        }

Code: Select all

emdSatatusTemperature OBJECT-TYPE
        SYNTAX  INTEGER
        ACCESS read-only
        STATUS mandatory
        DESCRIPTION
                "The measurement of EMD temperature, in 0.1 degree"
        ::= { emdStatus 2}

emdSatatusHumidity OBJECT-TYPE
        SYNTAX  INTEGER
        ACCESS read-only
        STATUS mandatory
        DESCRIPTION
                "The measurement of EMD humidity, in 0.1 degree"
        ::= { emdStatus 3}

Re: check_snmp help (missing MIB?)

Posted: Mon Sep 22, 2014 10:27 am
by lmiltchev
jbennett, did you try rseiwert's suggestion?