Hello,
at the moment im trying to develop a SNMP-Plugin for our Firepower OS to monitor the PSU’s and fans
I tried 2 different Version each with their own problems.
One version is using the older check_info[]={}
, which i mainly found guides on the internet for and the older checks that come with CMK.
The other is using mainly the documentation for cmkv2 Writing your own check plug-ins and some newer plugins I found.
I’d like to mainly focus on the “newer” plugin, even if I got further using the old one.
We are using Version 2.0.0p17 (CEE)
from .agent_based_api.v1 import *
def check_firepower_psu(item, section):
for domain, status in section:
Message = ""
status = int(status)
if domain == item:
if status == 1:
checkstate = State.OK
Message ="Is operational"
elif status == 0:
checkstate = State.CRIT
Message ="Not operational"
else:
Message = "Unknown Status"
status = State.UNKNOWN
yield Result(state=checkstate, summary=Message)
return
def inventory_firepower_psu(section):
for list in section:
yield Service(item=list[0])
register.check_plugin(
name="firepower_snmp_plugin_psu",
service_name="Operability PSU %s",
discovery_function = inventory_firepower_psu,
check_function = check_firepower_psu,
)
register.snmp_section(
name = "Firepower_PSU_Operability",
detect = contains(".1.3.6.1.2.1.1.1.0", "fxos"),
fetch = SNMPTree(
base = ".1.3.6.1.4.1.9.9.826.1.20.109.1",
oids = [
"2", #2 ist Domäne des PSU
"10", #10 ist Operability des PSU
],
),
)
The problem I’m having is that it does not register any services for the actual system that needs the Plugin and even if I change the detection to:
detect=exists(".1.3.6.1.2.1.1.1.0")
and generate a test service in the inventory function, it doesn’t detect a new service on any device.
On the older plugin the service discovery works but i either get a check crash or “No item found in monitoring data”
An example output i got using the older plugin and and pprint in the inventory function is:
[['sys/chassis-1/psu-1', '1'], ['sys/chassis-1/psu-2', '1']]
I tried debugging it with different pprint’s but I dont get any output on the CLI.
Can anybody help me with this or tell me how to effectively debug my Plugin?
Thank you