mirror of
https://github.com/ebrianne/adguard-exporter.git
synced 2024-12-22 07:37:32 +01:00
Fix go report errors and updated README with new metric
This commit is contained in:
parent
645a647497
commit
7a328b11be
@ -129,3 +129,4 @@ scrape_configs:
|
||||
| adguard_top_blocked_domains | This represent the top blocked domains |
|
||||
| adguard_top_clients | This represent the top clients |
|
||||
| adguard_top_queried_domains | This represent the top domains that are queried |
|
||||
| adguard_query_types | This represent the types of DNS queries |
|
||||
|
@ -131,8 +131,8 @@ func (c *Client) setLogMetrics(logdata *LogData) {
|
||||
logstats := logdata.Data[i]
|
||||
if logstats.DNS != nil {
|
||||
for j := range logstats.DNS {
|
||||
dns_type := logstats.DNS[j].Type
|
||||
m[dns_type] += 1
|
||||
dnsType := logstats.DNS[j].Type
|
||||
m[dnsType] += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,26 +15,26 @@ type Stats struct {
|
||||
TopClients []map[string]int `json:"top_clients"`
|
||||
}
|
||||
|
||||
// DNS answer struct in the log
|
||||
// DNSAnswer struct from LogStats
|
||||
type DNSAnswer struct {
|
||||
Ttl float64 `json:"ttl"`
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// DNS query struct in the log
|
||||
// DNSQuery struct from LogStats
|
||||
type DNSQuery struct {
|
||||
Class string `json:"class"`
|
||||
Host string `json:"host"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// LogStats struct for the Adguard log statistics JSON API corresponding model.
|
||||
// LogStats struct, sub struct of LogData to collect the dns stats from the log
|
||||
type LogStats struct {
|
||||
DNS []DNSAnswer `json:"answer"`
|
||||
DNSSec bool `json:"answer_dnssec"`
|
||||
Client string `json:"client"`
|
||||
Client_proto string `json:"client_proto"`
|
||||
ClientProto string `json:"client_proto"`
|
||||
Elapsed string `json:"elapsedMs"`
|
||||
Question DNSQuery `json:"question"`
|
||||
Reason string `json:"reason"`
|
||||
@ -43,6 +43,7 @@ type LogStats struct {
|
||||
Upstream string `json:"upstream"`
|
||||
}
|
||||
|
||||
// LogData struct for the Adguard log statistics JSON API corresponding model.
|
||||
type LogData struct {
|
||||
Data []LogStats `json:"data"`
|
||||
Oldest string `json:"oldest"`
|
||||
|
@ -97,7 +97,7 @@ var (
|
||||
[]string{"hostname", "client"},
|
||||
)
|
||||
|
||||
// Answer
|
||||
// QueryTypes - The type of DNS Queries (A, AAAA...)
|
||||
QueryTypes = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "query_types",
|
||||
|
Loading…
Reference in New Issue
Block a user