[omd-users] SNMP function

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


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", "2" ] )

put at in:

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

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
  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
Discovering services on UPS:
   Running snmpbulkwalk -v2c -c 'public' -m '' -M '' -Cc -OQ -OU -On -Ot .

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

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

i get an infinity loop.

I read the man page for snmpbulkwalk

man snmpbulkwalk

an it seas:
       -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 .
. = "Ups Manufacturing srl"
. = "Ups Manufacturing srl"
. = "Ups Manufacturing srl"
Error: OID not increasing: .
 >= .

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

Any help would be greatly appropriated.

Thank you

-------------- 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