diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:54:23 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:54:44 +0000 |
commit | 836b47cb7e99a977c5a23b059ca1d0b5065d310e (patch) | |
tree | 1604da8f482d02effa033c94a84be42bc0c848c3 /src/go/collectors/go.d.plugin/modules/powerdns | |
parent | Releasing debian version 1.44.3-2. (diff) | |
download | netdata-836b47cb7e99a977c5a23b059ca1d0b5065d310e.tar.xz netdata-836b47cb7e99a977c5a23b059ca1d0b5065d310e.zip |
Merging upstream version 1.46.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/go/collectors/go.d.plugin/modules/powerdns')
14 files changed, 2412 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/README.md b/src/go/collectors/go.d.plugin/modules/powerdns/README.md new file mode 120000 index 000000000..3e5989715 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/README.md @@ -0,0 +1 @@ +integrations/powerdns_authoritative_server.md
\ No newline at end of file diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/authoritativens.go b/src/go/collectors/go.d.plugin/modules/powerdns/authoritativens.go new file mode 100644 index 000000000..55b5b8113 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/authoritativens.go @@ -0,0 +1,116 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package powerdns + +import ( + _ "embed" + "errors" + "net/http" + "time" + + "github.com/netdata/netdata/go/go.d.plugin/agent/module" + "github.com/netdata/netdata/go/go.d.plugin/pkg/web" +) + +//go:embed "config_schema.json" +var configSchema string + +func init() { + module.Register("powerdns", module.Creator{ + JobConfigSchema: configSchema, + Create: func() module.Module { return New() }, + Config: func() any { return &Config{} }, + }) +} + +func New() *AuthoritativeNS { + return &AuthoritativeNS{ + Config: Config{ + HTTP: web.HTTP{ + Request: web.Request{ + URL: "http://127.0.0.1:8081", + }, + Client: web.Client{ + Timeout: web.Duration(time.Second), + }, + }, + }, + } +} + +type Config struct { + UpdateEvery int `yaml:"update_every,omitempty" json:"update_every"` + web.HTTP `yaml:",inline" json:""` +} + +type AuthoritativeNS struct { + module.Base + Config `yaml:",inline" json:""` + + charts *module.Charts + + httpClient *http.Client +} + +func (ns *AuthoritativeNS) Configuration() any { + return ns.Config +} + +func (ns *AuthoritativeNS) Init() error { + err := ns.validateConfig() + if err != nil { + ns.Errorf("config validation: %v", err) + return err + } + + client, err := ns.initHTTPClient() + if err != nil { + ns.Errorf("init HTTP client: %v", err) + return err + } + ns.httpClient = client + + cs, err := ns.initCharts() + if err != nil { + ns.Errorf("init charts: %v", err) + return err + } + ns.charts = cs + + return nil +} + +func (ns *AuthoritativeNS) Check() error { + mx, err := ns.collect() + if err != nil { + ns.Error(err) + return err + } + if len(mx) == 0 { + return errors.New("no metrics collected") + } + return nil +} + +func (ns *AuthoritativeNS) Charts() *module.Charts { + return ns.charts +} + +func (ns *AuthoritativeNS) Collect() map[string]int64 { + ms, err := ns.collect() + if err != nil { + ns.Error(err) + } + + if len(ms) == 0 { + return nil + } + return ms +} + +func (ns *AuthoritativeNS) Cleanup() { + if ns.httpClient == nil { + return + } + ns.httpClient.CloseIdleConnections() +} diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/authoritativens_test.go b/src/go/collectors/go.d.plugin/modules/powerdns/authoritativens_test.go new file mode 100644 index 000000000..ddf68467c --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/authoritativens_test.go @@ -0,0 +1,340 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package powerdns + +import ( + "net/http" + "net/http/httptest" + "os" + "testing" + + "github.com/netdata/netdata/go/go.d.plugin/agent/module" + "github.com/netdata/netdata/go/go.d.plugin/pkg/tlscfg" + "github.com/netdata/netdata/go/go.d.plugin/pkg/web" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var ( + dataConfigJSON, _ = os.ReadFile("testdata/config.json") + dataConfigYAML, _ = os.ReadFile("testdata/config.yaml") + + dataVer430statistics, _ = os.ReadFile("testdata/v4.3.0/statistics.json") + dataRecursorStatistics, _ = os.ReadFile("testdata/recursor/statistics.json") +) + +func Test_testDataIsValid(t *testing.T) { + for name, data := range map[string][]byte{ + "dataConfigJSON": dataConfigJSON, + "dataConfigYAML": dataConfigYAML, + "dataVer430statistics": dataVer430statistics, + "dataRecursorStatistics": dataRecursorStatistics, + } { + require.NotNil(t, data, name) + } +} + +func TestAuthoritativeNS_ConfigurationSerialize(t *testing.T) { + module.TestConfigurationSerialize(t, &AuthoritativeNS{}, dataConfigJSON, dataConfigYAML) +} + +func TestAuthoritativeNS_Init(t *testing.T) { + tests := map[string]struct { + config Config + wantFail bool + }{ + "success on default config": { + config: New().Config, + }, + "fails on unset URL": { + wantFail: true, + config: Config{ + HTTP: web.HTTP{ + Request: web.Request{URL: ""}, + }, + }, + }, + "fails on invalid TLSCA": { + wantFail: true, + config: Config{ + HTTP: web.HTTP{ + Request: web.Request{ + URL: "http://127.0.0.1:38001", + }, + Client: web.Client{ + TLSConfig: tlscfg.TLSConfig{TLSCA: "testdata/tls"}, + }, + }, + }, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + ns := New() + ns.Config = test.config + + if test.wantFail { + assert.Error(t, ns.Init()) + } else { + assert.NoError(t, ns.Init()) + } + }) + } +} + +func TestAuthoritativeNS_Check(t *testing.T) { + tests := map[string]struct { + prepare func() (ns *AuthoritativeNS, cleanup func()) + wantFail bool + }{ + "success on valid response v4.3.0": { + prepare: preparePowerDNSAuthoritativeNSV430, + }, + "fails on response from PowerDNS Recursor": { + wantFail: true, + prepare: preparePowerDNSAuthoritativeNSRecursorData, + }, + "fails on 404 response": { + wantFail: true, + prepare: preparePowerDNSAuthoritativeNS404, + }, + "fails on connection refused": { + wantFail: true, + prepare: preparePowerDNSAuthoritativeNSConnectionRefused, + }, + "fails on response with invalid data": { + wantFail: true, + prepare: preparePowerDNSAuthoritativeNSInvalidData, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + ns, cleanup := test.prepare() + defer cleanup() + require.NoError(t, ns.Init()) + + if test.wantFail { + assert.Error(t, ns.Check()) + } else { + assert.NoError(t, ns.Check()) + } + }) + } +} + +func TestAuthoritativeNS_Charts(t *testing.T) { + ns := New() + require.NoError(t, ns.Init()) + assert.NotNil(t, ns.Charts()) +} + +func TestAuthoritativeNS_Cleanup(t *testing.T) { + assert.NotPanics(t, New().Cleanup) +} + +func TestAuthoritativeNS_Collect(t *testing.T) { + tests := map[string]struct { + prepare func() (p *AuthoritativeNS, cleanup func()) + wantCollected map[string]int64 + }{ + "success on valid response v4.3.0": { + prepare: preparePowerDNSAuthoritativeNSV430, + wantCollected: map[string]int64{ + "corrupt-packets": 1, + "cpu-iowait": 513, + "cpu-steal": 1, + "deferred-cache-inserts": 1, + "deferred-cache-lookup": 1, + "deferred-packetcache-inserts": 1, + "deferred-packetcache-lookup": 1, + "dnsupdate-answers": 1, + "dnsupdate-changes": 1, + "dnsupdate-queries": 1, + "dnsupdate-refused": 1, + "fd-usage": 23, + "incoming-notifications": 1, + "key-cache-size": 1, + "latency": 1, + "meta-cache-size": 1, + "open-tcp-connections": 1, + "overload-drops": 1, + "packetcache-hit": 1, + "packetcache-miss": 1, + "packetcache-size": 1, + "qsize-q": 1, + "query-cache-hit": 1, + "query-cache-miss": 1, + "query-cache-size": 1, + "rd-queries": 1, + "real-memory-usage": 164507648, + "recursing-answers": 1, + "recursing-questions": 1, + "recursion-unanswered": 1, + "ring-logmessages-capacity": 10000, + "ring-logmessages-size": 10, + "ring-noerror-queries-capacity": 10000, + "ring-noerror-queries-size": 1, + "ring-nxdomain-queries-capacity": 10000, + "ring-nxdomain-queries-size": 1, + "ring-queries-capacity": 10000, + "ring-queries-size": 1, + "ring-remotes-capacity": 10000, + "ring-remotes-corrupt-capacity": 10000, + "ring-remotes-corrupt-size": 1, + "ring-remotes-size": 1, + "ring-remotes-unauth-capacity": 10000, + "ring-remotes-unauth-size": 1, + "ring-servfail-queries-capacity": 10000, + "ring-servfail-queries-size": 1, + "ring-unauth-queries-capacity": 10000, + "ring-unauth-queries-size": 1, + "security-status": 1, + "servfail-packets": 1, + "signature-cache-size": 1, + "signatures": 1, + "sys-msec": 128, + "tcp-answers": 1, + "tcp-answers-bytes": 1, + "tcp-queries": 1, + "tcp4-answers": 1, + "tcp4-answers-bytes": 1, + "tcp4-queries": 1, + "tcp6-answers": 1, + "tcp6-answers-bytes": 1, + "tcp6-queries": 1, + "timedout-packets": 1, + "udp-answers": 1, + "udp-answers-bytes": 1, + "udp-do-queries": 1, + "udp-in-errors": 1, + "udp-noport-errors": 1, + "udp-queries": 1, + "udp-recvbuf-errors": 1, + "udp-sndbuf-errors": 1, + "udp4-answers": 1, + "udp4-answers-bytes": 1, + "udp4-queries": 1, + "udp6-answers": 1, + "udp6-answers-bytes": 1, + "udp6-queries": 1, + "uptime": 207, + "user-msec": 56, + }, + }, + "fails on response from PowerDNS Recursor": { + prepare: preparePowerDNSAuthoritativeNSRecursorData, + }, + "fails on 404 response": { + prepare: preparePowerDNSAuthoritativeNS404, + }, + "fails on connection refused": { + prepare: preparePowerDNSAuthoritativeNSConnectionRefused, + }, + "fails on response with invalid data": { + prepare: preparePowerDNSAuthoritativeNSInvalidData, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + ns, cleanup := test.prepare() + defer cleanup() + require.NoError(t, ns.Init()) + + collected := ns.Collect() + + assert.Equal(t, test.wantCollected, collected) + if len(test.wantCollected) > 0 { + ensureCollectedHasAllChartsDimsVarsIDs(t, ns, collected) + } + }) + } +} + +func ensureCollectedHasAllChartsDimsVarsIDs(t *testing.T, ns *AuthoritativeNS, collected map[string]int64) { + for _, chart := range *ns.Charts() { + if chart.Obsolete { + continue + } + for _, dim := range chart.Dims { + _, ok := collected[dim.ID] + assert.Truef(t, ok, "chart '%s' dim '%s': no dim in collected", dim.ID, chart.ID) + } + for _, v := range chart.Vars { + _, ok := collected[v.ID] + assert.Truef(t, ok, "chart '%s' dim '%s': no dim in collected", v.ID, chart.ID) + } + } +} + +func preparePowerDNSAuthoritativeNSV430() (*AuthoritativeNS, func()) { + srv := preparePowerDNSAuthoritativeNSEndpoint() + ns := New() + ns.URL = srv.URL + + return ns, srv.Close +} + +func preparePowerDNSAuthoritativeNSRecursorData() (*AuthoritativeNS, func()) { + srv := preparePowerDNSRecursorEndpoint() + ns := New() + ns.URL = srv.URL + + return ns, srv.Close +} + +func preparePowerDNSAuthoritativeNSInvalidData() (*AuthoritativeNS, func()) { + srv := httptest.NewServer(http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + _, _ = w.Write([]byte("hello and\n goodbye")) + })) + ns := New() + ns.URL = srv.URL + + return ns, srv.Close +} + +func preparePowerDNSAuthoritativeNS404() (*AuthoritativeNS, func()) { + srv := httptest.NewServer(http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotFound) + })) + ns := New() + ns.URL = srv.URL + + return ns, srv.Close +} + +func preparePowerDNSAuthoritativeNSConnectionRefused() (*AuthoritativeNS, func()) { + ns := New() + ns.URL = "http://127.0.0.1:38001" + + return ns, func() {} +} + +func preparePowerDNSAuthoritativeNSEndpoint() *httptest.Server { + return httptest.NewServer(http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case urlPathLocalStatistics: + _, _ = w.Write(dataVer430statistics) + default: + w.WriteHeader(http.StatusNotFound) + } + })) +} + +func preparePowerDNSRecursorEndpoint() *httptest.Server { + return httptest.NewServer(http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case urlPathLocalStatistics: + _, _ = w.Write(dataRecursorStatistics) + default: + w.WriteHeader(http.StatusNotFound) + } + })) +} diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/charts.go b/src/go/collectors/go.d.plugin/modules/powerdns/charts.go new file mode 100644 index 000000000..119ca4a2e --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/charts.go @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package powerdns + +import "github.com/netdata/netdata/go/go.d.plugin/agent/module" + +var charts = module.Charts{ + { + ID: "questions_in", + Title: "Incoming questions", + Units: "questions/s", + Fam: "questions", + Ctx: "powerdns.questions_in", + Dims: module.Dims{ + {ID: "udp-queries", Name: "udp", Algo: module.Incremental}, + {ID: "tcp-queries", Name: "tcp", Algo: module.Incremental}, + }, + }, + { + ID: "questions_out", + Title: "Outgoing questions", + Units: "questions/s", + Fam: "questions", + Ctx: "powerdns.questions_out", + Dims: module.Dims{ + {ID: "udp-answers", Name: "udp", Algo: module.Incremental}, + {ID: "tcp-answers", Name: "tcp", Algo: module.Incremental}, + }, + }, + { + ID: "cache_usage", + Title: "Cache Usage", + Units: "events/s", + Fam: "cache", + Ctx: "powerdns.cache_usage", + Dims: module.Dims{ + {ID: "query-cache-hit", Algo: module.Incremental}, + {ID: "query-cache-miss", Algo: module.Incremental}, + {ID: "packetcache-hit", Name: "packet-cache-hit", Algo: module.Incremental}, + {ID: "packetcache-miss", Name: "packet-cache-miss", Algo: module.Incremental}, + }, + }, + { + ID: "cache_size", + Title: "Cache Size", + Units: "entries", + Fam: "cache", + Ctx: "powerdns.cache_size", + Dims: module.Dims{ + {ID: "query-cache-size", Name: "query-cache"}, + {ID: "packetcache-size", Name: "packet-cache"}, + {ID: "key-cache-size", Name: "key-cache"}, + {ID: "meta-cache-size", Name: "meta-cache"}, + }, + }, + { + ID: "latency", + Title: "Answer latency", + Units: "microseconds", + Fam: "latency", + Ctx: "powerdns.latency", + Dims: module.Dims{ + {ID: "latency"}, + }, + }, +} diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/collect.go b/src/go/collectors/go.d.plugin/modules/powerdns/collect.go new file mode 100644 index 000000000..359d41980 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/collect.go @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package powerdns + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "strconv" + + "github.com/netdata/netdata/go/go.d.plugin/pkg/web" +) + +const ( + urlPathLocalStatistics = "/api/v1/servers/localhost/statistics" +) + +func (ns *AuthoritativeNS) collect() (map[string]int64, error) { + statistics, err := ns.scrapeStatistics() + if err != nil { + return nil, err + } + + collected := make(map[string]int64) + + ns.collectStatistics(collected, statistics) + + if !isPowerDNSAuthoritativeNSMetrics(collected) { + return nil, errors.New("returned metrics aren't PowerDNS Authoritative Server metrics") + } + + return collected, nil +} + +func isPowerDNSAuthoritativeNSMetrics(collected map[string]int64) bool { + // PowerDNS Recursor has same endpoint and returns data in the same format. + _, ok1 := collected["over-capacity-drops"] + _, ok2 := collected["tcp-questions"] + return !ok1 && !ok2 +} + +func (ns *AuthoritativeNS) collectStatistics(collected map[string]int64, statistics statisticMetrics) { + for _, s := range statistics { + // https://doc.powerdns.com/authoritative/http-api/statistics.html#statisticitem + if s.Type != "StatisticItem" { + continue + } + + value, ok := s.Value.(string) + if !ok { + ns.Debugf("%s value (%v) unexpected type: want=string, got=%T.", s.Name, s.Value, s.Value) + continue + } + + v, err := strconv.ParseInt(value, 10, 64) + if err != nil { + ns.Debugf("%s value (%v) parse error: %v", s.Name, s.Value, err) + continue + } + + collected[s.Name] = v + } +} + +func (ns *AuthoritativeNS) scrapeStatistics() ([]statisticMetric, error) { + req, _ := web.NewHTTPRequest(ns.Request) + req.URL.Path = urlPathLocalStatistics + + var statistics statisticMetrics + if err := ns.doOKDecode(req, &statistics); err != nil { + return nil, err + } + + return statistics, nil +} + +func (ns *AuthoritativeNS) doOKDecode(req *http.Request, in interface{}) error { + resp, err := ns.httpClient.Do(req) + if err != nil { + return fmt.Errorf("error on HTTP request '%s': %v", req.URL, err) + } + defer closeBody(resp) + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("'%s' returned HTTP status code: %d", req.URL, resp.StatusCode) + } + + if err := json.NewDecoder(resp.Body).Decode(in); err != nil { + return fmt.Errorf("error on decoding response from '%s': %v", req.URL, err) + } + return nil +} + +func closeBody(resp *http.Response) { + if resp != nil && resp.Body != nil { + _, _ = io.Copy(io.Discard, resp.Body) + _ = resp.Body.Close() + } +} diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/config_schema.json b/src/go/collectors/go.d.plugin/modules/powerdns/config_schema.json new file mode 100644 index 000000000..53c1c3137 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/config_schema.json @@ -0,0 +1,177 @@ +{ + "jsonSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PowerDNS collector configuration.", + "type": "object", + "properties": { + "update_every": { + "title": "Update every", + "description": "Data collection interval, measured in seconds.", + "type": "integer", + "minimum": 1, + "default": 1 + }, + "url": { + "title": "URL", + "description": "The URL of the PowerDNS [built-in webserver](https://doc.powerdns.com/authoritative/http-api/index.html#webserver).", + "type": "string", + "default": "http://127.0.0.1:8081", + "format": "uri" + }, + "timeout": { + "title": "Timeout", + "description": "The timeout in seconds for the HTTP request.", + "type": "number", + "minimum": 0.5, + "default": 1 + }, + "not_follow_redirects": { + "title": "Not follow redirects", + "description": "If set, the client will not follow HTTP redirects automatically.", + "type": "boolean" + }, + "username": { + "title": "Username", + "description": "The username for basic authentication.", + "type": "string", + "sensitive": true + }, + "password": { + "title": "Password", + "description": "The password for basic authentication.", + "type": "string", + "sensitive": true + }, + "proxy_url": { + "title": "Proxy URL", + "description": "The URL of the proxy server.", + "type": "string" + }, + "proxy_username": { + "title": "Proxy username", + "description": "The username for proxy authentication.", + "type": "string", + "sensitive": true + }, + "proxy_password": { + "title": "Proxy password", + "description": "The password for proxy authentication.", + "type": "string", + "sensitive": true + }, + "headers": { + "title": "Headers", + "description": "Additional HTTP headers to include in the request.", + "type": [ + "object", + "null" + ], + "additionalProperties": { + "type": "string" + } + }, + "tls_skip_verify": { + "title": "Skip TLS verification", + "description": "If set, TLS certificate verification will be skipped.", + "type": "boolean" + }, + "tls_ca": { + "title": "TLS CA", + "description": "The path to the CA certificate file for TLS verification.", + "type": "string", + "pattern": "^$|^/" + }, + "tls_cert": { + "title": "TLS certificate", + "description": "The path to the client certificate file for TLS authentication.", + "type": "string", + "pattern": "^$|^/" + }, + "tls_key": { + "title": "TLS key", + "description": "The path to the client key file for TLS authentication.", + "type": "string", + "pattern": "^$|^/" + }, + "body": { + "title": "Body", + "type": "string" + }, + "method": { + "title": "Method", + "type": "string" + } + }, + "required": [ + "url" + ], + "additionalProperties": false, + "patternProperties": { + "^name$": {} + } + }, + "uiSchema": { + "ui:flavour": "tabs", + "ui:options": { + "tabs": [ + { + "title": "Base", + "fields": [ + "update_every", + "url", + "timeout", + "not_follow_redirects" + ] + }, + { + "title": "Auth", + "fields": [ + "username", + "password" + ] + }, + { + "title": "TLS", + "fields": [ + "tls_skip_verify", + "tls_ca", + "tls_cert", + "tls_key" + ] + }, + { + "title": "Proxy", + "fields": [ + "proxy_url", + "proxy_username", + "proxy_password" + ] + }, + { + "title": "Headers", + "fields": [ + "headers" + ] + } + ] + }, + "uiOptions": { + "fullPage": true + }, + "body": { + "ui:widget": "hidden" + }, + "method": { + "ui:widget": "hidden" + }, + "timeout": { + "ui:help": "Accepts decimals for precise control (e.g., type 1.5 for 1.5 seconds)." + }, + "password": { + "ui:widget": "password" + }, + "proxy_password": { + "ui:widget": "password" + } + } +} diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/init.go b/src/go/collectors/go.d.plugin/modules/powerdns/init.go new file mode 100644 index 000000000..9190f7e41 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/init.go @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package powerdns + +import ( + "errors" + "net/http" + + "github.com/netdata/netdata/go/go.d.plugin/agent/module" + "github.com/netdata/netdata/go/go.d.plugin/pkg/web" +) + +func (ns *AuthoritativeNS) validateConfig() error { + if ns.URL == "" { + return errors.New("URL not set") + } + if _, err := web.NewHTTPRequest(ns.Request); err != nil { + return err + } + return nil +} + +func (ns *AuthoritativeNS) initHTTPClient() (*http.Client, error) { + return web.NewHTTPClient(ns.Client) +} + +func (ns *AuthoritativeNS) initCharts() (*module.Charts, error) { + return charts.Copy(), nil +} diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/integrations/powerdns_authoritative_server.md b/src/go/collectors/go.d.plugin/modules/powerdns/integrations/powerdns_authoritative_server.md new file mode 100644 index 000000000..f768dec50 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/integrations/powerdns_authoritative_server.md @@ -0,0 +1,223 @@ +<!--startmeta +custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/powerdns/README.md" +meta_yaml: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/powerdns/metadata.yaml" +sidebar_label: "PowerDNS Authoritative Server" +learn_status: "Published" +learn_rel_path: "Collecting Metrics/DNS and DHCP Servers" +most_popular: False +message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" +endmeta--> + +# PowerDNS Authoritative Server + + +<img src="https://netdata.cloud/img/powerdns.svg" width="150"/> + + +Plugin: go.d.plugin +Module: powerdns + +<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> + +## Overview + +This collector monitors PowerDNS Authoritative Server instances. +It collects metrics from [the internal webserver](https://doc.powerdns.com/authoritative/http-api/index.html#webserver). + +Used endpoints: + +- [`/api/v1/servers/localhost/statistics`](https://doc.powerdns.com/authoritative/http-api/statistics.html) + + + + +This collector is supported on all platforms. + +This collector supports collecting metrics from multiple instances of this integration, including remote instances. + + +### Default Behavior + +#### Auto-Detection + +This integration doesn't support auto-detection. + +#### Limits + +The default configuration for this integration does not impose any limits on data collection. + +#### Performance Impact + +The default configuration for this integration is not expected to impose a significant performance impact on the system. + + +## 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. + + + +### Per PowerDNS Authoritative Server instance + +These metrics refer to the entire monitored application. + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | +|:------|:----------|:----| +| powerdns.questions_in | udp, tcp | questions/s | +| powerdns.questions_out | udp, tcp | questions/s | +| powerdns.cache_usage | query-cache-hit, query-cache-miss, packetcache-hit, packetcache-miss | events/s | +| powerdns.cache_size | query-cache, packet-cache, key-cache, meta-cache | entries | +| powerdns.latency | latency | microseconds | + + + +## Alerts + +There are no alerts configured by default for this integration. + + +## Setup + +### Prerequisites + +#### Enable webserver + +Follow [webserver](https://doc.powerdns.com/authoritative/http-api/index.html#webserver) documentation. + + +#### Enable HTTP API + +Follow [HTTP API](https://doc.powerdns.com/authoritative/http-api/index.html#enabling-the-api) documentation. + + + +### Configuration + +#### File + +The configuration file name for this integration is `go.d/powerdns.conf`. + + +You can edit the configuration file using the `edit-config` script from the +Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory). + +```bash +cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata +sudo ./edit-config go.d/powerdns.conf +``` +#### Options + +The following options can be defined globally: update_every, autodetection_retry. + + +<details open><summary>Config options</summary> + +| Name | Description | Default | Required | +|:----|:-----------|:-------|:--------:| +| update_every | Data collection frequency. | 1 | no | +| autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | +| url | Server URL. | http://127.0.0.1:8081 | yes | +| timeout | HTTP request timeout. | 1 | no | +| username | Username for basic HTTP authentication. | | no | +| password | Password for basic HTTP authentication. | | no | +| proxy_url | Proxy URL. | | no | +| proxy_username | Username for proxy basic HTTP authentication. | | no | +| proxy_password | Password for proxy basic HTTP authentication. | | no | +| method | HTTP request method. | GET | no | +| body | HTTP request body. | | no | +| headers | HTTP request headers. | | no | +| not_follow_redirects | Redirect handling policy. Controls whether the client follows redirects. | no | no | +| tls_skip_verify | Server certificate chain and hostname validation policy. Controls whether the client performs this check. | no | no | +| tls_ca | Certification authority that the client uses when verifying the server's certificates. | | no | +| tls_cert | Client TLS certificate. | | no | +| tls_key | Client TLS key. | | no | + +</details> + +#### Examples + +##### Basic + +An example configuration. + +<details open><summary>Config</summary> + +```yaml +jobs: + - name: local + url: http://127.0.0.1:8081 + +``` +</details> + +##### HTTP authentication + +Basic HTTP authentication. + +<details open><summary>Config</summary> + +```yaml +jobs: + - name: local + url: http://127.0.0.1:8081 + username: admin + password: password + +``` +</details> + +##### Multi-instance + +> **Note**: When you define multiple jobs, their names must be unique. + +Local and remote instances. + + +<details open><summary>Config</summary> + +```yaml +jobs: + - name: local + url: http://127.0.0.1:8081 + + - name: remote + url: http://203.0.113.0:8081 + +``` +</details> + + + +## Troubleshooting + +### Debug Mode + +To troubleshoot issues with the `powerdns` 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]`. + + ```bash + cd /usr/libexec/netdata/plugins.d/ + ``` + +- Switch to the `netdata` user. + + ```bash + sudo -u netdata -s + ``` + +- Run the `go.d.plugin` to debug the collector: + + ```bash + ./go.d.plugin -d -m powerdns + ``` + + diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/metadata.yaml b/src/go/collectors/go.d.plugin/modules/powerdns/metadata.yaml new file mode 100644 index 000000000..ea4dec0b5 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/metadata.yaml @@ -0,0 +1,215 @@ +plugin_name: go.d.plugin +modules: + - meta: + id: collector-go.d.plugin-powerdns + plugin_name: go.d.plugin + module_name: powerdns + monitored_instance: + name: PowerDNS Authoritative Server + link: https://doc.powerdns.com/authoritative/ + icon_filename: powerdns.svg + categories: + - data-collection.dns-and-dhcp-servers + keywords: + - powerdns + - dns + related_resources: + integrations: + list: [] + info_provided_to_referring_integrations: + description: "" + most_popular: false + overview: + data_collection: + metrics_description: | + This collector monitors PowerDNS Authoritative Server instances. + It collects metrics from [the internal webserver](https://doc.powerdns.com/authoritative/http-api/index.html#webserver). + + Used endpoints: + + - [`/api/v1/servers/localhost/statistics`](https://doc.powerdns.com/authoritative/http-api/statistics.html) + method_description: "" + supported_platforms: + include: [] + exclude: [] + multi_instance: true + additional_permissions: + description: "" + default_behavior: + auto_detection: + description: "" + limits: + description: "" + performance_impact: + description: "" + setup: + prerequisites: + list: + - title: Enable webserver + description: | + Follow [webserver](https://doc.powerdns.com/authoritative/http-api/index.html#webserver) documentation. + - title: Enable HTTP API + description: | + Follow [HTTP API](https://doc.powerdns.com/authoritative/http-api/index.html#enabling-the-api) documentation. + configuration: + file: + name: go.d/powerdns.conf + options: + description: | + The following options can be defined globally: update_every, autodetection_retry. + folding: + title: Config options + enabled: true + list: + - name: update_every + description: Data collection frequency. + default_value: 1 + required: false + - name: autodetection_retry + description: Recheck interval in seconds. Zero means no recheck will be scheduled. + default_value: 0 + required: false + - name: url + description: Server URL. + default_value: http://127.0.0.1:8081 + required: true + - name: timeout + description: HTTP request timeout. + default_value: 1 + required: false + - name: username + description: Username for basic HTTP authentication. + default_value: "" + required: false + - name: password + description: Password for basic HTTP authentication. + default_value: "" + required: false + - name: proxy_url + description: Proxy URL. + default_value: "" + required: false + - name: proxy_username + description: Username for proxy basic HTTP authentication. + default_value: "" + required: false + - name: proxy_password + description: Password for proxy basic HTTP authentication. + default_value: "" + required: false + - name: method + description: HTTP request method. + default_value: GET + required: false + - name: body + description: HTTP request body. + default_value: "" + required: false + - name: headers + description: HTTP request headers. + default_value: "" + required: false + - name: not_follow_redirects + description: Redirect handling policy. Controls whether the client follows redirects. + default_value: false + required: false + - name: tls_skip_verify + description: Server certificate chain and hostname validation policy. Controls whether the client performs this check. + default_value: false + required: false + - name: tls_ca + description: Certification authority that the client uses when verifying the server's certificates. + default_value: "" + required: false + - name: tls_cert + description: Client TLS certificate. + default_value: "" + required: false + - name: tls_key + description: Client TLS key. + default_value: "" + required: false + examples: + folding: + title: Config + enabled: true + list: + - name: Basic + description: An example configuration. + config: | + jobs: + - name: local + url: http://127.0.0.1:8081 + - name: HTTP authentication + description: Basic HTTP authentication. + config: | + jobs: + - name: local + url: http://127.0.0.1:8081 + username: admin + password: password + - name: Multi-instance + description: | + > **Note**: When you define multiple jobs, their names must be unique. + + Local and remote instances. + config: | + jobs: + - name: local + url: http://127.0.0.1:8081 + + - name: remote + url: http://203.0.113.0:8081 + troubleshooting: + problems: + list: [] + alerts: [] + metrics: + folding: + title: Metrics + enabled: false + description: "" + availability: [] + scopes: + - name: global + description: These metrics refer to the entire monitored application. + labels: [] + metrics: + - name: powerdns.questions_in + description: Incoming questions + unit: questions/s + chart_type: line + dimensions: + - name: udp + - name: tcp + - name: powerdns.questions_out + description: Outgoing questions + unit: questions/s + chart_type: line + dimensions: + - name: udp + - name: tcp + - name: powerdns.cache_usage + description: Cache Usage + unit: events/s + chart_type: line + dimensions: + - name: query-cache-hit + - name: query-cache-miss + - name: packetcache-hit + - name: packetcache-miss + - name: powerdns.cache_size + description: Cache Size + unit: entries + chart_type: line + dimensions: + - name: query-cache + - name: packet-cache + - name: key-cache + - name: meta-cache + - name: powerdns.latency + description: Answer latency + unit: microseconds + chart_type: line + dimensions: + - name: latency diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/metrics.go b/src/go/collectors/go.d.plugin/modules/powerdns/metrics.go new file mode 100644 index 000000000..3efa2c980 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/metrics.go @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package powerdns + +// https://doc.powerdns.com/authoritative/http-api/statistics.html#objects +type ( + statisticMetrics []statisticMetric + statisticMetric struct { + Name string + Type string + Value interface{} + } +) diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/testdata/config.json b/src/go/collectors/go.d.plugin/modules/powerdns/testdata/config.json new file mode 100644 index 000000000..984c3ed6e --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/testdata/config.json @@ -0,0 +1,20 @@ +{ + "update_every": 123, + "url": "ok", + "body": "ok", + "method": "ok", + "headers": { + "ok": "ok" + }, + "username": "ok", + "password": "ok", + "proxy_url": "ok", + "proxy_username": "ok", + "proxy_password": "ok", + "timeout": 123.123, + "not_follow_redirects": true, + "tls_ca": "ok", + "tls_cert": "ok", + "tls_key": "ok", + "tls_skip_verify": true +} diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/testdata/config.yaml b/src/go/collectors/go.d.plugin/modules/powerdns/testdata/config.yaml new file mode 100644 index 000000000..8558b61cc --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/testdata/config.yaml @@ -0,0 +1,17 @@ +update_every: 123 +url: "ok" +body: "ok" +method: "ok" +headers: + ok: "ok" +username: "ok" +password: "ok" +proxy_url: "ok" +proxy_username: "ok" +proxy_password: "ok" +timeout: 123.123 +not_follow_redirects: yes +tls_ca: "ok" +tls_cert: "ok" +tls_key: "ok" +tls_skip_verify: yes diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/testdata/recursor/statistics.json b/src/go/collectors/go.d.plugin/modules/powerdns/testdata/recursor/statistics.json new file mode 100644 index 000000000..a31477959 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/testdata/recursor/statistics.json @@ -0,0 +1,587 @@ +[ + { + "name": "all-outqueries", + "type": "StatisticItem", + "value": "41" + }, + { + "name": "answers-slow", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "answers0-1", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "answers1-10", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "answers10-100", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "answers100-1000", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth-zone-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth4-answers-slow", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth4-answers0-1", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth4-answers1-10", + "type": "StatisticItem", + "value": "5" + }, + { + "name": "auth4-answers10-100", + "type": "StatisticItem", + "value": "35" + }, + { + "name": "auth4-answers100-1000", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth6-answers-slow", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth6-answers0-1", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth6-answers1-10", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth6-answers10-100", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "auth6-answers100-1000", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "cache-entries", + "type": "StatisticItem", + "value": "171" + }, + { + "name": "cache-hits", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "cache-misses", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "case-mismatches", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "chain-resends", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "client-parse-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "concurrent-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "cpu-msec-thread-0", + "type": "StatisticItem", + "value": "439" + }, + { + "name": "cpu-msec-thread-1", + "type": "StatisticItem", + "value": "445" + }, + { + "name": "cpu-msec-thread-2", + "type": "StatisticItem", + "value": "466" + }, + { + "name": "dlg-only-drops", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnssec-authentic-data-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnssec-check-disabled-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnssec-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnssec-result-bogus", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnssec-result-indeterminate", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnssec-result-insecure", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnssec-result-nta", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnssec-result-secure", + "type": "StatisticItem", + "value": "5" + }, + { + "name": "dnssec-validations", + "type": "StatisticItem", + "value": "5" + }, + { + "name": "dont-outqueries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ecs-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ecs-responses", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "edns-ping-matches", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "edns-ping-mismatches", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "empty-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "failed-host-entries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "fd-usage", + "type": "StatisticItem", + "value": "32" + }, + { + "name": "ignored-packets", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ipv6-outqueries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ipv6-questions", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "malloc-bytes", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "max-cache-entries", + "type": "StatisticItem", + "value": "1000000" + }, + { + "name": "max-mthread-stack", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "max-packetcache-entries", + "type": "StatisticItem", + "value": "500000" + }, + { + "name": "negcache-entries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "no-packet-error", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "noedns-outqueries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "noerror-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "noping-outqueries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "nsset-invalidations", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "nsspeeds-entries", + "type": "StatisticItem", + "value": "78" + }, + { + "name": "nxdomain-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "outgoing-timeouts", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "outgoing4-timeouts", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "outgoing6-timeouts", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "over-capacity-drops", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "packetcache-entries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "packetcache-hits", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "packetcache-misses", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "policy-drops", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "policy-result-custom", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "policy-result-drop", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "policy-result-noaction", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "policy-result-nodata", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "policy-result-nxdomain", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "policy-result-truncate", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "qa-latency", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "qname-min-fallback-success", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "query-pipe-full-drops", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "questions", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "real-memory-usage", + "type": "StatisticItem", + "value": "44773376" + }, + { + "name": "rebalanced-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "resource-limits", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "security-status", + "type": "StatisticItem", + "value": "3" + }, + { + "name": "server-parse-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "servfail-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "spoof-prevents", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "sys-msec", + "type": "StatisticItem", + "value": "1520" + }, + { + "name": "tcp-client-overflow", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp-clients", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp-outqueries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp-questions", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "throttle-entries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "throttled-out", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "throttled-outqueries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "too-old-drops", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "truncated-drops", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-in-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-noport-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-recvbuf-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-sndbuf-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "unauthorized-tcp", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "unauthorized-udp", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "unexpected-packets", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "unreachables", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "uptime", + "type": "StatisticItem", + "value": "1624" + }, + { + "name": "user-msec", + "type": "StatisticItem", + "value": "465" + }, + { + "name": "variable-responses", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "x-our-latency", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "x-ourtime-slow", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "x-ourtime0-1", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "x-ourtime1-2", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "x-ourtime16-32", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "x-ourtime2-4", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "x-ourtime4-8", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "x-ourtime8-16", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "response-by-qtype", + "type": "MapStatisticItem", + "value": [] + }, + { + "name": "response-sizes", + "type": "MapStatisticItem", + "value": [] + }, + { + "name": "response-by-rcode", + "type": "MapStatisticItem", + "value": [] + } +] diff --git a/src/go/collectors/go.d.plugin/modules/powerdns/testdata/v4.3.0/statistics.json b/src/go/collectors/go.d.plugin/modules/powerdns/testdata/v4.3.0/statistics.json new file mode 100644 index 000000000..30813d3d8 --- /dev/null +++ b/src/go/collectors/go.d.plugin/modules/powerdns/testdata/v4.3.0/statistics.json @@ -0,0 +1,507 @@ +[ + { + "name": "corrupt-packets", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "cpu-iowait", + "type": "StatisticItem", + "value": "513" + }, + { + "name": "cpu-steal", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "deferred-cache-inserts", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "deferred-cache-lookup", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "deferred-packetcache-inserts", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "deferred-packetcache-lookup", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnsupdate-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnsupdate-changes", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnsupdate-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "dnsupdate-refused", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "fd-usage", + "type": "StatisticItem", + "value": "23" + }, + { + "name": "incoming-notifications", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "key-cache-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "latency", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "meta-cache-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "open-tcp-connections", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "overload-drops", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "packetcache-hit", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "packetcache-miss", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "packetcache-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "qsize-q", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "query-cache-hit", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "query-cache-miss", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "query-cache-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "rd-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "real-memory-usage", + "type": "StatisticItem", + "value": "164507648" + }, + { + "name": "recursing-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "recursing-questions", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "recursion-unanswered", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ring-logmessages-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-logmessages-size", + "type": "StatisticItem", + "value": "10" + }, + { + "name": "ring-noerror-queries-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-noerror-queries-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ring-nxdomain-queries-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-nxdomain-queries-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ring-queries-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-queries-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ring-remotes-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-remotes-corrupt-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-remotes-corrupt-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ring-remotes-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ring-remotes-unauth-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-remotes-unauth-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ring-servfail-queries-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-servfail-queries-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "ring-unauth-queries-capacity", + "type": "StatisticItem", + "value": "10000" + }, + { + "name": "ring-unauth-queries-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "security-status", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "servfail-packets", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "signature-cache-size", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "signatures", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "sys-msec", + "type": "StatisticItem", + "value": "128" + }, + { + "name": "tcp-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp-answers-bytes", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp4-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp4-answers-bytes", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp4-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp6-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp6-answers-bytes", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "tcp6-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "timedout-packets", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-answers-bytes", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-do-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-in-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-noport-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-recvbuf-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp-sndbuf-errors", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp4-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp4-answers-bytes", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp4-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp6-answers", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp6-answers-bytes", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "udp6-queries", + "type": "StatisticItem", + "value": "1" + }, + { + "name": "uptime", + "type": "StatisticItem", + "value": "207" + }, + { + "name": "user-msec", + "type": "StatisticItem", + "value": "56" + }, + { + "name": "response-by-qtype", + "type": "MapStatisticItem", + "value": [] + }, + { + "name": "response-sizes", + "type": "MapStatisticItem", + "value": [] + }, + { + "name": "response-by-rcode", + "type": "MapStatisticItem", + "value": [] + }, + { + "name": "logmessages", + "size": "10000", + "type": "RingStatisticItem", + "value": [ + { + "name": "[webserver] 088688d6-9976-4e4d-a6aa-2272f8c6f173 HTTP Request \"/api/v1/servers/localhost/statistics\": Authentication by API Key failed", + "value": "1" + }, + { + "name": "[webserver] 662e4249-4e9a-42e7-b780-b81929875b8f HTTP Request \"/api/v1/servers/localhost/statistics\": Authentication by API Key failed", + "value": "1" + }, + { + "name": "[webserver] 8c79870a-9a47-4952-9166-02710d146ab3 HTTP Request \"/api/v1/servers/localhost/statistics\": Authentication by API Key failed", + "value": "1" + }, + { + "name": "[webserver] dc029119-209f-4101-9e8f-82ab02d857d9 HTTP Request \"/api/v1/servers/localhost/statistics\": Authentication by API Key failed", + "value": "1" + }, + { + "name": "[webserver] fa61f546-8607-4771-bc9a-48ddc5a85dc0 HTTP Request \"/api/v1/servers/localhost/statistics\": Authentication by API Key failed", + "value": "1" + }, + { + "name": "About to create 3 backend threads for UDP", + "value": "1" + }, + { + "name": "Creating backend connection for TCP", + "value": "1" + }, + { + "name": "Done launching threads, ready to distribute questions", + "value": "1" + }, + { + "name": "Master/slave communicator launching", + "value": "1" + }, + { + "name": "No master domains need notifications", + "value": "1" + } + ] + }, + { + "name": "remotes", + "size": "10000", + "type": "RingStatisticItem", + "value": [] + }, + { + "name": "remotes-corrupt", + "size": "10000", + "type": "RingStatisticItem", + "value": [] + }, + { + "name": "remotes-unauth", + "size": "10000", + "type": "RingStatisticItem", + "value": [] + }, + { + "name": "noerror-queries", + "size": "10000", + "type": "RingStatisticItem", + "value": [] + }, + { + "name": "nxdomain-queries", + "size": "10000", + "type": "RingStatisticItem", + "value": [] + }, + { + "name": "queries", + "size": "10000", + "type": "RingStatisticItem", + "value": [] + }, + { + "name": "servfail-queries", + "size": "10000", + "type": "RingStatisticItem", + "value": [] + }, + { + "name": "unauth-queries", + "size": "10000", + "type": "RingStatisticItem", + "value": [] + } +] |