[omd-users] SNMP function

Miha Nedeljko miha.nedeljko at gmail.com
Fri Jul 1 11:12:46 CEST 2016


Hello,

I have omd installed.

I wrote a simple SNMP function: apcups

def inventory_apcups(info):
   # Debug: lets see how the data we get looks like
   print info
   return []

def check_apcups(item, params, info):
   return (3, "UNKNOWN - not yet implemented")

check_info["apcups"] = {
    "check_function"        : check_apcups,
    "inventory_function"    : inventory_apcups,
    "service_description"   : "UPS %s",
    "snmp_info"             : ( ".1.3.6.1.2.1.33.1.1", [ "1", "2" ] )
}


put at in:
/local/share/check_mk/checks/

I run command:
OMD:~/local/share/check_mk/checks$ check_mk -v --debug --checks apcups -D
UPS

UPS (10.9.33.57)
Tags:                   snmp-only, prod, snmp, lan, wato, /wato/
Host groups:
Contact groups:         all, check-mk-notify
Type of agent:          SNMP (community: 'public', bulk walk: yes, port:
default, inline: no)
Is aggregated:          no
Services:
  checktype item params description groups summarized to groups
  --------- ---- ------ ----------- ------ ------------- ------

than I run command:
OMD:~/local/share/check_mk/checks$ check_mk -v --debug --checks apcups -I
UPS
Discovering services on UPS:
UPS:
   Running snmpbulkwalk -v2c -c 'public' -m '' -M '' -Cc -OQ -OU -On -Ot
10.9.33.57 .1.3.6.1.2.1.33.1.1.1

I apperes that function is working but it is waiting on command
snmpbulkwalk.

When I run snmpbulkwalk command secretly:
snmpbulkwalk -v2c -c 'public' -m '' -M '' -Cc -OQ -OU -On -Ot 10.9.33.57
.1.3.6.1.2.1.33.1.1.1

i get an infinity loop.

I read the man page for snmpbulkwalk

man snmpbulkwalk

an it seas:
OPTIONS
       -Cc     Do not check whether the returned OIDs are increasing.  Some
agents (LaserJets are an example) return OIDs out of order, but  can
 complete  the  walk  anyway.
               *Other  agents  return  OIDs  that are out of order and can
cause snmpbulkwalk to loop indefinitely.*  By default, snmpbulkwalk tries
to detect this behavior and
               warns you when it hits an agent acting illegally.  Use -Cc
to turn off this behaviour.

       -Ci     Include the given OID in the search range.  Normally
snmpbulkwalk uses GETBULK requests starting with the OID you specified and
returns all results in the  MIB
               tree  after that OID.  Sometimes, you may wish to include
the OID specified on the command line in the printed results if it is a
valid OID in the tree itself.
               This option lets you do this.

If I use parameter -Ci instead of -Cc I get:
OMD:~/local/share/check_mk/checks$ snmpbulkwalk -v2c -c 'public' -m '' -M
'' -Ci -OQ -OU -On -Ot 10.9.33.57 .1.3.6.1.2.1.33.1.1.1
.1.3.6.1.2.1.33.1.1.1.0 = "Ups Manufacturing srl"
.1.3.6.1.2.1.33.1.1.1.0 = "Ups Manufacturing srl"
.1.3.6.1.2.1.33.1.1.1.0 = "Ups Manufacturing srl"
Error: OID not increasing: .1.3.6.1.2.1.33.1.1.1.0
 >= .1.3.6.1.2.1.33.1.1.1.0


How can I get my function to us parameter -Ci instead of Co ?

Any help would be greatly appropriated.

Thank you

Regards
Miha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mathias-kettner.de/pipermail/omd-users/attachments/20160701/614ac1ad/attachment.html>


More information about the omd-users mailing list