nsd-control stats command shows a number of statistic counters. Statistics must be enabled at compile time with --enable-bind8-stats or --enable-zone-stats.
Viewing Statistics
Server Statistics
Query Counters
Query Counters
num.queries
Total number of queries received (the tls, tcp and udp queries added up).Type: CounterPrometheus:
nsd_queries_totalserverX.queries
Number of queries handled by the server process. The number of server processes is set with the config statement server-count.Type: CounterPrometheus:
nsd_queries_total{server="X"}Queries by Type
Queries by Type
num.type.X
Number of queries with this query type.Type: CounterPrometheus:
nsd_queries_by_type_total{type="TYPE"}Common types:num.type.A- IPv4 address queriesnum.type.AAAA- IPv6 address queriesnum.type.MX- Mail exchange queriesnum.type.NS- Name server queriesnum.type.SOA- Start of authority queriesnum.type.TXT- Text record queriesnum.type.CNAME- Canonical name queriesnum.type.DNSKEY- DNSSEC public key queriesnum.type.DS- Delegation signer queriesnum.type.RRSIG- DNSSEC signature queriesnum.type.NSEC- DNSSEC next secure queriesnum.type.NSEC3- DNSSEC next secure v3 queries
Queries by Class
Queries by Class
num.class.X
Number of queries with this query class.Type: CounterPrometheus:
nsd_queries_by_class_total{class="CLASS"}Classes:num.class.IN- Internet class (most common)num.class.CH- Chaos classnum.class.HS- Hesiod classnum.class.ANY- Any class
Queries by Opcode
Queries by Opcode
num.opcode.X
Number of queries with this opcode.Type: CounterPrometheus:
nsd_queries_by_opcode_total{opcode="OPCODE"}Opcodes:num.opcode.QUERY- Standard query (most common)num.opcode.IQUERY- Inverse query (obsolete)num.opcode.STATUS- Server status requestnum.opcode.NOTIFY- Zone change notificationnum.opcode.UPDATE- Dynamic update
Answers by Return Code
Answers by Return Code
num.rcode.X
Number of answers that carried this return code.Type: CounterPrometheus:
nsd_queries_by_rcode_total{rcode="RCODE"}Return codes:num.rcode.NOERROR- Successful querynum.rcode.FORMERR- Format errornum.rcode.SERVFAIL- Server failurenum.rcode.NXDOMAIN- Non-existent domainnum.rcode.NOTIMP- Not implementednum.rcode.REFUSED- Query refusednum.rcode.YXDOMAIN- Name exists when it should notnum.rcode.YXRRSET- RR set exists when it should notnum.rcode.NXRRSET- RR set that should exist does notnum.rcode.NOTAUTH- Not authoritativenum.rcode.NOTZONE- Name not in zonenum.rcode.BADVERS- Bad EDNS version
Transport Statistics
Transport Statistics
num.udp
Number of queries over UDP ip4.Type: CounterPrometheus:
nsd_queries_by_transport_total{transport="udp"}num.udp6
Number of queries over UDP ip6.Type: CounterPrometheus:
nsd_queries_by_transport_total{transport="udp6"}num.tcp
Number of connections over TCP ip4.Type: CounterPrometheus:
nsd_connections_total{transport="tcp"}num.tcp6
Number of connections over TCP ip6.Type: CounterPrometheus:
nsd_connections_total{transport="tcp6"}num.tls
Number of connections over TLS ip4. TLS queries are not part of num.tcp.Type: CounterPrometheus:
nsd_connections_total{transport="tls"}num.tls6
Number of connections over TLS ip6. TLS queries are not part of num.tcp6.Type: CounterPrometheus:
nsd_connections_total{transport="tls6"}EDNS Statistics
EDNS Statistics
Zone Transfer Statistics
Zone Transfer Statistics
Error and Drop Counters
Error and Drop Counters
num.dropped
Number of queries that were dropped because they failed sanity check.Type: CounterPrometheus:
nsd_queries_dropped_totalnum.rxerr
Number of queries for which the receive failed.Type: CounterPrometheus:
nsd_queries_rx_failed_totalnum.txerr
Number of answers for which the transmit failed.Type: CounterPrometheus:
nsd_answers_tx_failed_totalnum.truncated
Number of answers with TC flag set.Type: CounterPrometheus:
nsd_answers_truncated_totalnum.answer_wo_aa
Number of answers with NOERROR rcode and without AA flag, this includes the referrals.Type: CounterPrometheus:
nsd_answers_without_aa_totalTime Statistics
Uptime and Elapsed Time
Uptime and Elapsed Time
time.boot
Uptime in seconds since the server was started. With fractional seconds.Type: CounterPrometheus:
nsd_time_up_seconds_totaltime.elapsed
Time since the last stats report, in seconds. With fractional seconds. Can be zero if polled quickly and the previous stats command resets the counters, so that the next gets a fully zero, and zero elapsed time, report.Type: GaugePrometheus:
nsd_time_elapsed_secondsMemory and Size Statistics
Database Size
Database Size
Process Memory
Process Memory
size.xfrd.mem
Size of memory for zone transfers and notifies in xfrd process, excludes TSIG data, in bytes.Type: GaugePrometheus:
nsd_size_xfrd_in_mem_bytesConfiguration Size
Configuration Size
Zone Statistics
Zone Counts
Zone Counts
zone.primary
Number of primary zones served. These are zones with no ‘request-xfr:’ entries. Also output as ‘zone.master’ for backwards compatibility.Type: GaugePrometheus:
nsd_zones_primaryzone.secondary
Number of secondary zones served. These are zones with ‘request-xfr’ entries. Also output as ‘zone.slave’ for backwards compatibility.Type: GaugePrometheus:
nsd_zones_secondaryPer-Zone Statistics
When compiled with--enable-zone-stats, NSD provides per-zone statistics. These follow the same format as global statistics but are prefixed with the zone name.
Per-Zone Counters
Per-Zone Counters
For each zone, the following statistics are available:Prometheus format:
zonestats.<zone>.queries- Total queries for this zonezonestats.<zone>.type.X- Queries by typezonestats.<zone>.opcode.X- Queries by opcodezonestats.<zone>.class.X- Queries by classzonestats.<zone>.rcode.X- Answers by rcodezonestats.<zone>.edns- EDNS querieszonestats.<zone>.ednserr- EDNS errorszonestats.<zone>.udp- UDP queries (IPv4)zonestats.<zone>.udp6- UDP queries (IPv6)zonestats.<zone>.tcp- TCP connections (IPv4)zonestats.<zone>.tcp6- TCP connections (IPv6)zonestats.<zone>.tls- TLS connections (IPv4)zonestats.<zone>.tls6- TLS connections (IPv6)
Prometheus Metrics
When compiled with libevent 2.0 or later, NSD can expose statistics via a Prometheus-compatible HTTP endpoint.Enabling Metrics Endpoint
Enabling Metrics Endpoint
nsd.conf
Metric Naming Convention
Metric Naming Convention
Prometheus metrics use the following naming convention:
- Prefix:
nsd_ - Metric name: descriptive name with underscores
- Suffix:
_totalfor counters,_bytesfor sizes,_secondsfor times - Labels: Used for dimensions (e.g.,
{type="A"},{server="0"})
Using Statistics for Monitoring
Monitoring Query Rates
Monitoring Query Rates
Monitoring Errors
Monitoring Errors
Monitoring Memory Usage
Monitoring Memory Usage
Monitoring Zone Transfers
Monitoring Zone Transfers
Resetting Statistics
By default,nsd-control stats resets all counters to zero after displaying them. This allows you to measure rates over specific time periods.
Time-based counters (
time.boot, time.elapsed) and gauge metrics (sizes, zone counts) are not affected by resets.Compilation Requirements
See Also
- Log Messages - Common log messages and meanings
- Configure Options - Build-time configuration options