Discussion:
[Check_mk (english)] [Spam] checkmk-en Digest, Vol 111, Issue 63
chuck
2018-11-27 22:17:20 UTC
Permalink
Thanks a ton guys!! Both of you helped me a ton. I was stuck on that for
a bit. I've reworked everything and got it so no errors come up now,
however, i'm getting "CRIT- Can't find a value!" under  my service state
on the host. From what I can tell the "check" is supposed to
yield/return the value that you need to graph. I'm kind of just pulling
bits and pieces from other scripts in the bin folder and trying to make
something work for what we need. Also i'm not sure if this is allowed
but i'd be willing to pay someone to sit with me and work through this.
If it's not allowed then sorry for asking!

Here is the new script. Again, I really appreciate the feedback guys!

#!/usr/bin/python
import re

def parse_raisecom_y1731_delay_avg(info):
    parsed = {}
    for item in info:
        item = re.findall(r'\d+', str(item))
        parsed = item
    return parsed

def inventory_raisecom_y1731_delay_avg(parsed):
    print("Starting Inventory")
    print(parsed)
    return check_raisecom_y1731_delay_avg(None, None, parsed)

def check_raisecom_y1731_delay_avg(item, params, parsed):
    if not parsed:
        print("Data not parsed")
        yield 3, 'No data found'
    else:
        print("Yielding parsed results")
        print(parsed)
        yield (0, parsed)



# This check works on all SNMP hosts

check_info["raisecom_y1731_delay_avg"] = {
    'check_function':          check_raisecom_y1731_delay_avg,
    'inventory_function':      inventory_raisecom_y1731_delay_avg,
    'parse_function':          parse_raisecom_y1731_delay_avg,
    'service_description':     'raisecom_y1731_delay_avg',
    'snmp_info': ('.1.3.6.1.4.1.8886.6.1.36.3.1.1.6', '1'),
    'snmp_scan_function':      lambda oid: oid(".1.3.6.1.2.1.1.1.0") is
not None,
}
Send checkmk-en mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.mathias-kettner.de/cgi-bin/mailman/listinfo/checkmk-en
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of checkmk-en digest..."
1. Re: host inventory oscillating (Arno Wijnhoven)
2. Re: maximum recursion depth exceeded (Arno Wijnhoven)
----------------------------------------------------------------------
Message: 1
Date: Tue, 27 Nov 2018 08:03:05 +0000
Subject: Re: [Check_mk (english)] host inventory oscillating
Content-Type: text/plain; charset="utf-8"
Hi Gordon,
What do you mean? Like ‘automatically’? I can’t think of a situation where you’d want that

