diff --git a/Stats-monitoring-in-check_mk_agent.md b/Stats-monitoring-in-check_mk_agent.md index 8e31507..1ef66ff 100644 --- a/Stats-monitoring-in-check_mk_agent.md +++ b/Stats-monitoring-in-check_mk_agent.md @@ -1,5 +1,7 @@ I've written this extremely simple local check for the check_mk_agent. If you've installed the agent on your Pi-Hole place this into an executable file wherever your check_mk_agent expects to find local plugins. Alternatively this could be installed on any system that has access to the Pi-Hole console, I decided to put it on the Pi-Hole directly. I named mine "mk_pihole_stats.py" but as long as it's in the correct subdirectory and the agent script can execute it it should work just fine. +After you reinventory the client where you installed this you should have two new local checks. PiHole_ads and PiHole_percent. + #!/usr/bin/python # Simple (always OK) check_mk local check to track # of ads blocked today. # Since the console/logs rotate everyday, so will the perf data for this @@ -17,6 +19,8 @@ I've written this extremely simple local check for the check_mk_agent. If you'v json = json.loads(result) count = json['ads_blocked_today'] print "0 PiHole_Ads blocked=" + count + " OK " + count + " ads blocked today." - + pct = json['ads_percentage_today'] + print "0 PiHole_Percent percent=" + pct + " OK " + pct + "%." + except: print "3 PiHole_Ads Unknown"