@@ -15,12 +15,11 @@ package probe
1515
1616import (
1717 "log"
18-
1918 "github.com/prometheus-community/fortigate_exporter/pkg/http"
2019 "github.com/prometheus/client_golang/prometheus"
2120)
2221
23- func probeNetworkDnsLatency (c http.FortiHTTP , meta * TargetMetadata ) ([]prometheus.Metric , bool ) {
22+ func probeNetworkDNSLatency (c http.FortiHTTP , _ * TargetMetadata ) ([]prometheus.Metric , bool ) {
2423 var (
2524 dnsLatency = prometheus .NewDesc (
2625 "fortigate_network_dns_latency_seconds" ,
@@ -29,25 +28,25 @@ func probeNetworkDnsLatency(c http.FortiHTTP, meta *TargetMetadata) ([]prometheu
2928 )
3029 )
3130
32- type DnsLatencty struct {
31+ type DNSLatencty struct {
3332 Service string `json:"service"`
3433 Latency float64 `json:"latency"`
3534 LastUpdate float64 `json:"last_update"`
36- Ip string `json:"ip"`
35+ IP string `json:"ip"`
3736 }
3837
39- type DnsLatencyResult struct {
40- Results []DnsLatencty `json:"results"`
38+ type DNSLatencyResult struct {
39+ Results []DNSLatencty `json:"results"`
4140 }
4241
43- var res DnsLatencyResult
42+ var res DNSLatencyResult
4443 if err := c .Get ("api/v2/monitor/network/dns/latency" , "" , & res ); err != nil {
4544 log .Printf ("Warning: %v" , err )
4645 return nil , false
4746 }
4847 m := []prometheus.Metric {}
4948 for _ , r := range res .Results {
50- m = append (m , prometheus .MustNewConstMetric (dnsLatency , prometheus .GaugeValue , r .Latency * 0.001 , r .Service , r .Ip ))
49+ m = append (m , prometheus .MustNewConstMetric (dnsLatency , prometheus .GaugeValue , r .Latency * 0.001 , r .Service , r .IP ))
5150 }
5251
5352 return m , true
0 commit comments