mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-16 17:56:37 +00:00
dns: Implement Perfdata collector (#1672)
This commit is contained in:
92
internal/collector/dns/const.go
Normal file
92
internal/collector/dns/const.go
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
package dns
|
||||||
|
|
||||||
|
const (
|
||||||
|
_ = "% User Time"
|
||||||
|
_ = "176"
|
||||||
|
_ = "Async Fast Reads/sec"
|
||||||
|
axfrRequestReceived = "AXFR Request Received"
|
||||||
|
axfrRequestSent = "AXFR Request Sent"
|
||||||
|
axfrResponseReceived = "AXFR Response Received"
|
||||||
|
axfrSuccessReceived = "AXFR Success Received"
|
||||||
|
axfrSuccessSent = "AXFR Success Sent"
|
||||||
|
cachingMemory = "Caching Memory"
|
||||||
|
_ = "Data Flush Pages/sec"
|
||||||
|
_ = "Data Flushes/sec"
|
||||||
|
databaseNodeMemory = "Database Node Memory"
|
||||||
|
dynamicUpdateNoOperation = "Dynamic Update NoOperation"
|
||||||
|
_ = "Dynamic Update NoOperation/sec"
|
||||||
|
dynamicUpdateQueued = "Dynamic Update Queued"
|
||||||
|
_ = "Dynamic Update Received"
|
||||||
|
_ = "Dynamic Update Received/sec"
|
||||||
|
dynamicUpdateRejected = "Dynamic Update Rejected"
|
||||||
|
dynamicUpdateTimeOuts = "Dynamic Update TimeOuts"
|
||||||
|
dynamicUpdateWrittenToDatabase = "Dynamic Update Written to Database"
|
||||||
|
_ = "Dynamic Update Written to Database/sec"
|
||||||
|
_ = "Enumerations Server/sec"
|
||||||
|
_ = "Fast Read Not Possibles/sec"
|
||||||
|
_ = "Fast Read Resource Misses/sec"
|
||||||
|
ixfrRequestReceived = "IXFR Request Received"
|
||||||
|
ixfrRequestSent = "IXFR Request Sent"
|
||||||
|
ixfrResponseReceived = "IXFR Response Received"
|
||||||
|
_ = "IXFR Success Received"
|
||||||
|
ixfrSuccessSent = "IXFR Success Sent"
|
||||||
|
ixfrTCPSuccessReceived = "IXFR TCP Success Received"
|
||||||
|
ixfrUDPSuccessReceived = "IXFR UDP Success Received"
|
||||||
|
_ = "Lazy Write Flushes/sec"
|
||||||
|
_ = "Lazy Write Pages/sec"
|
||||||
|
_ = "Level 2 TLB Fills/sec"
|
||||||
|
nbStatMemory = "Nbstat Memory"
|
||||||
|
notifyReceived = "Notify Received"
|
||||||
|
notifySent = "Notify Sent"
|
||||||
|
_ = "Query Dropped Bad Socket"
|
||||||
|
_ = "Query Dropped Bad Socket/sec"
|
||||||
|
_ = "Query Dropped By Policy"
|
||||||
|
_ = "Query Dropped By Policy/sec"
|
||||||
|
_ = "Query Dropped By Response Rate Limiting"
|
||||||
|
_ = "Query Dropped By Response Rate Limiting/sec"
|
||||||
|
_ = "Query Dropped Send"
|
||||||
|
_ = "Query Dropped Send/sec"
|
||||||
|
_ = "Query Dropped Total"
|
||||||
|
_ = "Query Dropped Total/sec"
|
||||||
|
recordFlowMemory = "Record Flow Memory"
|
||||||
|
recursiveQueries = "Recursive Queries"
|
||||||
|
_ = "Recursive Queries/sec"
|
||||||
|
recursiveQueryFailure = "Recursive Query Failure"
|
||||||
|
_ = "Recursive Query Failure/sec"
|
||||||
|
_ = "Recursive Send TimeOuts"
|
||||||
|
recursiveSendTimeOuts = "Recursive TimeOut/sec"
|
||||||
|
_ = "Responses Suppressed"
|
||||||
|
_ = "Responses Suppressed/sec"
|
||||||
|
secureUpdateFailure = "Secure Update Failure"
|
||||||
|
secureUpdateReceived = "Secure Update Received"
|
||||||
|
_ = "Secure Update Received/sec"
|
||||||
|
tcpMessageMemory = "TCP Message Memory"
|
||||||
|
tcpQueryReceived = "TCP Query Received"
|
||||||
|
_ = "TCP Query Received/sec"
|
||||||
|
tcpResponseSent = "TCP Response Sent"
|
||||||
|
_ = "TCP Response Sent/sec"
|
||||||
|
_ = "Total Query Received"
|
||||||
|
_ = "Total Query Received/sec"
|
||||||
|
_ = "Total Remote Inflight Queries"
|
||||||
|
_ = "Total Response Sent"
|
||||||
|
_ = "Total Response Sent/sec"
|
||||||
|
udpMessageMemory = "UDP Message Memory"
|
||||||
|
udpQueryReceived = "UDP Query Received"
|
||||||
|
_ = "UDP Query Received/sec"
|
||||||
|
udpResponseSent = "UDP Response Sent"
|
||||||
|
_ = "UDP Response Sent/sec"
|
||||||
|
unmatchedResponsesReceived = "Unmatched Responses Received"
|
||||||
|
_ = "Virtual Bytes"
|
||||||
|
winsLookupReceived = "WINS Lookup Received"
|
||||||
|
_ = "WINS Lookup Received/sec"
|
||||||
|
winsResponseSent = "WINS Response Sent"
|
||||||
|
_ = "WINS Response Sent/sec"
|
||||||
|
winsReverseLookupReceived = "WINS Reverse Lookup Received"
|
||||||
|
_ = "WINS Reverse Lookup Received/sec"
|
||||||
|
winsReverseResponseSent = "WINS Reverse Response Sent"
|
||||||
|
_ = "WINS Reverse Response Sent/sec"
|
||||||
|
zoneTransferFailure = "Zone Transfer Failure"
|
||||||
|
zoneTransferSOARequestSent = "Zone Transfer Request Received"
|
||||||
|
_ = "Zone Transfer SOA Request Sent"
|
||||||
|
_ = "Zone Transfer Success"
|
||||||
|
)
|
||||||
@@ -4,9 +4,12 @@ package dns
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
"github.com/alecthomas/kingpin/v2"
|
||||||
|
"github.com/prometheus-community/windows_exporter/internal/perfdata"
|
||||||
|
"github.com/prometheus-community/windows_exporter/internal/perfdata/perftypes"
|
||||||
"github.com/prometheus-community/windows_exporter/internal/types"
|
"github.com/prometheus-community/windows_exporter/internal/types"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/yusufpapurcu/wmi"
|
"github.com/yusufpapurcu/wmi"
|
||||||
@@ -20,8 +23,9 @@ var ConfigDefaults = Config{}
|
|||||||
|
|
||||||
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics.
|
// A Collector is a Prometheus Collector for WMI Win32_PerfRawData_DNS_DNS metrics.
|
||||||
type Collector struct {
|
type Collector struct {
|
||||||
config Config
|
config Config
|
||||||
wmiClient *wmi.Client
|
|
||||||
|
perfDataCollector perfdata.Collector
|
||||||
|
|
||||||
dynamicUpdatesFailures *prometheus.Desc
|
dynamicUpdatesFailures *prometheus.Desc
|
||||||
dynamicUpdatesQueued *prometheus.Desc
|
dynamicUpdatesQueued *prometheus.Desc
|
||||||
@@ -75,12 +79,56 @@ func (c *Collector) Close(_ *slog.Logger) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
func (c *Collector) Build(_ *slog.Logger, _ *wmi.Client) error {
|
||||||
if wmiClient == nil || wmiClient.SWbemServicesClient == nil {
|
counters := []string{
|
||||||
return errors.New("wmiClient or SWbemServicesClient is nil")
|
axfrRequestReceived,
|
||||||
|
axfrRequestSent,
|
||||||
|
axfrResponseReceived,
|
||||||
|
axfrSuccessReceived,
|
||||||
|
axfrSuccessSent,
|
||||||
|
cachingMemory,
|
||||||
|
databaseNodeMemory,
|
||||||
|
dynamicUpdateNoOperation,
|
||||||
|
dynamicUpdateQueued,
|
||||||
|
dynamicUpdateRejected,
|
||||||
|
dynamicUpdateTimeOuts,
|
||||||
|
dynamicUpdateWrittenToDatabase,
|
||||||
|
ixfrRequestReceived,
|
||||||
|
ixfrRequestSent,
|
||||||
|
ixfrResponseReceived,
|
||||||
|
ixfrSuccessSent,
|
||||||
|
ixfrTCPSuccessReceived,
|
||||||
|
ixfrUDPSuccessReceived,
|
||||||
|
nbStatMemory,
|
||||||
|
notifyReceived,
|
||||||
|
notifySent,
|
||||||
|
recordFlowMemory,
|
||||||
|
recursiveQueries,
|
||||||
|
recursiveQueryFailure,
|
||||||
|
recursiveSendTimeOuts,
|
||||||
|
secureUpdateFailure,
|
||||||
|
secureUpdateReceived,
|
||||||
|
tcpMessageMemory,
|
||||||
|
tcpQueryReceived,
|
||||||
|
tcpResponseSent,
|
||||||
|
udpMessageMemory,
|
||||||
|
udpQueryReceived,
|
||||||
|
udpResponseSent,
|
||||||
|
unmatchedResponsesReceived,
|
||||||
|
winsLookupReceived,
|
||||||
|
winsResponseSent,
|
||||||
|
winsReverseLookupReceived,
|
||||||
|
winsReverseResponseSent,
|
||||||
|
zoneTransferFailure,
|
||||||
|
zoneTransferSOARequestSent,
|
||||||
}
|
}
|
||||||
|
|
||||||
c.wmiClient = wmiClient
|
var err error
|
||||||
|
|
||||||
|
c.perfDataCollector, err = perfdata.NewCollector(perfdata.V1, "DNS", perfdata.AllInstances, counters)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to create DNS collector: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
c.zoneTransferRequestsReceived = prometheus.NewDesc(
|
c.zoneTransferRequestsReceived = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_received_total"),
|
prometheus.BuildFQName(types.Namespace, Name, "zone_transfer_requests_received_total"),
|
||||||
@@ -220,138 +268,80 @@ func (c *Collector) Build(_ *slog.Logger, wmiClient *wmi.Client) error {
|
|||||||
|
|
||||||
// Collect sends the metric values for each metric
|
// Collect sends the metric values for each metric
|
||||||
// to the provided prometheus Metric channel.
|
// to the provided prometheus Metric channel.
|
||||||
func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error {
|
func (c *Collector) Collect(_ *types.ScrapeContext, _ *slog.Logger, ch chan<- prometheus.Metric) error {
|
||||||
logger = logger.With(slog.String("collector", Name))
|
perfData, err := c.perfDataCollector.Collect()
|
||||||
if err := c.collect(ch); err != nil {
|
if err != nil {
|
||||||
logger.Error("failed collecting dns metrics",
|
return fmt.Errorf("failed to collect DNS metrics: %w", err)
|
||||||
slog.Any("err", err),
|
|
||||||
)
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
data, ok := perfData[perftypes.EmptyInstance]
|
||||||
}
|
if !ok {
|
||||||
|
return errors.New("perflib query for DNS returned empty result set")
|
||||||
// Win32_PerfRawData_DNS_DNS docs:
|
|
||||||
// - https://msdn.microsoft.com/en-us/library/ms803992.aspx?f=255&MSPPError=-2147217396
|
|
||||||
// - https://technet.microsoft.com/en-us/library/cc977686.aspx
|
|
||||||
type Win32_PerfRawData_DNS_DNS struct {
|
|
||||||
AXFRRequestReceived uint32
|
|
||||||
AXFRRequestSent uint32
|
|
||||||
AXFRResponseReceived uint32
|
|
||||||
AXFRSuccessReceived uint32
|
|
||||||
AXFRSuccessSent uint32
|
|
||||||
CachingMemory uint32
|
|
||||||
DatabaseNodeMemory uint32
|
|
||||||
DynamicUpdateNoOperation uint32
|
|
||||||
DynamicUpdateQueued uint32
|
|
||||||
DynamicUpdateRejected uint32
|
|
||||||
DynamicUpdateTimeOuts uint32
|
|
||||||
DynamicUpdateWrittentoDatabase uint32
|
|
||||||
IXFRRequestReceived uint32
|
|
||||||
IXFRRequestSent uint32
|
|
||||||
IXFRResponseReceived uint32
|
|
||||||
IXFRSuccessSent uint32
|
|
||||||
IXFRTCPSuccessReceived uint32
|
|
||||||
IXFRUDPSuccessReceived uint32
|
|
||||||
NbstatMemory uint32
|
|
||||||
NotifyReceived uint32
|
|
||||||
NotifySent uint32
|
|
||||||
RecordFlowMemory uint32
|
|
||||||
RecursiveQueries uint32
|
|
||||||
RecursiveQueryFailure uint32
|
|
||||||
RecursiveSendTimeOuts uint32
|
|
||||||
SecureUpdateFailure uint32
|
|
||||||
SecureUpdateReceived uint32
|
|
||||||
TCPMessageMemory uint32
|
|
||||||
TCPQueryReceived uint32
|
|
||||||
TCPResponseSent uint32
|
|
||||||
UDPMessageMemory uint32
|
|
||||||
UDPQueryReceived uint32
|
|
||||||
UDPResponseSent uint32
|
|
||||||
UnmatchedResponsesReceived uint32
|
|
||||||
WINSLookupReceived uint32
|
|
||||||
WINSResponseSent uint32
|
|
||||||
WINSReverseLookupReceived uint32
|
|
||||||
WINSReverseResponseSent uint32
|
|
||||||
ZoneTransferFailure uint32
|
|
||||||
ZoneTransferSOARequestSent uint32
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
|
||||||
var dst []Win32_PerfRawData_DNS_DNS
|
|
||||||
if err := c.wmiClient.Query("SELECT * FROM Win32_PerfRawData_DNS_DNS", &dst); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(dst) == 0 {
|
|
||||||
return errors.New("WMI query returned empty result set")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferRequestsReceived,
|
c.zoneTransferRequestsReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].AXFRRequestReceived),
|
data[axfrRequestReceived].FirstValue,
|
||||||
"full",
|
"full",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferRequestsReceived,
|
c.zoneTransferRequestsReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].IXFRRequestReceived),
|
data[ixfrRequestReceived].FirstValue,
|
||||||
"incremental",
|
"incremental",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferRequestsSent,
|
c.zoneTransferRequestsSent,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].AXFRRequestSent),
|
data[axfrRequestSent].FirstValue,
|
||||||
"full",
|
"full",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferRequestsSent,
|
c.zoneTransferRequestsSent,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].IXFRRequestSent),
|
data[ixfrRequestSent].FirstValue,
|
||||||
"incremental",
|
"incremental",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferRequestsSent,
|
c.zoneTransferRequestsSent,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].ZoneTransferSOARequestSent),
|
data[zoneTransferSOARequestSent].FirstValue,
|
||||||
"soa",
|
"soa",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferResponsesReceived,
|
c.zoneTransferResponsesReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].AXFRResponseReceived),
|
data[axfrResponseReceived].FirstValue,
|
||||||
"full",
|
"full",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferResponsesReceived,
|
c.zoneTransferResponsesReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].IXFRResponseReceived),
|
data[ixfrResponseReceived].FirstValue,
|
||||||
"incremental",
|
"incremental",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferSuccessReceived,
|
c.zoneTransferSuccessReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].AXFRSuccessReceived),
|
data[axfrSuccessReceived].FirstValue,
|
||||||
"full",
|
"full",
|
||||||
"tcp",
|
"tcp",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferSuccessReceived,
|
c.zoneTransferSuccessReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].IXFRTCPSuccessReceived),
|
data[ixfrTCPSuccessReceived].FirstValue,
|
||||||
"incremental",
|
"incremental",
|
||||||
"tcp",
|
"tcp",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferSuccessReceived,
|
c.zoneTransferSuccessReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].IXFRTCPSuccessReceived),
|
data[ixfrTCPSuccessReceived].FirstValue,
|
||||||
"incremental",
|
"incremental",
|
||||||
"udp",
|
"udp",
|
||||||
)
|
)
|
||||||
@@ -359,183 +349,183 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
|
|||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferSuccessSent,
|
c.zoneTransferSuccessSent,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].AXFRSuccessSent),
|
data[axfrSuccessSent].FirstValue,
|
||||||
"full",
|
"full",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferSuccessSent,
|
c.zoneTransferSuccessSent,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].IXFRSuccessSent),
|
data[ixfrSuccessSent].FirstValue,
|
||||||
"incremental",
|
"incremental",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.zoneTransferFailures,
|
c.zoneTransferFailures,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].ZoneTransferFailure),
|
data[zoneTransferFailure].FirstValue,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.memoryUsedBytes,
|
c.memoryUsedBytes,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].CachingMemory),
|
data[cachingMemory].FirstValue,
|
||||||
"caching",
|
"caching",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.memoryUsedBytes,
|
c.memoryUsedBytes,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].DatabaseNodeMemory),
|
data[databaseNodeMemory].FirstValue,
|
||||||
"database_node",
|
"database_node",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.memoryUsedBytes,
|
c.memoryUsedBytes,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].NbstatMemory),
|
data[nbStatMemory].FirstValue,
|
||||||
"nbstat",
|
"nbstat",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.memoryUsedBytes,
|
c.memoryUsedBytes,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].RecordFlowMemory),
|
data[recordFlowMemory].FirstValue,
|
||||||
"record_flow",
|
"record_flow",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.memoryUsedBytes,
|
c.memoryUsedBytes,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].TCPMessageMemory),
|
data[tcpMessageMemory].FirstValue,
|
||||||
"tcp_message",
|
"tcp_message",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.memoryUsedBytes,
|
c.memoryUsedBytes,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].UDPMessageMemory),
|
data[udpMessageMemory].FirstValue,
|
||||||
"udp_message",
|
"udp_message",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.dynamicUpdatesReceived,
|
c.dynamicUpdatesReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].DynamicUpdateNoOperation),
|
data[dynamicUpdateNoOperation].FirstValue,
|
||||||
"noop",
|
"noop",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.dynamicUpdatesReceived,
|
c.dynamicUpdatesReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].DynamicUpdateWrittentoDatabase),
|
data[dynamicUpdateWrittenToDatabase].FirstValue,
|
||||||
"written",
|
"written",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.dynamicUpdatesQueued,
|
c.dynamicUpdatesQueued,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(dst[0].DynamicUpdateQueued),
|
data[dynamicUpdateQueued].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.dynamicUpdatesFailures,
|
c.dynamicUpdatesFailures,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].DynamicUpdateRejected),
|
data[dynamicUpdateRejected].FirstValue,
|
||||||
"rejected",
|
"rejected",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.dynamicUpdatesFailures,
|
c.dynamicUpdatesFailures,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].DynamicUpdateTimeOuts),
|
data[dynamicUpdateTimeOuts].FirstValue,
|
||||||
"timeout",
|
"timeout",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.notifyReceived,
|
c.notifyReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].NotifyReceived),
|
data[notifyReceived].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.notifySent,
|
c.notifySent,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].NotifySent),
|
data[notifySent].FirstValue,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.recursiveQueries,
|
c.recursiveQueries,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].RecursiveQueries),
|
data[recursiveQueries].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.recursiveQueryFailures,
|
c.recursiveQueryFailures,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].RecursiveQueryFailure),
|
data[recursiveQueryFailure].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.recursiveQuerySendTimeouts,
|
c.recursiveQuerySendTimeouts,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].RecursiveSendTimeOuts),
|
data[recursiveSendTimeOuts].FirstValue,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.queries,
|
c.queries,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].TCPQueryReceived),
|
data[tcpQueryReceived].FirstValue,
|
||||||
"tcp",
|
"tcp",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.queries,
|
c.queries,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].UDPQueryReceived),
|
data[udpQueryReceived].FirstValue,
|
||||||
"udp",
|
"udp",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.responses,
|
c.responses,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].TCPResponseSent),
|
data[tcpResponseSent].FirstValue,
|
||||||
"tcp",
|
"tcp",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.responses,
|
c.responses,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].UDPResponseSent),
|
data[udpResponseSent].FirstValue,
|
||||||
"udp",
|
"udp",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.unmatchedResponsesReceived,
|
c.unmatchedResponsesReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].UnmatchedResponsesReceived),
|
data[unmatchedResponsesReceived].FirstValue,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.winsQueries,
|
c.winsQueries,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].WINSLookupReceived),
|
data[winsLookupReceived].FirstValue,
|
||||||
"forward",
|
"forward",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.winsQueries,
|
c.winsQueries,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].WINSReverseLookupReceived),
|
data[winsReverseLookupReceived].FirstValue,
|
||||||
"reverse",
|
"reverse",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.winsResponses,
|
c.winsResponses,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].WINSResponseSent),
|
data[winsResponseSent].FirstValue,
|
||||||
"forward",
|
"forward",
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.winsResponses,
|
c.winsResponses,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].WINSReverseResponseSent),
|
data[winsReverseResponseSent].FirstValue,
|
||||||
"reverse",
|
"reverse",
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.secureUpdateFailures,
|
c.secureUpdateFailures,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].SecureUpdateFailure),
|
data[secureUpdateFailure].FirstValue,
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.secureUpdateReceived,
|
c.secureUpdateReceived,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(dst[0].SecureUpdateReceived),
|
data[secureUpdateReceived].FirstValue,
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user