mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-20 22:30:13 +00:00
Added percent check
parent
9c63bb28dd
commit
19cbb3c881
1 changed files with 5 additions and 1 deletions
|
@ -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.
|
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
|
#!/usr/bin/python
|
||||||
# Simple (always OK) check_mk local check to track # of ads blocked today.
|
# 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
|
# 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)
|
json = json.loads(result)
|
||||||
count = json['ads_blocked_today']
|
count = json['ads_blocked_today']
|
||||||
print "0 PiHole_Ads blocked=" + count + " OK " + count + " 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:
|
except:
|
||||||
print "3 PiHole_Ads Unknown"
|
print "3 PiHole_Ads Unknown"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue