Skip to main content

Dnsmasq collector

Overview

Dnsmasq is a lightweight, easy to configure DNS forwarder, designed to provide DNS (and optionally DHCP and TFTP) services to a small-scale network.

This collector monitors one or more Dnsmasq DNS Forwarder instances, depending on your configuration.

It collects DNS cache statistics by reading the response on the following query:

;; opcode: QUERY, status: NOERROR, id: 37862
;; flags: rd; QUERY: 7, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cachesize.bind. CH TXT
;insertions.bind. CH TXT
;evictions.bind. CH TXT
;hits.bind. CH TXT
;misses.bind. CH TXT
;servers.bind. CH TXT

Collected metrics

Metrics grouped by scope.

The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.

global

The metrics apply to the entire monitored application.

This scope has no labels.

Metrics:

MetricDimensionsUnit
dnsmasq.servers_queriessuccess, failedqueries/s
dnsmasq.cache_performancehist, missesevents/s
dnsmasq.cache_operationsinsertions, evictionsoperations/s
dnsmasq.cache_sizesizeentries

Setup

Prerequisites

No action required.

Configuration

File

The configuration file name is go.d/dnsmasq.conf.

The file format is YAML. Generally, the format is:

update_every: 1
autodetection_retry: 0
jobs:
- name: some_name1
- name: some_name1

You can edit the configuration file using the edit-config script from the Netdata config directory.

cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config go.d/dnsmasq.conf

Options

The following options can be defined globally: update_every, autodetection_retry.

All options
NameDescriptionDefaultRequired
update_everyData collection frequency.1
autodetection_retryRe-check interval in seconds. Zero means not to schedule re-check.0
addressServer's address. Format is 'ip_address:port'.127.0.0.1:53yes
protocolDNS query transport protocol. Valid options: udp, tcp, tcp-tls.-
timeoutDNS query timeout (dial, write and read) in seconds.1

Examples

Basic

An example configuration.

jobs:
- name: local
address: '127.0.0.1:53'
Basic example with protocol option

Local server with defined DNS query transport protocol.

jobs:
- name: local
address: '127.0.0.1:53'
protocol: udp
Multi-instance

When you are defining more than one jobs, you must be careful to use different job names, to not override each other.

jobs:
- name: local
address: '127.0.0.1:53'

- name: remote
address: '203.0.113.0:53'

Troubleshooting

Debug mode

To troubleshoot issues with the dnsmasq collector, run the go.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

  • Navigate to the plugins.d directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the plugins setting under [directories].

    cd /usr/libexec/netdata/plugins.d/
  • Switch to the netdata user.

    sudo -u netdata -s
  • Run the go.d.plugin to debug the collector:

    ./go.d.plugin -d -m dnsmasq

Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.