# Centreon (or Nagios) Plugin for the Pi-Hole API ![picture](https://www.tips-of-mine.fr/wp-content/uploads/2023/04/logo.jpg) A set of probes to extract a lot of information from a Pi-hole device through its API. ## Installation - Copy the script in the ***"/usr/lib/centreon/plugin"*** folder #### Find Pi-Hole token - Connect to your Pihole equipment - Get the token with the value ***WEBPASSWORD*** from the file `cat /etc/pihole/setupVars.conf | grep WEBPASSWORD`.
- Connect to your Centreon or Nagios device - put it in `/usr/lib/centreon/plugin`. centreon-engine@centreon # touch pihole-api.token
centreon-engine@centreon # echo 'PASTE_YOUR_TOKEN_HERE' >> pihole-api.token
## Usage + Usage `./check_pihole_api -h pihole_ipaddress -e [ads || being || clients || queries ] || -c || -f || -q || -r || -s || -t || -v` + ***-h*** ip address or fqdn name of the machine running Pi-Hole + ***-c*** (cache) show cache use + ***-e*** (summary) + ***ads*** : Number and percentage of ads blocked. + ***being*** : Amount of blocked domain. + ***clients***: Number of clients using Pihole as their DNS server + ***queries***: Number of DNS queries + ***-f*** (forwarded) show forwarded use + ***-q*** (querie) queries by type AAAA, A, SOA, TXT, PTR, ANY, SRV, IPV4, IPV6, MX, DS, RRSIG, DNSKEY, NS, OTHER, SVCB + ***-r*** (reply) queries by reply UNKNOWN, NODATA, NXDOMAIN, CNAME, IP, DOMAIN + ***-s*** (status) show the status service (enable/disable) + ***-t*** (top 10) Show a TOP number of queries by host + ***-v*** (information) show the version of the plugin ## Centreon ![picture](https://www.tips-of-mine.fr/wp-content/uploads/2023/04/2023-04-23-13_53_12-Centreon-IT-Network-Monitoring-—-Mozilla-Firefox.png) ## More info - more information on the website [Tips-Of-Mine](https://www.tips-of-mine.fr/?p=1837) ## Buy me a coffe Buy Me a Coffee at ko-fi.com