mirror of
https://github.com/coredns/coredns.git
synced 2026-04-05 11:45:33 -04:00
146 lines
4.7 KiB
Groff
146 lines
4.7 KiB
Groff
.\" Generated by Mmark Markdown Processer - mmark.miek.nl
|
|
.TH "COREDNS-METRICS" 7 "March 2026" "CoreDNS" "CoreDNS Plugins"
|
|
|
|
.SH "NAME"
|
|
.PP
|
|
\fIprometheus\fP - enables Prometheus
|
|
\[la]https://prometheus.io/\[ra] metrics.
|
|
|
|
.SH "DESCRIPTION"
|
|
.PP
|
|
With \fIprometheus\fP you export metrics from CoreDNS and any plugin that has them.
|
|
The default location for the metrics is \fB\fClocalhost:9153\fR. The metrics path is fixed to \fB\fC/metrics\fR.
|
|
|
|
.PP
|
|
In addition to the default Go metrics exported by the Prometheus Go client
|
|
\[la]https://prometheus.io/docs/guides/go-application/\[ra],
|
|
the following metrics are exported:
|
|
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_build_info{version, revision, goversion}\fR - info about CoreDNS itself.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_panics_total{}\fR - total number of panics.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_dns_requests_total{server, zone, view, proto, family, type}\fR - total query count.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_dns_request_duration_seconds{server, zone, view, type}\fR - duration to process each query.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_dns_request_size_bytes{server, zone, view, proto}\fR - size of the request in bytes. Uses the original size before any plugin rewrites.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_dns_do_requests_total{server, view, zone}\fR - queries that have the DO bit set
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_dns_response_size_bytes{server, zone, view, proto}\fR - response size in bytes.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_dns_responses_total{server, zone, view, rcode, plugin}\fR - response per zone, rcode and plugin.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_dns_https_responses_total{server, status}\fR - responses per server and http status code.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_dns_quic_responses_total{server, status}\fR - responses per server and QUIC application code.
|
|
.IP \(bu 4
|
|
\fB\fCcoredns_plugin_enabled{server, zone, view, name}\fR - indicates whether a plugin is enabled on per server, zone and view basis.
|
|
|
|
|
|
.PP
|
|
Almost each counter has a label \fB\fCzone\fR which is the zonename used for the request/response.
|
|
|
|
.PP
|
|
Extra labels used are:
|
|
|
|
.IP \(bu 4
|
|
\fB\fCserver\fR is identifying the server responsible for the request. This is a string formatted
|
|
as the server's listening address: \fB\fC<scheme>://[<bind>]:<port>\fR. I.e. for a "normal" DNS server
|
|
this is \fB\fCdns://:53\fR. If you are using the \fIbind\fP plugin an IP address is included, e.g.: \fB\fCdns://127.0.0.53:53\fR.
|
|
.IP \(bu 4
|
|
\fB\fCproto\fR which holds the transport of the response ("udp" or "tcp")
|
|
.IP \(bu 4
|
|
The address family (\fB\fCfamily\fR) of the transport (1 = IP (IP version 4), 2 = IP6 (IP version 6)).
|
|
.IP \(bu 4
|
|
\fB\fCtype\fR which holds the query type. It holds most common types (A, AAAA, MX, SOA, CNAME, PTR, TXT,
|
|
NS, SRV, DS, DNSKEY, RRSIG, NSEC, NSEC3, HTTPS, IXFR, AXFR and ANY) and "other" which lumps together all
|
|
other types.
|
|
.IP \(bu 4
|
|
\fB\fCstatus\fR which holds the https status code. Possible values are:
|
|
|
|
.RS
|
|
.IP \(en 4
|
|
200 - request is processed,
|
|
.IP \(en 4
|
|
404 - request has been rejected on validation,
|
|
.IP \(en 4
|
|
400 - request to dns message conversion failed,
|
|
.IP \(en 4
|
|
500 - processing ended up with no response.
|
|
|
|
.RE
|
|
.IP \(bu 4
|
|
the \fB\fCplugin\fR label holds the name of the plugin that made the write to the client. If the server
|
|
did the write (on error for instance), the value is empty.
|
|
|
|
|
|
.PP
|
|
If monitoring is enabled, queries that do not enter the plugin chain are exported under the fake
|
|
name "dropped" (without a closing dot - this is never a valid domain name).
|
|
|
|
.PP
|
|
Other plugins may export additional stats when the \fIprometheus\fP plugin is enabled. Those stats are documented in each
|
|
plugin's README.
|
|
|
|
.PP
|
|
This plugin can only be used once per Server Block.
|
|
|
|
.SH "SYNTAX"
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
prometheus [ADDRESS]
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
For each zone that you want to see metrics for.
|
|
|
|
.PP
|
|
It optionally takes a bind address to which the metrics are exported; the default
|
|
listens on \fB\fClocalhost:9153\fR. The metrics path is fixed to \fB\fC/metrics\fR.
|
|
|
|
.SH "EXAMPLES"
|
|
.PP
|
|
Use an alternative listening address:
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
\&. {
|
|
prometheus localhost:9253
|
|
}
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
Or via an environment variable (this is supported throughout the Corefile): \fB\fCexport PORT=9253\fR, and
|
|
then:
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
\&. {
|
|
prometheus localhost:{$PORT}
|
|
}
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.SH "BUGS"
|
|
.PP
|
|
When reloading, the Prometheus handler is stopped before the new server instance is started.
|
|
If that new server fails to start, then the initial server instance is still available and DNS queries still served,
|
|
but Prometheus handler stays down.
|
|
Prometheus will not reply HTTP request until a successful reload or a complete restart of CoreDNS.
|
|
Only the plugins that register as Handler are visible in \fB\fCcoredns_plugin_enabled{server, zone, name}\fR. As of today the plugins reload and bind will not be reported.
|
|
|