SNMP Check - not found on Host and yields no Result

Hi everyone, i programmed an SNMP Check for a Solar Heat Pump:
(Checkmk Enterprise 2.0.0p3)
Check is called: speichertemp_wp_mitte
Host: Anlagenregler_ISP001_A

Summary

cmk -IIv --debug --no-cache --detect-plugins speichertemp_wp_mitte Anlagenregler_ISP001_A shows:

cmk --debug -nvp --detect-plugins speichertemp_wp_mitte Anlagenregler_ISP001_A shows:

snmpget -v2c -c public 10.10.160.10 1.3.6.1.4.1.31977.4.3.1.3.525 shows:
Host is reachable and has a Result (502 / 10 = Temperature 50.2 C°)

cmk -D Anlagenregler_ISP001_A

Can anyone point me in the direction why the check is not discovered on the Host or doesnt give a Result?

Thanks in advance!

Hi @Holger

You are using the old Plugin API/Syntax here. While this still works for 2.0.0 I never the less wanted to mention this.

I think there are two things which prevent the plugin to be working. First the snmp_info line and secound the !=None comparison in the snmp_scan_function. By adding an/some additional v into the commandline the command gets move verbose and may help debug this.

The snmp_info info is as far as I know focus on tables, so you need to provide it with a table and the columns you want it to retrieve. So ('.1.3.6.1.4.1.31977.4.3.1.3', ['525']) should force it to get the field you asked for.

The snmp_scan_function should work just fine without the != none or replaced with is not None.

check_info['...'] = {
    ...,
    'snmp_info': ('.1.3.6.1.4.1.31977.4.3.1.3', ['525']),
    'snmp_scan_function': lambda oid: oid('.1.3.6.1.4.1.31977.4.3.1.3.525'),
}

Regards Marius

1 Like

Thanks for your reply!

i made the changes you stated above - but the behavior keeps the same

i will read myself into the new api next week to see if i can adapt my check to it - thanks again!

For future readers:

I was struggling with the new API with the same results until i found my error - i placed the check in the wrong folder - in checkmk 2.0 all scripts go into local/lib/check_mk/base/plugins/agent_based/

The check stated above works fine, but in the meantime i programmed it with the new API as follows:

Summary

from .agent_based_api.v1 import *
import pprint

def discover_speichertemp_wp_unten(section):
yield Service()

def check_speichertemp_wp_unten(section):
speicher_temp = int(section[0][0]) / 10
state = State.UNKNOWN

if speicher_temp <= 26:
    state = State.CRIT

if speicher_temp <= 26:
    state = State.CRIT

if speicher_temp >= 27 and speicher_temp <= 28:
    state = State.WARN

if speicher_temp >= 29 and speicher_temp <= 55:
    state = State.OK

if speicher_temp >= 56 and speicher_temp <= 59:
    state = State.WARN

if speicher_temp >= 60:
    state = State.CRIT

yield Metric("Speichertemperatur", speicher_temp, levels=(56,60), boundaries=(0,100))

yield Result(
    state=state,
    summary="Speichertemperatur Wärmepumpe Unten: % 6.2f° Celcius" % (speicher_temp)
)
return

register.check_plugin(
name = “speichertemp_wp_unten”,
service_name = “Speichertemperatur Wärmepumpe Unten”,
discovery_function = discover_speichertemp_wp_unten,
check_function = check_speichertemp_wp_unten,
)

register.snmp_section(
name = “speichertemp_wp_unten”,
detect = startswith(".1.3.6.1.2.1.1.1.0", “Saia Burgess Controls - Saia PCD Operating System”),

detect = exists(".1.3.6.1.2.1.1.1.0"),

fetch = SNMPTree(
    base = '.1.3.6.1.4.1.31977.4.3.1.3',
    oids = [
        '527.0',    # Speichertemperatur Wärmepumpe Unten
    ],
),

)

Maybe someone can use a working comparison of old <-> new API checks. And remeber - check your Folders :wink: