Dantel Webmon Matrix SNMP Plugin

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,
)

Have you activated the configuration and restarted the core with cmk -R?

Yes, but I just did it again to make sure and still no change. the services appear as vanished services with an unknown state

I think here is the real first problem. With the “–detect-plugins=snmp_webmon” you deactivate your defined detect function. That means the setup inside the web interface will only find the checks if the detect function matches.
Is the content of the OID “.1.3.6.1.2.1.1.1” really “WebMon Matrix”? It is more likely that the OID only starts with this string.

It seems to be accurate to me

OMD[cvt]:~/local/lib/check_mk/base/plugins/agent_based$ snmpwalk -v2c -c public 192.168.xxx.xxx .1.3.6.1.2.1.1.1
iso.3.6.1.2.1.1.1.0 = STRING: "WebMon Matrix"

I also attempted to switch the code to “contains” and “matches” but none of them seem to get checkmk to trigger the plugin until I used “exist” and then it is now working and doing the discovery inside of checkmk gui.

I switched to a vendor specific OID so it didn’t map on anything that had a sysdesc (which would have been like all) and this works

detect = exists(".1.3.6.1.4.1.994.3.4.7.1.70"),

Any thoughts on why something like this below wouldn’t work? Based on the snmpwalk I showed above it should work just fine.

detect = contains(".1.3.6.1.2.1.1.1", "WebMon"),

looks like the last .0 is missing.

detect = contains(".1.3.6.1.2.1.1.1.0", "WebMon"),

2 Likes

yeah I saw that afterward :frowning: . apparently the iReasoning MIB browser wasn’t displaying the trailing ‘.0’. I was able to get the detect = equals to work now.