I am attempting to develop a plugin that queries the dry contacts on our Dantel webmon Matrix devices that sit out in the field. I am pulling the snmp data and it appears that the discovery is working but I am not getting the check status back and every service just comes back with an unknown status. Below is the printout of the section and the actual plugin itself. Any help is appreciated.
OMD[cvt]:~/local/lib/check_mk/base/plugins/agent_based$ cmk --debug -II --detect-plugins=snmp_webmon -vI 822-LAKL-WebMon
Discovering services and host labels on: 822-LAKL-WebMon
822-LAKL-WebMon:
+ FETCHING DATA
[SNMPFetcher] Execute data source
[PiggybackFetcher] Execute data source
No piggyback files for '822-LAKL-WebMon'. Skip processing.
No piggyback files for '192.168.xxx.xxx'. Skip processing.
+ ANALYSE DISCOVERED HOST LABELS
SUCCESS - Found no host labels
+ ANALYSE DISCOVERED SERVICES
+ EXECUTING DISCOVERY PLUGINS (1)
[['NOSUCHINSTANCE', 'NOSUCHINSTANCE', 'NOSUCHINSTANCE', 'NOSUCHINSTANCE', 'NOSUCHINSTANCE', 'NOSUCHINSTANCE'],
['Voltage alarm ', 'Voltage alarm Off', 'Voltage alarm On', '1', 'Voltage alarm Off', 'Normal'],
['EQ 101 Hendry', 'Off', 'Blown Fuse B side', '1', 'Off', 'Normal'],
['Equipment Room Door Status', 'Opened', 'Closed', '1', 'Closed', 'Status'],
['ARGUS Cordex SYS MIN', 'Off', 'Argus min Alarm', '1', 'Off', 'Normal'],
['EQ RM Below 60', 'Com room Temp is OK', 'Com room Low temp', '1', 'Com room Temp is OK', 'Normal'],
['GEN-1 Run Status', 'Not Running', 'Running', '1', 'Not Running', 'Normal'],
['GEN-1 Fault Status', 'No Fault', 'Fault', '1', 'No Fault', 'Normal'],
['GEN-1 Warning Status', 'No Warning', 'Warning', '1', 'No Warning', 'Normal'],
['', 'Off', 'On', '0', 'Off', 'Normal'],
['', 'Off', 'On', '0', 'Off', 'Normal'],
['', 'Off', 'On', '0', 'Off', 'Normal'],
['', 'Off', 'On', '0', 'Off', 'Normal'],
['', 'Off', 'On', '0', 'Off', 'Normal'],
['', 'Off', 'On', '0', 'Off', 'Normal'],
['BMS Fault', 'Not Faulted', 'Faulted', '1', 'Not Faulted', 'Normal'],
['BMS State of Charge', 'Above 18%', 'Below 18%', '1', 'Above 18%', 'Normal']]
10 snmp_webmon
SUCCESS - Found 10 services
And the Plugin Below
#!/usr/bin/env python3
from .agent_based_api.v1 import *
from cmk.utils import debug
from pprint import pprint
def discover_webmon(section):
pprint(section)
for input_desc, input_off_desc, input_on_desc, input_configured, input_live_desc, input_live_level in section:
if input_configured == "1":
yield Service(item=input_desc)
def check_webmon(item, section):
for input_desc, input_off_desc, input_on_desc, input_configured, input_live_desc, input_live_level in section:
if input_desc == item:
if input_live_level == "Critical":
s = State.CRIT
elif input_live_level == "Normal":
s = State.WARN
elif input_live_level == "Warning":
s = State.WARN
elif input_live_level == "Minor":
s = State.WARN
elif input_live_level == "Status":
s = State.OK
else:
s = State.OK
yield Result(state = s, summary="summary 1")
return
register.snmp_section(
name = "snmp_webmon",
detect = equals(".1.3.6.1.2.1.1.1", "WebMon Matrix"),
fetch = SNMPTree(
base = '.1.3.6.1.4.1.994.3.4.7.20.1',
oids = [
'3', # Input Description
'4', # Input Off Description
'5', # Input On Description
'10', # Input Configured 0 / 1
'64', # Input Live Description
'65', # Input Live Level
],
),
)
register.check_plugin(
name = "snmp_webmon",
service_name = "%s",
discovery_function = discover_webmon,
check_function = check_webmon,
)