Add all reply types

This commit is contained in:
Ondřej Nový 2023-02-27 20:59:36 +01:00
parent d446d1b0ea
commit 7661481b9f
2 changed files with 20 additions and 0 deletions

View file

@ -114,10 +114,20 @@ func (c *Client) setMetrics(stats *Stats) {
metrics.UniqueClients.WithLabelValues(c.config.PIHoleHostname).Set(float64(stats.UniqueClients)) metrics.UniqueClients.WithLabelValues(c.config.PIHoleHostname).Set(float64(stats.UniqueClients))
metrics.DNSQueriesAllTypes.WithLabelValues(c.config.PIHoleHostname).Set(float64(stats.DNSQueriesAllTypes)) 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, "no_data").Set(float64(stats.ReplyNoData))
metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "nx_domain").Set(float64(stats.ReplyNxDomain)) 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, "cname").Set(float64(stats.ReplyCname))
metrics.Reply.WithLabelValues(c.config.PIHoleHostname, "ip").Set(float64(stats.ReplyIP)) 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 var isEnabled int = 0
if stats.Status == enabledStatus { if stats.Status == enabledStatus {

View file

@ -18,10 +18,20 @@ type Stats struct {
ClientsEverSeen int `json:"clients_ever_seen"` ClientsEverSeen int `json:"clients_ever_seen"`
UniqueClients int `json:"unique_clients"` UniqueClients int `json:"unique_clients"`
DNSQueriesAllTypes int `json:"dns_queries_all_types"` DNSQueriesAllTypes int `json:"dns_queries_all_types"`
ReplyUnknown int `json:"reply_UNKNOWN"`
ReplyNoData int `json:"reply_NODATA"` ReplyNoData int `json:"reply_NODATA"`
ReplyNxDomain int `json:"reply_NXDOMAIN"` ReplyNxDomain int `json:"reply_NXDOMAIN"`
ReplyCname int `json:"reply_CNAME"` ReplyCname int `json:"reply_CNAME"`
ReplyIP int `json:"reply_IP"` 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"` TopQueries map[string]int `json:"top_queries"`
TopAds map[string]int `json:"top_ads"` TopAds map[string]int `json:"top_ads"`
TopSources map[string]int `json:"top_sources"` TopSources map[string]int `json:"top_sources"`