From 7661481b9f2a573de53ed3be1f5f52cb722ccb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Nov=C3=BD?= Date: Mon, 27 Feb 2023 20:59:36 +0100 Subject: [PATCH] Add all reply types --- internal/pihole/client.go | 10 ++++++++++ internal/pihole/model.go | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/internal/pihole/client.go b/internal/pihole/client.go index b1384c6..5516374 100644 --- a/internal/pihole/client.go +++ b/internal/pihole/client.go @@ -114,10 +114,20 @@ func (c *Client) setMetrics(stats *Stats) { metrics.UniqueClients.WithLabelValues(c.config.PIHoleHostname).Set(float64(stats.UniqueClients)) metrics.DNSQueriesAllTypes.WithLabelValues(c.config.PIHoleHostname).Set(float64(stats.DNSQueriesAllTypes)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "unknown").Set(float64(stats.ReplyUnknown)) metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "no_data").Set(float64(stats.ReplyNoData)) metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "nx_domain").Set(float64(stats.ReplyNxDomain)) metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "cname").Set(float64(stats.ReplyCname)) metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "ip").Set(float64(stats.ReplyIP)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "domain").Set(float64(stats.ReplyDomain)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "rr_name").Set(float64(stats.ReplyRRName)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "serv_fail").Set(float64(stats.ReplyServFail)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "refused").Set(float64(stats.ReplyRefused)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "not_imp").Set(float64(stats.ReplyNotImp)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "other").Set(float64(stats.ReplyOther)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "dnssec").Set(float64(stats.ReplyDNSSEC)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "none").Set(float64(stats.ReplyNone)) + metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "blob").Set(float64(stats.ReplyBlob)) var isEnabled int = 0 if stats.Status == enabledStatus { diff --git a/internal/pihole/model.go b/internal/pihole/model.go index 8067085..d9bbef3 100644 --- a/internal/pihole/model.go +++ b/internal/pihole/model.go @@ -18,10 +18,20 @@ type Stats struct { ClientsEverSeen int `json:"clients_ever_seen"` UniqueClients int `json:"unique_clients"` DNSQueriesAllTypes int `json:"dns_queries_all_types"` + ReplyUnknown int `json:"reply_UNKNOWN"` ReplyNoData int `json:"reply_NODATA"` ReplyNxDomain int `json:"reply_NXDOMAIN"` ReplyCname int `json:"reply_CNAME"` ReplyIP int `json:"reply_IP"` + ReplyDomain int `json:"reply_DOMAIN"` + ReplyRRName int `json:"reply_RRNAME"` + ReplyServFail int `json:"reply_SERVFAIL"` + ReplyRefused int `json:"reply_REFUSED"` + ReplyNotImp int `json:"reply_NOTIMP"` + ReplyOther int `json:"reply_OTHER"` + ReplyDNSSEC int `json:"reply_DNSSEC"` + ReplyNone int `json:"reply_NONE"` + ReplyBlob int `json:"reply_BLOB"` TopQueries map[string]int `json:"top_queries"` TopAds map[string]int `json:"top_ads"` TopSources map[string]int `json:"top_sources"`