chuck
2018-11-27 22:17:20 UTC
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,
}
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
--
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
*******************************************
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>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!
--------------------------
#!/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.#!/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"]), }
--
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 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