It wouldn’t be right if Check_MK would update my inventory if it suddenly can’t get info about a previous existing hard drive, for instance.
This is a plain error (drive missing) and I want a notification, not an inventory update.
If some services don’t exist anymore, they will go into ‘Unknown’ state and you have to remove them –manually-.
When you go to the services of a host via WATO, you can click ‘Remove vanished services’.
You can set an automatic periodic inventory update though - but remember: with great power comes great responsibility ☺.
FYI, Check_MK user Marco Reale created a beginner guide (https://mathias-kettner.com/download/Marco_Reale_Check_MK_Beginner_guide.pdf).
Hope this helps,
Arno
Sent: maandag 26 november 2018 17:57
Subject: Re: [Check_mk (english)] host inventory oscillating
My understanding of Check MK Inventory management is still very limited.
Under what circumstances does the Check MK monitor remove most/all of the inventory for a given host?
Gord Austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mathias-kettner.de/pipermail/checkmk-en/attachments/20181127/f9cee3fa/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 27 Nov 2018 08:34:32 +0000
Subject: Re: [Check_mk (english)] maximum recursion depth exceeded
Content-Type: text/plain; charset="utf-8"
Greg has a point. Best use a variable.
You cannot use the function name as return variable (as that will call the function again).
I've got a custom script that monitors Dell RAID BBUs. Perhaps something like this is included in recent versions, but back in the day a script like this didn't exist.
In the inventory function I'm creating a new variable which I return. The variable is filled in a for-loop using append.
Another thing. For the inventory function you don't want to return the actual value.
You'd want to return the name of the item you are monitoring. The value itself will be returned in the check.
battery_inventory = []
battery_inventory.append(( batteryControllerNumber, None ))
return battery_inventory # <------------ this returns a list of controller numbers to be matched in the check function, no actual values here!
"service_description" : "Controller %s", # <-------------- %s will be replaced by 'battery_inventory' from the inventory function
This results in 'Controller 1', 'Controller 2' etc.
The check function will get the actual value. The first thing in the check function will be matching the right controller.
This is why you see stuff like ' if batteryControllerNumber == item:' in each check function, where 'item' is a stored value from the inventory function.
I started with Python when starting with Check_MK and I love both.
I included one of my own scripts as this one is really short and comprehensible (at least, for me :D). Perhaps it's of any use to you as an example.
Hope this helps.
Arno Wijnhoven
-----Original Message-----
Sent: dinsdag 27 november 2018 06:39
Subject: Re: [Check_mk (english)] maximum recursion depth exceeded
I keep getting this maximum recursion depth exceeded. From what I can
see is it's getting stuck in a loop when parsing out my SNMP Request.
The OID only returns 1 value, but it looks like the script just keeps
looping over it and i'm not sure what i'm doing different than the
other scripts in the checks folder. I'm relatively new to both python
and CheckMK, so if I did something stupid, don't judge me too harsh
lol. I'd really appreciate some help on this though!
<snip>
--------------------------
#!/usr/bin/python
import re
print(parsed)
return inventory_raisecom_y1731_delay_avg(parsed)
return check_raisecom_y1731_delay_avg(item, params, parsed)
print(re.findall(r'\b\d+\b', str(info)))
parsed = re.findall(r'\b\d+\b', str(info))
return parsed
check_info["y1731_delay_avg"] = {
'check_function' : check_raisecom_y1731_delay_avg,
'inventory_function' : inventory_raisecom_y1731_delay_avg,
'parse_function' : parse_raisecom_y1731_delay_avg,
(".1.3.6.1.4.1.8886.6.1.36.3.1.1.6", ["1"]), }
At first glance I see that the inventory function is calling itself, a loop ensues. The same for the check function.
--
Greg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dell_cache_battery
Type: application/octet-stream
Size: 1793 bytes
Desc: dell_cache_battery
URL: <https://lists.mathias-kettner.de/pipermail/checkmk-en/attachments/20181127/3a2f9ab0/attachment.obj>
------------------------------
Subject: Digest Footer
_______________________________________________
checkmk-en mailing list
Manage your subscription or unsubscribe
https://lists.mathias-kettner.de/cgi-bin/mailman/listinfo/checkmk-en
------------------------------
End of checkmk-en Digest, Vol 111, Issue 63
*******************************************
--
Chuck Greve
Level I Support Technician
STARTOUCH INC
Ph.360.543.5679 Ext. 118
www.startouch.com
***@startouch.com
Washington State's Largest Microwave Internet Provider
chuck
2018-11-27 22:28:35 UTC
Permalink
Thanks a ton guys!! Both of you helped me a ton. I was stuck on that for
a bit. I've reworked everything and got it so no errors come up now,
however, i'm getting "CRIT- Can't find a value!" under  my service state
on the host. From what I can tell the "check" is supposed to
yield/return the value that you need to graph. I'm kind of just pulling
bits and pieces from other scripts in the bin folder and trying to make
something work for what we need. Also i'm not sure if this is allowed
but i'd be willing to pay someone to sit with me and work through this.
If it's not allowed then sorry for asking!

Here is the new script. Again, I really appreciate the feedback guys!

#!/usr/bin/python
import re

def parse_raisecom_y1731_delay_avg(info):
    parsed = {}
    for item in info:
        item = re.findall(r'\d+', str(item))
        parsed = item
    return parsed

def inventory_raisecom_y1731_delay_avg(parsed):
    print("Starting Inventory")
    print(parsed)
    return check_raisecom_y1731_delay_avg(None, None, parsed)

def check_raisecom_y1731_delay_avg(item, params, parsed):
    if not parsed:
        print("Data not parsed")
        yield 3, 'No data found'
    else:
        print("Yielding parsed results")
        print(parsed)
        yield (0, parsed)



# This check works on all SNMP hosts

check_info["raisecom_y1731_delay_avg"] = {
    'check_function':          check_raisecom_y1731_delay_avg,
    'inventory_function':      inventory_raisecom_y1731_delay_avg,
    'parse_function':          parse_raisecom_y1731_delay_avg,
    'service_description':     'raisecom_y1731_delay_avg',
    'snmp_info':               ('.1.3.6.1.4.1.8886.6.1.36.3.1.1.6', '1'),
    'snmp_scan_function':      lambda oid: oid(".1.3.6.1.2.1.1.1.0") is
not None,
}
Send checkmk-en mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.mathias-kettner.de/cgi-bin/mailman/listinfo/checkmk-en
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of checkmk-en digest..."
1. Re: host inventory oscillating (Arno Wijnhoven)
2. Re: maximum recursion depth exceeded (Arno Wijnhoven)
----------------------------------------------------------------------
Message: 1
Date: Tue, 27 Nov 2018 08:03:05 +0000
Subject: Re: [Check_mk (english)] host inventory oscillating
Content-Type: text/plain; charset="utf-8"
Hi Gordon,
What do you mean? Like ‘automatically’? I can’t think of a situation where you’d want that

It wouldn’t be right if Check_MK would update my inventory if it suddenly can’t get info about a previous existing hard drive, for instance.
This is a plain error (drive missing) and I want a notification, not an inventory update.
If some services don’t exist anymore, they will go into ‘Unknown’ state and you have to remove them –manually-.
When you go to the services of a host via WATO, you can click ‘Remove vanished services’.
You can set an automatic periodic inventory update though - but remember: with great power comes great responsibility ☺.
FYI, Check_MK user Marco Reale created a beginner guide (https://mathias-kettner.com/download/Marco_Reale_Check_MK_Beginner_guide.pdf).
Hope this helps,
Arno
Sent: maandag 26 november 2018 17:57
Subject: Re: [Check_mk (english)] host inventory oscillating
My understanding of Check MK Inventory management is still very limited.
Under what circumstances does the Check MK monitor remove most/all of the inventory for a given host?
Gord Austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mathias-kettner.de/pipermail/checkmk-en/attachments/20181127/f9cee3fa/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 27 Nov 2018 08:34:32 +0000
Subject: Re: [Check_mk (english)] maximum recursion depth exceeded
Content-Type: text/plain; charset="utf-8"
Greg has a point. Best use a variable.
You cannot use the function name as return variable (as that will call the function again).
I've got a custom script that monitors Dell RAID BBUs. Perhaps something like this is included in recent versions, but back in the day a script like this didn't exist.
In the inventory function I'm creating a new variable which I return. The variable is filled in a for-loop using append.
Another thing. For the inventory function you don't want to return the actual value.
You'd want to return the name of the item you are monitoring. The value itself will be returned in the check.
battery_inventory = []
battery_inventory.append(( batteryControllerNumber, None ))
return battery_inventory # <------------ this returns a list of controller numbers to be matched in the check function, no actual values here!
"service_description" : "Controller %s", # <-------------- %s will be replaced by 'battery_inventory' from the inventory function
This results in 'Controller 1', 'Controller 2' etc.
The check function will get the actual value. The first thing in the check function will be matching the right controller.
This is why you see stuff like ' if batteryControllerNumber == item:' in each check function, where 'item' is a stored value from the inventory function.
I started with Python when starting with Check_MK and I love both.
I included one of my own scripts as this one is really short and comprehensible (at least, for me :D). Perhaps it's of any use to you as an example.
Hope this helps.
Arno Wijnhoven
-----Original Message-----
Sent: dinsdag 27 november 2018 06:39
Subject: Re: [Check_mk (english)] maximum recursion depth exceeded
I keep getting this maximum recursion depth exceeded. From what I can
see is it's getting stuck in a loop when parsing out my SNMP Request.
The OID only returns 1 value, but it looks like the script just keeps
looping over it and i'm not sure what i'm doing different than the
other scripts in the checks folder. I'm relatively new to both python
and CheckMK, so if I did something stupid, don't judge me too harsh
lol. I'd really appreciate some help on this though!
<snip>
--------------------------
#!/usr/bin/python
import re
print(parsed)
return inventory_raisecom_y1731_delay_avg(parsed)
return check_raisecom_y1731_delay_avg(item, params, parsed)
print(re.findall(r'\b\d+\b', str(info)))
parsed = re.findall(r'\b\d+\b', str(info))
return parsed
check_info["y1731_delay_avg"] = {
'check_function' : check_raisecom_y1731_delay_avg,
'inventory_function' : inventory_raisecom_y1731_delay_avg,
'parse_function' : parse_raisecom_y1731_delay_avg,
(".1.3.6.1.4.1.8886.6.1.36.3.1.1.6", ["1"]), }
At first glance I see that the inventory function is calling itself, a loop ensues. The same for the check function.
--
Greg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dell_cache_battery
Type: application/octet-stream
Size: 1793 bytes
Desc: dell_cache_battery
URL: <https://lists.mathias-kettner.de/pipermail/checkmk-en/attachments/20181127/3a2f9ab0/attachment.obj>
------------------------------
Subject: Digest Footer
_______________________________________________
checkmk-en mailing list
Manage your subscription or unsubscribe
https://lists.mathias-kettner.de/cgi-bin/mailman/listinfo/checkmk-en
------------------------------
End of checkmk-en Digest, Vol 111, Issue 63
*******************************************
--
Chuck Greve
Level I Support Technician
STARTOUCH INC
Ph.360.543.5679 Ext. 118
www.startouch.com
***@startouch.com
Washington State's Largest Microwave Internet Provider
Greg Wildman
2018-11-28 06:06:42 UTC
Permalink
Post by chuck
Thanks a ton guys!! Both of you helped me a ton. I was stuck on that
for a bit. I've reworked everything and got it so no errors come up
now, however, i'm getting "CRIT- Can't find a value!" under my
service state on the host. From what I can tell the "check" is
supposed to yield/return the value that you need to graph. I'm kind
of just pulling bits and pieces from other scripts in the bin folder
and trying to make something work for what we need. Also i'm not sure
if this is allowed but i'd be willing to pay someone to sit with me
and work through this. If it's not allowed then sorry for asking!
Here is the new script. Again, I really appreciate the feedback guys!
No worries, somebody on this list will always be willing to help.

To be able to check your script I would need to see the data you are
extracting from the Raisecom device. Can you show me the output of the
following two snmp walks.

E.g.
snmpwalk -v2c -c public 10.10.10.10 system
snmpwalk -v2c -c public 10.10.10.10 .1.3.6.1.4.1.8886.6.1.36.3.1.1.6

Use whatever snmp version/community you have configured and your IP
address instead of 10.10.10.10


Thanks,

--
Greg
Chuck Greve
2018-11-28 07:05:42 UTC
Permalink
Thanks for the response Greg! Here is the output of the SNMP walk. As
you can see in my script i'm attempting to parse out the output of the
2nd OID to give me just the number.


OMD[startouch]:~$ snmpwalk -v2c -c public 10.104.1.1 system
SNMPv2-MIB::sysDescr.0 = STRING: ROS
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.8886.23.70
SNMPv2-MIB::sysUpTime.0 = Timeticks: (17325505) 2 days, 0:07:35.05
SNMPv2-MIB::sysContact.0 = STRING: ***@Raisecom.com
SNMPv2-MIB::sysName.0 = STRING: sacramento-mso1
SNMPv2-MIB::sysLocation.0 = STRING: World China Raisecom
SNMPv2-MIB::sysServices.0 = INTEGER: 79
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-SMI::mib-2
SNMPv2-MIB::sysORID.2 = OID: SNMPv2-SMI::mib-2.17
SNMPv2-MIB::sysORID.3 = OID: SNMPv2-SMI::mib-2.16
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-SMI::mib-2.23
SNMPv2-MIB::sysORID.5 = OID: SNMPv2-SMI::mib-2.14
SNMPv2-MIB::sysORID.6 = OID: SNMPv2-SMI::mib-2.16
SNMPv2-MIB::sysORID.7 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.8 = OID: IF-MIB::ifMIB
SNMPv2-MIB::sysORID.9 = OID: SNMPv2-SMI::snmpModules.10
SNMPv2-MIB::sysORID.10 = OID: SNMPv2-SMI::snmpModules.11
SNMPv2-MIB::sysORID.11 = OID: SNMPv2-SMI::snmpModules.12
SNMPv2-MIB::sysORID.12 = OID: SNMPv2-SMI::snmpModules.13
SNMPv2-MIB::sysORID.13 = OID: SNMPv2-SMI::snmpModules.15
SNMPv2-MIB::sysORID.14 = OID: SNMPv2-SMI::snmpModules.16
SNMPv2-MIB::sysORID.15 = OID: SNMPv2-SMI::transmission.7
SNMPv2-MIB::sysORID.16 = OID: SNMPv2-SMI::mib-2.17.6
SNMPv2-MIB::sysORID.17 = OID: SNMPv2-SMI::mib-2.17.7
SNMPv2-MIB::sysORDescr.1 = STRING: RFC 1213 - (AT, IP, ICMP, TCP, UDP
groups)
SNMPv2-MIB::sysORDescr.2 = STRING: RFC 1493 - BRIDGE-MIB
SNMPv2-MIB::sysORDescr.3 = STRING: RFC 1757 - RMON-MIB (1, 2, 3, 9)
SNMPv2-MIB::sysORDescr.4 = STRING: RFC 1724 - RIPv2-MIB
SNMPv2-MIB::sysORDescr.5 = STRING: RFC 1850 - OSPF-MIB (v2)
SNMPv2-MIB::sysORDescr.6 = STRING: RFC 1850t - OSPF-TRAP- MIB
SNMPv2-MIB::sysORDescr.7 = STRING: RFC 1907 - SNMPv2-MIB (SYSTEM, SNMP)
SNMPv2-MIB::sysORDescr.8 = STRING: RFC 2233 - IF-MIB (IF)
SNMPv2-MIB::sysORDescr.9 = STRING: RFC 2571 - SNMP-FRAMEWORK-MIB
SNMPv2-MIB::sysORDescr.10 = STRING: RFC 2572 - SNMP-MPD-MIB
SNMPv2-MIB::sysORDescr.11 = STRING: RFC 2573 - SNMP-TARGET-MIB
SNMPv2-MIB::sysORDescr.12 = STRING: RFC 2573 - SNMP-NOTIFICATION-MIB
SNMPv2-MIB::sysORDescr.13 = STRING: RFC 2574 - SNMP-USER-BASED-SM-MIB
SNMPv2-MIB::sysORDescr.14 = STRING: RFC 2575 - SNMP-VIEW-BASED-ACM-MIB
SNMPv2-MIB::sysORDescr.15 = STRING: RFC 2665 - EtherLike-MIB
SNMPv2-MIB::sysORDescr.16 = STRING: RFC 2674p - P-BRIDGE-MIB
SNMPv2-MIB::sysORDescr.17 = STRING: RFC 2674q - Q-BRIDGE-MIB
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.10 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.11 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.12 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.13 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.14 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.15 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.16 = Timeticks: (4116) 0:00:41.16
SNMPv2-MIB::sysORUpTime.17 = Timeticks: (4116) 0:00:41.16


OMD[startouch]:~$ snmpwalk -v2c -c public 10.104.1.1
.1.3.6.1.4.1.8886.6.1.36.3. 1.1.6
SNMPv2-SMI::enterprises.8886.6.1.36.3.1.1.6.1 = Gauge32: 2789
Post by Greg Wildman
Post by chuck
Thanks a ton guys!! Both of you helped me a ton. I was stuck on that
for a bit. I've reworked everything and got it so no errors come up
now, however, i'm getting "CRIT- Can't find a value!" under my
service state on the host. From what I can tell the "check" is
supposed to yield/return the value that you need to graph. I'm kind
of just pulling bits and pieces from other scripts in the bin folder
and trying to make something work for what we need. Also i'm not sure
if this is allowed but i'd be willing to pay someone to sit with me
and work through this. If it's not allowed then sorry for asking!
Here is the new script. Again, I really appreciate the feedback guys!
No worries, somebody on this list will always be willing to help.
To be able to check your script I would need to see the data you are
extracting from the Raisecom device. Can you show me the output of the
following two snmp walks.
E.g.
snmpwalk -v2c -c public 10.10.10.10 system
snmpwalk -v2c -c public 10.10.10.10 .1.3.6.1.4.1.8886.6.1.36.3.1.1.6
Use whatever snmp version/community you have configured and your IP
address instead of 10.10.10.10
Thanks,
--
Greg
Loading...