In the debug output is one error
-> Not adding sections: IndexError('list index out of range')
There is one thing in the output that is a bit strange. Here CMK will fetch the OIDs from your script. First it will fetch .1.3.6.1.3.1.0
(not .1.3.6.1.3.1.0.0
) and than each seperate OID as requested by your script. Usually it sould only request the OIDs as configured in your script and not the base OIDs.
...
rzp: Fetching data (SNMP walk cache cleared)
Executing WALK of ".1.3.6.1.3.1.0" on RZp
.1.3.6.1.3.1.0.0 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.1 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.2 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.3 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.4 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.5 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.6 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.7 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.8 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.9 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.10 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.11 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.12 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.13 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.14 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.15 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.16 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.17 => [b'1'] 'OCTETSTR'
.1.3.6.1.3.1.0.18 => [b'41.0'] 'OCTETSTR'
.1.3.6.1.3.1.0.19 => [b'44.0'] 'OCTETSTR'
.1.3.6.1.3.1.0.20 => [b'29.34'] 'OCTETSTR'
.1.3.6.1.3.1.0.21 => [b'26.28'] 'OCTETSTR'
.1.3.6.1.3.1.0.22 => [b'238.0'] 'OCTETSTR'
.1.3.6.1.3.1.0.23 => [b'238.0'] 'OCTETSTR'
.1.3.6.1.3.1.0.24 => [b'303.0'] 'OCTETSTR'
.1.3.6.1.3.1.0.25 => [b'1'] 'OCTETSTR'
Executing WALK of ".1.3.6.1.3.1.0.2" on RZp
Executing SNMP GET of .1.3.6.1.3.1.0.2 on RZp
=> [<netsnmp.client.Varbind object at 0x7f8871c4b520>] OCTETSTR
.1.3.6.1.3.1.0.2 => [b'1'] 'OCTETSTR'
...
Can you try to remove the '0', # doorOpen
OID?
#######
I have used your SNMP walk as stored walk and tested with your script. Looks ok so far.
OMD[build]:~$ cmk -II rpz
discover
OMD[build]:~$ cmk rpz
check
if i tweak your script a bit, i get
OMD[build]:~$ cmk -v rpz
...
SNMP Info RZ-Products GmbH, DCM Agent, Version 3.1, local.local, , RZ-Products GmbH
Temperatur 28.95°C
...
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Service,
SNMPTree,
Result,
State,
startswith,
)
def check_temp(section):
# print("check")
yield Result(state=State.OK, summary=f"{section[0][9]}°C")
def discover_temp(section):
# print("discover")
yield Service()
register.check_plugin(
name="rzp",
sections=['rzp'],
service_name="Temperatur",
discovery_function=discover_temp,
check_function=check_temp,
)
register.snmp_section(
name="rzp",
detect=startswith(".1.3.6.1.2.1.1.1.0", "RZ-Products"), # sysDescr
fetch=SNMPTree(
base='.1.3.6.1.3.1.0',
oids=[
'0', # doorOpen
'2', # firePre
'3', # fireMain
'4', # ups
'5', # coolLeft
'6', # coolRight
'7', # pump
'16', # powerA
'17', # powerB
'20', # temp
'21', # humid
],
),
)
I am using CMK 2.2.0p5, but this sould make no diefference.