PowerDNS Recursor MonitoringUse This InfluxDB Integration for Free
PowerDNS Recursor is a high-performance resolving name server which is used to power the DNS resolution of over 100 million subscribers.
Why use a Telegraf plugin for PowerDNS Recursor?
The Domain Name System is what maps human-recognizable domain names to the actual IP addresses of the computers that store and power the websites located at each domain.
Whenever you visit a website, there are 4 different DNS servers involved. The first is a DNS recursor server which acts like a middleman between the client making the request, like a smartphone or laptop, and the rest of the DNS network. The DNS resolver can either return an answer directly if it has already stored the IP address for a domain name, or get the information by asking a DNS root server. The DNS root server may need to get that information by requesting it from an authoritative name server. There are also TLD servers which maintain information for common domain extensions like .com, .net, and more.
By using the Telegraf plugin for PowerDNS, you can efficiently monitor any DNS servers you are running using PowerDNS with very minimal effort. Telegraf is able to be set up with minimal configuration and then send that data to InfluxDB, which is able to handle massive volumes of data without any problems.
DNS monitoring is important for both performance and security reasons. The most obvious performance issue for your users if you have DNS issues is that they won't be able to access your website or app. From a security perspective you can watch for security attacks like DNS poisoning, where bad actors attempt to insert false information into your DNS cache to reroute users to a fake version of your website or try to collect private data. A DDOS attack is another reason to monitor powerDNS with Telegraf. DDOS is a distributed denial of service attack, which uses multiple computers to attempt to crash a website or application with large numbers of requests.
Without DNS monitoring, your applications will be more vulnerable to these types of attack.
How to monitor PowerDNS Recursor using the Telegraf plugin
Setting up the PowerDNS Recursor is fairly easy, requiring just a few lines of configuration:
[[inputs.powerdns_recursor]] ## Path to the Recursor control socket. unix_sockets = ["/var/run/pdns_recursor.controlsocket"] ## Directory to create receive socket. This default is likely not writable, ## please reference the full plugin documentation for a recommended setup. # socket_dir = "/var/run/" ## Socket permissions for the receive socket. # socket_mode = "0666"
Telegraf will require read/write permissions because it uses the Unix control socket to read metrics from PowerDNS. The setup below was tested on Debian Stretch and may need some adjustments to work on other systems.
First, change control socket permissions in the PowerDNS recursor configuration. This is usually found in /etc/powerdns/recursor.conf
socket-mode = 660
Next, place Telegraf into the pdns group:
usermod telegraf -a -G pdns
Telegraf cannot write to the default /var/run socket directory, so you need to create a subdirectory and adjust permissions so that both users can access it:
mkdir /var/run/pdns chown root:pdns /var/run/pdns chmod 770 /var/run/pdns
Key PowerDNS Recursor metrics to use for monitoring
The PowerDNS Recursor Telegraf Input Plugin provides access to a huge number of metrics that you can see below: