As of CheckMK 2.4.0 the v1 api is no longer available. All plugins need to be updated to v2. I've updated oxidized.py to api v2, it's been running on our local instance for about a week now with no issues. The new location for plugins is /opt/omd/site/<site>/local/lib/python3/cmk_addons/plugins/<plugin-name>/agent_based/
Below is the updated code. Hope it helps.
#!/usr/bin/env python3
# Part of check_oxidized
from datetime import datetime, timedelta
from cmk.agent_based.v2 import CheckPlugin, Service, Result, State
THRESHOLD = timedelta(hours=12)
def discover_oxidized(section):
yield Service()
def check_oxidized(section):
status, time = section[0]
if status == "never":
yield Result(state=State.WARN, summary="No backup tries since startup")
elif status != "success":
yield Result(state=State.CRIT, summary=f"status={status}, time={time}")
else:
time_parsed = datetime.strptime(time, "%Y-%m-%d %H:%M:%S %Z")
if datetime.now() - time_parsed >= THRESHOLD:
yield Result(state=State.WARN, summary=f"Backup older than {THRESHOLD} (last run: {time})")
else:
yield Result(state=State.OK, summary=f"Last backup at {time} was successful")
check_plugin_oxidized = CheckPlugin(
name="oxidized",
service_name="Config Backup",
discovery_function=discover_oxidized,
check_function=check_oxidized,
)
As of CheckMK 2.4.0 the v1 api is no longer available. All plugins need to be updated to v2. I've updated oxidized.py to api v2, it's been running on our local instance for about a week now with no issues. The new location for plugins is
/opt/omd/site/<site>/local/lib/python3/cmk_addons/plugins/<plugin-name>/agent_based/Below is the updated code. Hope it helps.