Create Alert for too low or too high of blocked domains

Hey guys. I wasn't sure where to post this so I guess general would do as this is not really directly related to ad block interface but mainly a byproduct.
Let me explain. There have been a few times where my internet has gone out. When my internet goes out a lot of my internal devices such as chromecast goes CRAZY and starts checking to see if the internet is up 2-3 x a second. This causes a massive spike in the amount of requests. The Rpi3 is easily able to handle it. When I mean massive I mean my average 24 hour DNS request turnover is about 1000-1500. With no internet for an hour it spikes to 15k or higher.
There have been also times where I have ran out of space on the pi (not due to pihole,i run other stuff on it) and when it runs out of space it stops doing DNS requests and drops to zero. Even after I free up space the DNS requests to not start being directed towards there again till i restart. Again not really a problem with pihole.

My goal of this explanation, is there anyway to setup alerts? I know there is no alert within pihole interface. What I was trying to conjure up is something like a cron job and checks something 1x a min. If DNS requests are zero or above 2000 send a message to my phone. (yes I do realize with the no internet the message will be delay. )
Can anybody think of a way for that? I was thinking maybe perform some sort of GREP in the DNS masque logs then do some maths... or is there a way to grep for the number the pihole interface displays of the 24 hour usage?

This should be in the Feature Requests section, but it is also out of scope for Pi-hole so the feature request would be immediately closed. Other monitoring tools would be a better choice for handling these use cases.

Im not asking for a feature nor am I asking to do anything within the interface I even outlined that saying this is not in the interface. I am asking of peoples opinions on how best to accomplish MY task to get MY OWN custom scripts. There are plenty of others that have custom scripts running but you dont close that down? like the blocking youtube one that I read last night. It was using scripts to help block ads on youtube for the crazy amount of ad domains youtube have.

Can you suggest other monitoring tools? why not just create a script that greps for the total domains. Where does the interface store the numbers it calcualtes for the dashboard?

Nobody is shutting down this thread, you can continue to ask questions here. As for monitoring, check GitHub - XavierBerger/RPi-Monitor: Real time monitoring for embedded devices as that has disk usage monitoring and I believe it can alert on set levels. With some RRD features you probably could also have it monitor number of queries.

You could curl and parse http://pi.hole/admin/api.php via a script executed every 1 minute.

Condition the range values and execute something if conditions are met.

Here's something to get you started:

#!/usr/bin/env python
 
import json
import urllib2
import os
 
try:
    f = urllib2.urlopen('http://pi.hole/admin/api.php')
    json_string = f.read()
    parsed_json = json.loads(json_string)
    queries = parsed_json['dns_queries_today']
    adsblocked = parsed_json['ads_blocked_today']
    clients = parsed_json['unique_clients']
    f.close()
except:
    queries = '-'
    adsblocked = '-'
    clients = '-'
info = 'Queries: ' + str(queries) + ' - ' + 'Ads blocked: ' + str(adsblocked) + ' - ' + 'Devices: ' + str(clients) + ' '
print info

This will query the API and you can grep the output and condition the notifications based on this.

Sorry, it was a incorrect reading of your post on my part. We just have a lot of people asking us to implement XYZ unrelated services or features for some reason lately.