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