Compare commits

..

No commits in common. "9382391c304384e06b6cd29f393361092077914b" and "f747d71cc0ce0f9c8100cdc3cc0a88d53f420ba6" have entirely different histories.

2 changed files with 38 additions and 34 deletions

View file

@ -159,7 +159,9 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
"servers.bind.", "servers.bind.",
} }
for _, q := range questions { responses := make([]dns.RR, len(questions))
for i, q := range questions {
msg := &dns.Msg{ msg := &dns.Msg{
MsgHdr: dns.MsgHdr{ MsgHdr: dns.MsgHdr{
Id: dns.Id(), Id: dns.Id(),
@ -175,7 +177,10 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
return err return err
} }
for _, a := range in.Answer { responses[i] = in.Answer[0]
}
for _, a := range responses {
txt, ok := a.(*dns.TXT) txt, ok := a.(*dns.TXT)
if !ok { if !ok {
continue continue
@ -213,7 +218,6 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric(g, prometheus.GaugeValue, f) ch <- prometheus.MustNewConstMetric(g, prometheus.GaugeValue, f)
} }
} }
}
return nil return nil
}) })

View file

@ -23,8 +23,8 @@ import (
"github.com/google/dnsmasq_exporter/collector" "github.com/google/dnsmasq_exporter/collector"
"github.com/miekg/dns" "github.com/miekg/dns"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors/version"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/client_golang/prometheus/collectors/version"
) )
var ( var (