Sending pi-hole metrics to Influxdb with Telegraf.
I’ve been running two pi-hole’s on my home network now for about about a year. I’ve been using pi-hole for nearly 3 years now and after I had an issue with a power supply, I decided it’s easier to simply add another pi-hole then to reconfigure my router and reboot each device that connect to the network. Having two device improves redundancy, but makes monitoring more challenging. I was already sending my syslogs to graylog but now I needed a way to monitor and measure resolution data.
I spent a bit of time searching for a solution, something that would allow me to better query the data and visualize what’s happening.I stumbled across this and was inspired by the dashboard. Having the ability to drill down on an attribute of the query could better help troubleshoot network issues.
Researching how to extract the data
I already had the Telegraf, Influxdb, Grafana (TIG) stack running so I wanted to see if there might be a way to get the data from pi-hole to influxdb. Looking at the docs for pi-hole I knew there was a telnet API and I had run across this thread that had some details on the API. Finally, this file showed several of the API calls as well as how the application handled the responses. I was pretty convinced that I could call the telnet API directly or some of the other…