From 31605b5096c8687012e4344ccb5f86b42ff1129b Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Tue, 7 Apr 2020 21:05:41 +0200 Subject: [PATCH 01/41] Update collector generator template --- tools/collector-generator/collector.template | 21 ++++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/tools/collector-generator/collector.template b/tools/collector-generator/collector.template index 41aec6ae..97a717ec 100644 --- a/tools/collector-generator/collector.template +++ b/tools/collector-generator/collector.template @@ -5,7 +5,7 @@ import ( "github.com/prometheus/common/log" ) func init() { - Factories["{{ .CollectorName | toLower }}"] = New{{ .CollectorName }}Collector + registerCollector("{{ .CollectorName | toLower }}", new{{ .CollectorName }}Collector) // TODO: Add any perflib dependencies here } // A {{ .CollectorName }}Collector is a Prometheus collector for WMI {{ .Class }} metrics type {{ .CollectorName }}Collector struct { @@ -13,8 +13,8 @@ type {{ .CollectorName }}Collector struct { {{ $m.Name }} *prometheus.Desc {{- end }} } -// New{{ .CollectorName }}Collector ... -func New{{ .CollectorName }}Collector() (Collector, error) { + +func new{{ .CollectorName }}Collector() (Collector, error) { const subsystem = "{{ .CollectorName | toLower }}" return &{{ .CollectorName }}Collector{ {{- range $m := .Members }} @@ -27,15 +27,7 @@ func New{{ .CollectorName }}Collector() (Collector, error) { {{- end }} }, nil } -// Collect sends the metric values for each metric -// to the provided prometheus Metric channel. -func (c *{{ .CollectorName }}Collector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { - if desc, err := c.collect(ch); err != nil { - log.Error("failed collecting {{ .CollectorName | toLower }} metrics:", desc, err) - return err - } - return nil -} + // {{ .Class }} docs: // - type {{ .Class }} struct { @@ -44,7 +36,10 @@ type {{ .Class }} struct { {{ $m.Name }} {{ $m.Type }} {{- end }} } -func (c *{{ .CollectorName }}Collector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + +// Collect sends the metric values for each metric +// to the provided prometheus Metric channel. +func (c *{{ .CollectorName }}Collector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { var dst []{{ .Class }} q := queryAll(&dst) if err := wmi.Query(q, &dst); err != nil { From 17324b9fc620c9c9b5b73ae7f01cdf7860592496 Mon Sep 17 00:00:00 2001 From: Ashok Siyani Date: Thu, 23 Apr 2020 11:17:17 +0100 Subject: [PATCH 02/41] add Terminal service & RemoteFx Collector (#491) --- README.md | 2 + collector/remote_fx.go | 351 ++++++++++++++++++++++++ collector/terminal_services.go | 403 ++++++++++++++++++++++++++++ docs/README.md | 2 + docs/collector.remote_fx.md | 51 ++++ docs/collector.terminal_services.md | 48 ++++ 6 files changed, 857 insertions(+) create mode 100644 collector/remote_fx.go create mode 100644 collector/terminal_services.go create mode 100644 docs/collector.remote_fx.md create mode 100644 docs/collector.terminal_services.md diff --git a/README.md b/README.md index f4e13c0f..af49e8c8 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,12 @@ Name | Description | Enabled by default [net](docs/collector.net.md) | Network interface I/O | ✓ [os](docs/collector.os.md) | OS metrics (memory, processes, users) | ✓ [process](docs/collector.process.md) | Per-process metrics | +[remote_fx](docs/collector.remote_fx.md) | RemoteFX protocol (RDP) metrics | [service](docs/collector.service.md) | Service state metrics | ✓ [system](docs/collector.system.md) | System calls | ✓ [tcp](docs/collector.tcp.md) | TCP connections | [thermalzone](docs/collector.thermalzone.md) | Thermal information +[terminal_services](docs/collector.terminal_services.md) | Terminal services (RDS) [textfile](docs/collector.textfile.md) | Read prometheus metrics from a text file | ✓ [vmware](docs/collector.vmware.md) | Performance counters installed by the Vmware Guest agent | diff --git a/collector/remote_fx.go b/collector/remote_fx.go new file mode 100644 index 00000000..f81066f7 --- /dev/null +++ b/collector/remote_fx.go @@ -0,0 +1,351 @@ +// +build windows + +package collector + +import ( + "strings" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" +) + +func init() { + registerCollector("remote_fx", NewRemoteFx, "RemoteFX Network", "RemoteFX Graphics") +} + +// A RemoteFxNetworkCollector is a Prometheus collector for +// WMI Win32_PerfRawData_Counters_RemoteFXNetwork & Win32_PerfRawData_Counters_RemoteFXGraphics metrics +// https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_remotefxnetwork/ +// https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_remotefxgraphics/ + +type RemoteFxCollector struct { + // net + BaseTCPRTT *prometheus.Desc + BaseUDPRTT *prometheus.Desc + CurrentTCPBandwidth *prometheus.Desc + CurrentTCPRTT *prometheus.Desc + CurrentUDPBandwidth *prometheus.Desc + CurrentUDPRTT *prometheus.Desc + TotalReceivedBytes *prometheus.Desc + TotalSentBytes *prometheus.Desc + UDPPacketsReceivedPersec *prometheus.Desc + UDPPacketsSentPersec *prometheus.Desc + + //gfx + AverageEncodingTime *prometheus.Desc + FrameQuality *prometheus.Desc + FramesSkippedPerSecondInsufficientResources *prometheus.Desc + GraphicsCompressionratio *prometheus.Desc + InputFramesPerSecond *prometheus.Desc + OutputFramesPerSecond *prometheus.Desc + SourceFramesPerSecond *prometheus.Desc +} + +// NewRemoteFx ... +func NewRemoteFx() (Collector, error) { + const subsystem = "remote_fx" + return &RemoteFxCollector{ + // net + BaseTCPRTT: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_base_tcp_rtt_seconds"), + "Base TCP round-trip time (RTT) detected in seconds", + []string{"session_name"}, + nil, + ), + BaseUDPRTT: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_base_udp_rtt_seconds"), + "Base UDP round-trip time (RTT) detected in seconds.", + []string{"session_name"}, + nil, + ), + CurrentTCPBandwidth: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_current_tcp_bandwidth"), + "TCP Bandwidth detected in bytes per seccond.", + []string{"session_name"}, + nil, + ), + CurrentTCPRTT: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_current_tcp_rtt_seconds"), + "Average TCP round-trip time (RTT) detected in seconds.", + []string{"session_name"}, + nil, + ), + CurrentUDPBandwidth: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_current_udp_bandwidth"), + "UDP Bandwidth detected in bytes per second.", + []string{"session_name"}, + nil, + ), + CurrentUDPRTT: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_current_udp_rtt_seconds"), + "Average UDP round-trip time (RTT) detected in seconds.", + []string{"session_name"}, + nil, + ), + TotalReceivedBytes: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_received_bytes_total"), + "(TotalReceivedBytes)", + []string{"session_name"}, + nil, + ), + TotalSentBytes: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_sent_bytes_total"), + "(TotalSentBytes)", + []string{"session_name"}, + nil, + ), + UDPPacketsReceivedPersec: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_udp_packets_received_total"), + "Rate in packets per second at which packets are received over UDP.", + []string{"session_name"}, + nil, + ), + UDPPacketsSentPersec: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "net_udp_packets_sent_total"), + "Rate in packets per second at which packets are sent over UDP.", + []string{"session_name"}, + nil, + ), + + //gfx + AverageEncodingTime: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "gfx_average_encoding_time_seconds"), + "Average frame encoding time in seconds", + []string{"session_name"}, + nil, + ), + FrameQuality: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "gfx_frame_quality"), + "Quality of the output frame expressed as a percentage of the quality of the source frame.", + []string{"session_name"}, + nil, + ), + FramesSkippedPerSecondInsufficientResources: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "gfx_frames_skipped_insufficient_resource_total"), + "Number of frames skipped per second due to insufficient client resources.", + []string{"session_name", "resource"}, + nil, + ), + GraphicsCompressionratio: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "gfx_graphics_compression_ratio"), + "Ratio of the number of bytes encoded to the number of bytes input.", + []string{"session_name"}, + nil, + ), + InputFramesPerSecond: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "gfx_input_frames_total"), + "Number of sources frames provided as input to RemoteFX graphics per second.", + []string{"session_name"}, + nil, + ), + OutputFramesPerSecond: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "gfx_output_frames_total"), + "Number of frames sent to the client per second.", + []string{"session_name"}, + nil, + ), + SourceFramesPerSecond: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "gfx_source_frames_total"), + "Number of frames composed by the source (DWM) per second.", + []string{"session_name"}, + nil, + ), + }, nil +} + +// Collect sends the metric values for each metric +// to the provided prometheus Metric channel. +func (c *RemoteFxCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + if desc, err := c.collectRemoteFXNetworkCount(ctx, ch); err != nil { + log.Error("failed collecting terminal services session count metrics:", desc, err) + return err + } + if desc, err := c.collectRemoteFXGraphicsCounters(ctx, ch); err != nil { + log.Error("failed collecting terminal services session count metrics:", desc, err) + return err + } + return nil +} + +type perflibRemoteFxNetwork struct { + Name string + BaseTCPRTT float64 `perflib:"Base TCP RTT"` + BaseUDPRTT float64 `perflib:"Base UDP RTT"` + CurrentTCPBandwidth float64 `perflib:"Current TCP Bandwidth"` + CurrentTCPRTT float64 `perflib:"Current TCP RTT"` + CurrentUDPBandwidth float64 `perflib:"Current UDP Bandwidth"` + CurrentUDPRTT float64 `perflib:"Current UDP RTT"` + TotalReceivedBytes float64 `perflib:"Total Received Bytes"` + TotalSentBytes float64 `perflib:"Total Sent Bytes"` + UDPPacketsReceivedPersec float64 `perflib:"UDP Packets Received/sec"` + UDPPacketsSentPersec float64 `perflib:"UDP Packets Sent/sec"` +} + +func (c *RemoteFxCollector) collectRemoteFXNetworkCount(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + dst := make([]perflibRemoteFxNetwork, 0) + err := unmarshalObject(ctx.perfObjects["RemoteFX Network"], &dst) + if err != nil { + return nil, err + } + + for _, d := range dst { + // only connect metrics for remote named sessions + n := strings.ToLower(d.Name) + if n == "" || n == "services" || n == "console" { + continue + } + ch <- prometheus.MustNewConstMetric( + c.BaseTCPRTT, + prometheus.GaugeValue, + milliSecToSec(d.BaseTCPRTT), + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.BaseUDPRTT, + prometheus.GaugeValue, + milliSecToSec(d.BaseUDPRTT), + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.CurrentTCPBandwidth, + prometheus.GaugeValue, + (d.CurrentTCPBandwidth*1000)/8, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.CurrentTCPRTT, + prometheus.GaugeValue, + milliSecToSec(d.CurrentTCPRTT), + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.CurrentUDPBandwidth, + prometheus.GaugeValue, + (d.CurrentUDPBandwidth*1000)/8, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.CurrentUDPRTT, + prometheus.GaugeValue, + milliSecToSec(d.CurrentUDPRTT), + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.TotalReceivedBytes, + prometheus.CounterValue, + d.TotalReceivedBytes, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.TotalSentBytes, + prometheus.CounterValue, + d.TotalSentBytes, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.UDPPacketsReceivedPersec, + prometheus.CounterValue, + d.UDPPacketsReceivedPersec, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.UDPPacketsSentPersec, + prometheus.CounterValue, + d.UDPPacketsSentPersec, + d.Name, + ) + } + return nil, nil +} + +type perflibRemoteFxGraphics struct { + Name string + AverageEncodingTime float64 `perflib:"Average Encoding Time"` + FrameQuality float64 `perflib:"Frame Quality"` + FramesSkippedPerSecondInsufficientClientResources float64 `perflib:"Frames Skipped/Second - Insufficient Server Resources"` + FramesSkippedPerSecondInsufficientNetworkResources float64 `perflib:"Frames Skipped/Second - Insufficient Network Resources"` + FramesSkippedPerSecondInsufficientServerResources float64 `perflib:"Frames Skipped/Second - Insufficient Client Resources"` + GraphicsCompressionratio float64 `perflib:"Graphics Compression ratio"` + InputFramesPerSecond float64 `perflib:"Input Frames/Second"` + OutputFramesPerSecond float64 `perflib:"Output Frames/Second"` + SourceFramesPerSecond float64 `perflib:"Source Frames/Second"` +} + +func (c *RemoteFxCollector) collectRemoteFXGraphicsCounters(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + dst := make([]perflibRemoteFxGraphics, 0) + err := unmarshalObject(ctx.perfObjects["RemoteFX Graphics"], &dst) + if err != nil { + return nil, err + } + + for _, d := range dst { + // only connect metrics for remote named sessions + n := strings.ToLower(d.Name) + if n == "" || n == "services" || n == "console" { + continue + } + ch <- prometheus.MustNewConstMetric( + c.AverageEncodingTime, + prometheus.GaugeValue, + milliSecToSec(d.AverageEncodingTime), + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.FrameQuality, + prometheus.GaugeValue, + d.FrameQuality, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.FramesSkippedPerSecondInsufficientResources, + prometheus.CounterValue, + d.FramesSkippedPerSecondInsufficientClientResources, + d.Name, + "client", + ) + ch <- prometheus.MustNewConstMetric( + c.FramesSkippedPerSecondInsufficientResources, + prometheus.CounterValue, + d.FramesSkippedPerSecondInsufficientNetworkResources, + d.Name, + "network", + ) + ch <- prometheus.MustNewConstMetric( + c.FramesSkippedPerSecondInsufficientResources, + prometheus.CounterValue, + d.FramesSkippedPerSecondInsufficientServerResources, + d.Name, + "server", + ) + ch <- prometheus.MustNewConstMetric( + c.GraphicsCompressionratio, + prometheus.GaugeValue, + d.GraphicsCompressionratio, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.InputFramesPerSecond, + prometheus.CounterValue, + d.InputFramesPerSecond, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.OutputFramesPerSecond, + prometheus.CounterValue, + d.OutputFramesPerSecond, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.SourceFramesPerSecond, + prometheus.CounterValue, + d.SourceFramesPerSecond, + d.Name, + ) + } + + return nil, nil +} + +func milliSecToSec(t float64) float64 { + return t / 1000 +} diff --git a/collector/terminal_services.go b/collector/terminal_services.go new file mode 100644 index 00000000..1d02d97a --- /dev/null +++ b/collector/terminal_services.go @@ -0,0 +1,403 @@ +// +build windows + +package collector + +import ( + "errors" + "strings" + + "github.com/StackExchange/wmi" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" +) + +const ConnectionBrokerFeatureID uint32 = 133 + +func init() { + registerCollector("terminal_services", NewTerminalServicesCollector, "Terminal Services", "Terminal Services Session", "Remote Desktop Connection Broker Counterset") +} + +var ( + connectionBrokerEnabled = isConnectionBrokerServer() +) + +type Win32_ServerFeature struct { + ID uint32 +} + +func isConnectionBrokerServer() bool { + var dst []Win32_ServerFeature + q := queryAll(&dst) + if err := wmi.Query(q, &dst); err != nil { + return false + } + for _, d := range dst { + if d.ID == ConnectionBrokerFeatureID { + return true + } + } + log.Debug("host is not a connection broker skipping Connection Broker performance metrics.") + return false +} + +// A TerminalServicesCollector is a Prometheus collector for WMI +// Win32_PerfRawData_LocalSessionManager_TerminalServices & Win32_PerfRawData_TermService_TerminalServicesSession metrics +// https://docs.microsoft.com/en-us/previous-versions/aa394344(v%3Dvs.85) +// https://wutils.com/wmi/root/cimv2/win32_perfrawdata_localsessionmanager_terminalservices/ +type TerminalServicesCollector struct { + LocalSessionCount *prometheus.Desc + ConnectionBrokerPerformance *prometheus.Desc + HandleCount *prometheus.Desc + PageFaultsPersec *prometheus.Desc + PageFileBytes *prometheus.Desc + PageFileBytesPeak *prometheus.Desc + PercentPrivilegedTime *prometheus.Desc + PercentProcessorTime *prometheus.Desc + PercentUserTime *prometheus.Desc + PoolNonpagedBytes *prometheus.Desc + PoolPagedBytes *prometheus.Desc + PrivateBytes *prometheus.Desc + ThreadCount *prometheus.Desc + VirtualBytes *prometheus.Desc + VirtualBytesPeak *prometheus.Desc + WorkingSet *prometheus.Desc + WorkingSetPeak *prometheus.Desc +} + +// NewTerminalServicesCollector ... +func NewTerminalServicesCollector() (Collector, error) { + const subsystem = "terminal_services" + return &TerminalServicesCollector{ + LocalSessionCount: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "local_session_count"), + "Number of Terminal Services sessions", + []string{"session"}, + nil, + ), + ConnectionBrokerPerformance: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "connection_broker_performance_total"), + "The total number of connections handled by the Connection Brokers since the service started.", + []string{"connection"}, + nil, + ), + HandleCount: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "handle_count"), + "Total number of handles currently opened by this process. This number is the sum of the handles currently opened by each thread in this process.", + []string{"session_name"}, + nil, + ), + PageFaultsPersec: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "page_fault_total"), + "Rate at which page faults occur in the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. The page may not be retrieved from disk if it is on the standby list and therefore already in main memory. The page also may not be retrieved if it is in use by another process which shares the page.", + []string{"session_name"}, + nil, + ), + PageFileBytes: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "page_file_bytes"), + "Current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory.", + []string{"session_name"}, + nil, + ), + PageFileBytesPeak: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "page_file_bytes_peak"), + "Maximum number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory.", + []string{"session_name"}, + nil, + ), + PercentPrivilegedTime: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "privileged_time_seconds_total"), + "Total elapsed time that the threads of the process have spent executing code in privileged mode.", + []string{"session_name"}, + nil, + ), + PercentProcessorTime: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "processor_time_seconds_total"), + "Total elapsed time that all of the threads of this process used the processor to execute instructions.", + []string{"session_name"}, + nil, + ), + PercentUserTime: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "user_time_seconds_total"), + "Total elapsed time that this process's threads have spent executing code in user mode. Applications, environment subsystems, and integral subsystems execute in user mode.", + []string{"session_name"}, + nil, + ), + PoolNonpagedBytes: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "pool_non_paged_bytes"), + "Number of bytes in the non-paged pool, an area of system memory (physical memory used by the operating system) for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated. This property displays the last observed value only; it is not an average.", + []string{"session_name"}, + nil, + ), + PoolPagedBytes: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "pool_paged_bytes"), + "Number of bytes in the paged pool, an area of system memory (physical memory used by the operating system) for objects that can be written to disk when they are not being used. This property displays the last observed value only; it is not an average.", + []string{"session_name"}, + nil, + ), + PrivateBytes: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "private_bytes"), + "Current number of bytes this process has allocated that cannot be shared with other processes.", + []string{"session_name"}, + nil, + ), + ThreadCount: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "thread_count"), + "Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread.", + []string{"session_name"}, + nil, + ), + VirtualBytes: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "virtual_bytes"), + "Current size, in bytes, of the virtual address space the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries.", + []string{"session_name"}, + nil, + ), + VirtualBytesPeak: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "virtual_bytes_peak"), + "Maximum number of bytes of virtual address space the process has used at any one time. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process might limit its ability to load libraries.", + []string{"session_name"}, + nil, + ), + WorkingSet: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "working_set_bytes"), + "Current number of bytes in the working set of this process. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory.", + []string{"session_name"}, + nil, + ), + WorkingSetPeak: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "working_set_bytes_peak"), + "Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory.", + []string{"session_name"}, + nil, + ), + }, nil +} + +// Collect sends the metric values for each metric +// to the provided prometheus Metric channel. +func (c *TerminalServicesCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + if desc, err := c.collectTSSessionCount(ctx, ch); err != nil { + log.Error("failed collecting terminal services session count metrics:", desc, err) + return err + } + if desc, err := c.collectTSSessionCounters(ctx, ch); err != nil { + log.Error("failed collecting terminal services session count metrics:", desc, err) + return err + } + + // only collect CollectionBrokerPerformance if host is a Connection Broker + if connectionBrokerEnabled { + if desc, err := c.collectCollectionBrokerPerformanceCounter(ctx, ch); err != nil { + log.Error("failed collecting Connection Broker performance metrics:", desc, err) + return err + } + } + return nil +} + +type perflibTerminalServices struct { + ActiveSessions float64 `perflib:"Active Sessions"` + InactiveSessions float64 `perflib:"Inactive Sessions"` + TotalSessions float64 `perflib:"Total Sessions"` +} + +func (c *TerminalServicesCollector) collectTSSessionCount(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + dst := make([]perflibTerminalServices, 0) + err := unmarshalObject(ctx.perfObjects["Terminal Services"], &dst) + if err != nil { + return nil, err + } + if len(dst) == 0 { + return nil, errors.New("WMI query returned empty result set") + } + + ch <- prometheus.MustNewConstMetric( + c.LocalSessionCount, + prometheus.GaugeValue, + dst[0].ActiveSessions, + "active", + ) + + ch <- prometheus.MustNewConstMetric( + c.LocalSessionCount, + prometheus.GaugeValue, + dst[0].InactiveSessions, + "inactive", + ) + + ch <- prometheus.MustNewConstMetric( + c.LocalSessionCount, + prometheus.GaugeValue, + dst[0].TotalSessions, + "total", + ) + + return nil, nil +} + +type perflibTerminalServicesSession struct { + Name string + HandleCount float64 `perflib:"Handle Count"` + PageFaultsPersec float64 `perflib:"Page Faults/sec"` + PageFileBytes float64 `perflib:"Page File Bytes"` + PageFileBytesPeak float64 `perflib:"Page File Bytes Peak"` + PercentPrivilegedTime float64 `perflib:"% Privileged Time"` + PercentProcessorTime float64 `perflib:"% Processor Time"` + PercentUserTime float64 `perflib:"% User Time"` + PoolNonpagedBytes float64 `perflib:"Pool Nonpaged Bytes"` + PoolPagedBytes float64 `perflib:"Pool Paged Bytes"` + PrivateBytes float64 `perflib:"Private Bytes"` + ThreadCount float64 `perflib:"Thread Count"` + VirtualBytes float64 `perflib:"Virtual Bytes"` + VirtualBytesPeak float64 `perflib:"Virtual Bytes Peak"` + WorkingSet float64 `perflib:"Working Set"` + WorkingSetPeak float64 `perflib:"Working Set Peak"` +} + +func (c *TerminalServicesCollector) collectTSSessionCounters(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + dst := make([]perflibTerminalServicesSession, 0) + err := unmarshalObject(ctx.perfObjects["Terminal Services Session"], &dst) + if err != nil { + return nil, err + } + + for _, d := range dst { + // only connect metrics for remote named sessions + n := strings.ToLower(d.Name) + if n == "" || n == "services" || n == "console" { + continue + } + ch <- prometheus.MustNewConstMetric( + c.HandleCount, + prometheus.GaugeValue, + d.HandleCount, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PageFaultsPersec, + prometheus.CounterValue, + d.PageFaultsPersec, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PageFileBytes, + prometheus.GaugeValue, + d.PageFileBytes, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PageFileBytesPeak, + prometheus.GaugeValue, + d.PageFileBytesPeak, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PercentPrivilegedTime, + prometheus.CounterValue, + d.PercentPrivilegedTime, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PercentProcessorTime, + prometheus.CounterValue, + d.PercentProcessorTime, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PercentUserTime, + prometheus.CounterValue, + d.PercentUserTime, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PoolNonpagedBytes, + prometheus.GaugeValue, + d.PoolNonpagedBytes, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PoolPagedBytes, + prometheus.GaugeValue, + d.PoolPagedBytes, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.PrivateBytes, + prometheus.GaugeValue, + d.PrivateBytes, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.ThreadCount, + prometheus.GaugeValue, + d.ThreadCount, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.VirtualBytes, + prometheus.GaugeValue, + d.VirtualBytes, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.VirtualBytesPeak, + prometheus.GaugeValue, + d.VirtualBytesPeak, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.WorkingSet, + prometheus.GaugeValue, + d.WorkingSet, + d.Name, + ) + ch <- prometheus.MustNewConstMetric( + c.WorkingSetPeak, + prometheus.GaugeValue, + d.WorkingSetPeak, + d.Name, + ) + } + return nil, nil +} + +type perflibRemoteDesktopConnectionBrokerCounterset struct { + SuccessfulConnections float64 `perflib:"Successful Connections"` + PendingConnections float64 `perflib:"Pending Connections"` + FailedConnections float64 `perflib:"Failed Connections"` +} + +func (c *TerminalServicesCollector) collectCollectionBrokerPerformanceCounter(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + + dst := make([]perflibRemoteDesktopConnectionBrokerCounterset, 0) + err := unmarshalObject(ctx.perfObjects["Remote Desktop Connection Broker Counterset"], &dst) + if err != nil { + return nil, err + } + if len(dst) == 0 { + return nil, errors.New("WMI query returned empty result set") + } + + ch <- prometheus.MustNewConstMetric( + c.ConnectionBrokerPerformance, + prometheus.CounterValue, + dst[0].SuccessfulConnections, + "Successful", + ) + + ch <- prometheus.MustNewConstMetric( + c.ConnectionBrokerPerformance, + prometheus.CounterValue, + dst[0].PendingConnections, + "Pending", + ) + + ch <- prometheus.MustNewConstMetric( + c.ConnectionBrokerPerformance, + prometheus.CounterValue, + dst[0].FailedConnections, + "Failed", + ) + + return nil, nil +} diff --git a/docs/README.md b/docs/README.md index 07d3bce4..8dd35904 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,8 +25,10 @@ This directory contains documentation of the collectors in the WMI exporter, wit - [`net`](collector.net.md) - [`os`](collector.os.md) - [`process`](collector.process.md) +- [`remote_fx`](collector.remote_fx.md) - [`service`](collector.service.md) - [`system`](collector.system.md) - [`tcp`](collector.tcp.md) +- [`terminal_services`](collector.terminal_services.md) - [`textfile`](collector.textfile.md) - [`vmware`](collector.vmware.md) diff --git a/docs/collector.remote_fx.md b/docs/collector.remote_fx.md new file mode 100644 index 00000000..6b16f2ec --- /dev/null +++ b/docs/collector.remote_fx.md @@ -0,0 +1,51 @@ +# remote_fx collector + +The remote_fx collector exposes Performance Counters regarding the RemoteFX protocol (RDP). It exposes both network and graphics related performance counters. + +||| +-|- +Metric name prefix | `remote_fx` +Data source | Perflib +Classes | [`Win32_PerfRawData_Counters_RemoteFXNetwork`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_remotefxnetwork/), [`Win32_PerfRawData_Counters_RemoteFXGraphics`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_remotefxgraphics), [more info...](https://docs.microsoft.com/en-us/azure/virtual-desktop/remotefx-graphics-performance-counters) +Enabled by default? | No + + +## Flags + +None + +## Metrics (Network) + +Name | Description | Type | Labels +-----|-------------|------|------- +`wmi_remote_fx_net_base_udp_rtt_seconds` | Base UDP round-trip time (RTT) detected in seconds. | gauge | `session_name` +`wmi_remote_fx_net_base_tcp_rtt_seconds` | Base TCP round-trip time (RTT) detected in seconds. | gauge | `session_name` +`wmi_remote_fx_net_current_tcp_bandwidth` | TCP Bandwidth detected in bytes per second. | gauge | `session_name` +`wmi_remote_fx_net_current_tcp_rtt_seconds` | Average TCP round-trip time (RTT) detected in seconds. | gauge | `session_name` +`wmi_remote_fx_net_current_udp_bandwidth` | UDP Bandwidth detected in bytes per second. | gauge | `session_name` +`wmi_remote_fx_net_current_udp_rtt_seconds` | Average UDP round-trip time (RTT) detected in seconds. | gauge | `session_name` +`wmi_remote_fx_net_received_bytes_total` | _Not yet documented_ | counter | `session_name` +`wmi_remote_fx_net_sent_bytes_total` | _Not yet documented_ | counter | `session_name` +`wmi_remote_fx_net_udp_packets_received_total` | Rate in packets per second at which packets are received over UDP. | counter | `session_name` +`wmi_remote_fx_net_udp_packets_sent_total` | Rate in packets per second at which packets are sent over UDP. | counter | `session_name` + +## Metrics (Graphics) + +Name | Description | Type | Labels +-----|-------------|------|------- +`wmi_remote_fx_gfx_average_encoding_time_seconds` | Average frame encoding time. | gauge | `session_name` +`wmi_remote_fx_gfx_frame_quality` | Quality of the output frame expressed as a percentage of the quality of the source frame. | gauge | `session_name` +`wmi_remote_fx_gfx_frames_skipped_insufficient_resource_total` | Number of frames skipped per second due to insufficient resources. resources are client, server or network. | counter | `session_name`, `resource` +`wmi_remote_fx_gfx_graphics_compression_ratio` | Ratio of the number of bytes encoded to the number of bytes input. | gauge | `session_name` +`wmi_remote_fx_gfx_input_frames_total` | Number of sources frames provided as input to RemoteFX graphics per second. | counter | `session_name` +`wmi_remote_fx_gfx_output_frames_total` | Number of frames sent to the client per second. | counter | `session_name` +`wmi_remote_fx_gfx_source_frames_total` | Number of frames composed by the source (DWM) per second. | counter | `session_name` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.terminal_services.md b/docs/collector.terminal_services.md new file mode 100644 index 00000000..ca197c51 --- /dev/null +++ b/docs/collector.terminal_services.md @@ -0,0 +1,48 @@ +# terminal_services collector + +The terminal_services collector exposes terminal services (Remote Desktop Services) performance metrics. + +||| +-|- +Metric name prefix | `terminal_services` +Data source | Perflib/WMI +Classes | [`Win32_PerfRawData_LocalSessionManager_TerminalServices`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_localsessionmanager_terminalservices/), [`Win32_PerfRawData_TermService_TerminalServicesSession`](https://docs.microsoft.com/en-us/previous-versions/aa394344(v%3Dvs.85)), [`Win32_PerfRawData_RemoteDesktopConnectionBrokerPerformanceCounterProvider_RemoteDesktopConnectionBrokerCounterset`](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/mt729067(v%3Dws.11)) +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`wmi_terminal_services_local_session_count` | Number of local Terminal Services sessions. | gauge | `session` +`wmi_terminal_services_connection_broker_performance_total`* | The total number of connections handled by the Connection Brokers since the service started. | counter | `connection` +`wmi_terminal_services_handle_count` | Total number of handles currently opened by this process. This number is the sum of the handles currently opened by each thread in this process. | gauge | `session_name` +`wmi_terminal_services_page_fault_total` | Rate at which page faults occur in the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. The page may not be retrieved from disk if it is on the standby list and therefore already in main memory. The page also may not be retrieved if it is in use by another process which shares the page. | counter | `session_name` +`wmi_terminal_services_page_file_bytes` | Current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory. | gauge | `session_name` +`wmi_terminal_services_page_file_bytes_peak` | Maximum number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory. | gauge | `session_name` +`wmi_terminal_services_privileged_time_seconds_total` | total elapsed time that the threads of the process have spent executing code in privileged mode. | Counter | `session_name` +`wmi_terminal_services_processor_time_seconds_total` | total elapsed time that all of the threads of this process used the processor to execute instructions. | Counter | `session_name` +`wmi_terminal_services_user_time_seconds_total` | total elapsed time that this process's threads have spent executing code in user mode. Applications, environment subsystems, and integral subsystems execute in user mode. | Counter | `session_name` +`wmi_terminal_services_pool_non_paged_bytes` | Number of bytes in the non-paged pool, an area of system memory (physical memory used by the operating system) for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated. This property displays the last observed value only; it is not an average. | gauge | `session_name` +`wmi_terminal_services_pool_paged_bytes` | Number of bytes in the paged pool, an area of system memory (physical memory used by the operating system) for objects that can be written to disk when they are not being used. This property displays the last observed value only; it is not an average. | gauge | `session_name` +`wmi_terminal_services_private_bytes` | Current number of bytes this process has allocated that cannot be shared with other processes. | gauge | `session_name` +`wmi_terminal_services_thread_count` | Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread. | gauge | `session_name` +`wmi_terminal_services_virtual_bytes` | Current size, in bytes, of the virtual address space the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries. | gauge | `session_name` +`wmi_terminal_services_virtual_bytes_peak` | Maximum number of bytes of virtual address space the process has used at any one time. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process might limit its ability to load libraries. | gauge | `session_name` +`wmi_terminal_services_working_set_bytes` | Current number of bytes in the working set of this process. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `session_name` +`wmi_terminal_services_working_set_bytes_peak` | Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `session_name` + +`* wmi_terminal_services_connection_broker_performance_total` only collected if server has `Remote Desktop Connection Broker` role. + + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ From 05d1e4bde9e1ca01a1bec1b1f46061fea5ad03b4 Mon Sep 17 00:00:00 2001 From: Ben Reedy Date: Wed, 15 Jan 2020 16:00:40 +1000 Subject: [PATCH 03/41] Add dhcp collector Unfortunately perflib does not expose scope statistics (DhcpServerv4ScopeStatistics), and WMI queries to this class don't appear to be possible with the stackexchange/wmi module. --- collector/dhcp.go | 387 +++++++++++++++++++++++++++++++++++++++++ docs/README.md | 1 + docs/collector.dhcp.md | 53 ++++++ 3 files changed, 441 insertions(+) create mode 100644 collector/dhcp.go create mode 100644 docs/collector.dhcp.md diff --git a/collector/dhcp.go b/collector/dhcp.go new file mode 100644 index 00000000..3820a07b --- /dev/null +++ b/collector/dhcp.go @@ -0,0 +1,387 @@ +// +build windows + +package collector + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +func init() { + registerCollector("dhcp", NewDhcpCollector, "DHCP Server") +} + +// A DhcpCollector is a Prometheus collector perflib DHCP metrics +type DhcpCollector struct { + PacketsReceivedTotal *prometheus.Desc + DuplicatesDroppedTotal *prometheus.Desc + PacketsExpiredTotal *prometheus.Desc + ActiveQueueLength *prometheus.Desc + ConflictCheckQueueLength *prometheus.Desc + DiscoversTotal *prometheus.Desc + OffersTotal *prometheus.Desc + RequestsTotal *prometheus.Desc + InformsTotal *prometheus.Desc + AcksTotal *prometheus.Desc + NacksTotal *prometheus.Desc + DeclinesTotal *prometheus.Desc + ReleasesTotal *prometheus.Desc + OfferQueueLength *prometheus.Desc + DeniedDueToMatch *prometheus.Desc + DeniedDueToNonMatch *prometheus.Desc + FailoverBndupdSentTotal *prometheus.Desc + FailoverBndupdReceivedTotal *prometheus.Desc + FailoverBndackSentTotal *prometheus.Desc + FailoverBndackReceivedTotal *prometheus.Desc + FailoverBndupdPendingOutboundQueue *prometheus.Desc + FailoverTransitionsCommunicationinterruptedState *prometheus.Desc + FailoverTransitionsPartnerdownState *prometheus.Desc + FailoverTransitionsRecoverState *prometheus.Desc + FailoverBndupdDropped *prometheus.Desc +} + +func NewDhcpCollector() (Collector, error) { + const subsystem = "dhcp" + + return &DhcpCollector{ + PacketsReceivedTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "packets_received_total"), + "Total number of packets received by the DHCP server (PacketsReceivedTotal)", + nil, + nil, + ), + DuplicatesDroppedTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "duplicates_dropped_total"), + "Total number of duplicate packets received by the DHCP server (DuplicatesDroppedTotal)", + nil, + nil, + ), + PacketsExpiredTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "packets_expired_total"), + "Total number of packets expired in the DHCP server message queue (PacketsExpiredTotal)", + nil, + nil, + ), + ActiveQueueLength: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "active_queue_length"), + "Number of packets in the processing queue of the DHCP server (ActiveQueueLength)", + nil, + nil, + ), + ConflictCheckQueueLength: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "conflict_check_queue_length"), + "Number of packets in the DHCP server queue waiting on conflict detection (ping). (ConflictCheckQueueLength)", + nil, + nil, + ), + DiscoversTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "discovers_total"), + "Total DHCP Discovers received by the DHCP server (DiscoversTotal)", + nil, + nil, + ), + OffersTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "offers_total"), + "Total DHCP Offers sent by the DHCP server (OffersTotal)", + nil, + nil, + ), + RequestsTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "requests_total"), + "Total DHCP Requests received by the DHCP server (RequestsTotal)", + nil, + nil, + ), + InformsTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "informs_total"), + "Total DHCP Informs received by the DHCP server (InformsTotal)", + nil, + nil, + ), + AcksTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "acks_total"), + "Total DHCP Acks sent by the DHCP server (AcksTotal)", + nil, + nil, + ), + NacksTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "nacks_total"), + "Total DHCP Nacks sent by the DHCP server (NacksTotal)", + nil, + nil, + ), + DeclinesTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "declines_total"), + "Total DHCP Declines received by the DHCP server (DeclinesTotal)", + nil, + nil, + ), + ReleasesTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "releases_total"), + "Total DHCP Releases received by the DHCP server (ReleasesTotal)", + nil, + nil, + ), + OfferQueueLength: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "offer_queue_length"), + "Number of packets in the offer queue of the DHCP server (OfferQueueLength)", + nil, + nil, + ), + DeniedDueToMatch: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "denied_due_to_match_total"), + "Total number of DHCP requests denied, based on matches from the Deny list (DeniedDueToMatch)", + nil, + nil, + ), + DeniedDueToNonMatch: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "denied_due_to_match_total"), + "Total number of DHCP requests denied, based on non-matches from the Allow list (DeniedDueToNonMatch)", + nil, + nil, + ), + FailoverBndupdSentTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_bndupd_sent_total"), + "Number of DHCP failover Binding Update messages sent (FailoverBndupdSentTotal)", + nil, + nil, + ), + FailoverBndupdReceivedTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_bndupd_received_total"), + "Number of DHCP failover Binding Update messages received (FailoverBndupdReceivedTotal)", + nil, + nil, + ), + FailoverBndackSentTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_bndack_sent_total"), + "Number of DHCP failover Binding Ack messages sent (FailoverBndackSentTotal)", + nil, + nil, + ), + FailoverBndackReceivedTotal: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_bndack_received_total"), + "Number of DHCP failover Binding Ack messages received (FailoverBndackReceivedTotal)", + nil, + nil, + ), + FailoverBndupdPendingOutboundQueue: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_bndupd_pending_in_outbound_queue"), + "Number of pending outbound DHCP failover Binding Update messages (FailoverBndupdPendingOutboundQueue)", + nil, + nil, + ), + FailoverTransitionsCommunicationinterruptedState: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_transitions_communicationinterrupted_state_total"), + "Total number of transitions into COMMUNICATION INTERRUPTED state (FailoverTransitionsCommunicationinterruptedState)", + nil, + nil, + ), + FailoverTransitionsPartnerdownState: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_transitions_partnerdown_state_total"), + "Total number of transitions into PARTNER DOWN state (FailoverTransitionsPartnerdownState)", + nil, + nil, + ), + FailoverTransitionsRecoverState: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_transitions_recover_total"), + "Total number of transitions into RECOVER state (FailoverTransitionsRecoverState)", + nil, + nil, + ), + FailoverBndupdDropped: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "failover_bndupd_dropped_total"), + "Total number of DHCP faileover Binding Updates dropped (FailoverBndupdDropped)", + nil, + nil, + ), + }, nil +} + +// represents perflib metrics from the DHCP Server class. +// While the name of a number of perflib metrics would indicate a rate is being returned (E.G. Packets Received/sec), +// perflib instead returns a counter, hence the "Total" suffix in some of the variable names. +type dhcpPerf struct { + PacketsReceivedTotal float64 `perflib:"Packets Received/sec"` + DuplicatesDroppedTotal float64 `perflib:"Duplicates Dropped/sec"` + PacketsExpiredTotal float64 `perflib:"Packets Expired/sec"` + ActiveQueueLength float64 `perflib:"Active Queue Length"` + ConflictCheckQueueLength float64 `perflib:"Conflict Check Queue Length"` + DiscoversTotal float64 `perflib:"Discovers/sec"` + OffersTotal float64 `perflib:"Offers/sec"` + RequestsTotal float64 `perflib:"Requests/sec"` + InformsTotal float64 `perflib:"Informs/sec"` + AcksTotal float64 `perflib:"Acks/sec"` + NacksTotal float64 `perflib:"Nacks/sec"` + DeclinesTotal float64 `perflib:"Declines/sec"` + ReleasesTotal float64 `perflib:"Releases/sec"` + DeniedDueToMatch float64 `perflib:"Denied due to match."` + DeniedDueToNonMatch float64 `perflib:"Denied due to match."` + OfferQueueLength float64 `perflib:"Offer Queue Length"` + FailoverBndupdSentTotal float64 `perflib:"Failover: BndUpd sent/sec."` + FailoverBndupdReceivedTotal float64 `perflib:"Failover: BndUpd received/sec."` + FailoverBndackSentTotal float64 `perflib:"Failover: BndAck sent/sec."` + FailoverBndackReceivedTotal float64 `perflib:"Failover: BndAck received/sec."` + FailoverBndupdPendingOutboundQueue float64 `perflib:"Failover: BndUpd pending in outbound queue."` + FailoverTransitionsCommunicationinterruptedState float64 `perflib:"Failover: Transitions to COMMUNICATION-INTERRUPTED state."` + FailoverTransitionsPartnerdownState float64 `perflib:"Failover: Transitions to PARTNER-DOWN state."` + FailoverTransitionsRecoverState float64 `perflib:"Failover: Transitions to RECOVER state."` + FailoverBndupdDropped float64 `perflib:"Failover: BndUpd Dropped."` +} + +func (c *DhcpCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var perflib []dhcpPerf + if err := unmarshalObject(ctx.perfObjects["DHCP Server"], &perflib); err != nil { + return err + } + + ch <- prometheus.MustNewConstMetric( + c.PacketsReceivedTotal, + prometheus.CounterValue, + perflib[0].PacketsReceivedTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.DuplicatesDroppedTotal, + prometheus.CounterValue, + perflib[0].DuplicatesDroppedTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.PacketsExpiredTotal, + prometheus.CounterValue, + perflib[0].PacketsExpiredTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.ActiveQueueLength, + prometheus.GaugeValue, + perflib[0].ActiveQueueLength, + ) + + ch <- prometheus.MustNewConstMetric( + c.ConflictCheckQueueLength, + prometheus.GaugeValue, + perflib[0].ConflictCheckQueueLength, + ) + + ch <- prometheus.MustNewConstMetric( + c.DiscoversTotal, + prometheus.CounterValue, + perflib[0].DiscoversTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.OffersTotal, + prometheus.CounterValue, + perflib[0].OffersTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.RequestsTotal, + prometheus.CounterValue, + perflib[0].RequestsTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.InformsTotal, + prometheus.CounterValue, + perflib[0].InformsTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.AcksTotal, + prometheus.CounterValue, + perflib[0].AcksTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.NacksTotal, + prometheus.CounterValue, + perflib[0].NacksTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.DeclinesTotal, + prometheus.CounterValue, + perflib[0].DeclinesTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.ReleasesTotal, + prometheus.CounterValue, + perflib[0].ReleasesTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.OfferQueueLength, + prometheus.GaugeValue, + perflib[0].OfferQueueLength, + ) + + ch <- prometheus.MustNewConstMetric( + c.DeniedDueToMatch, + prometheus.CounterValue, + perflib[0].DeniedDueToMatch, + ) + + ch <- prometheus.MustNewConstMetric( + c.DeniedDueToNonMatch, + prometheus.CounterValue, + perflib[0].DeniedDueToNonMatch, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverBndupdSentTotal, + prometheus.CounterValue, + perflib[0].FailoverBndupdSentTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverBndupdReceivedTotal, + prometheus.CounterValue, + perflib[0].FailoverBndupdReceivedTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverBndackSentTotal, + prometheus.CounterValue, + perflib[0].FailoverBndackSentTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverBndackReceivedTotal, + prometheus.CounterValue, + perflib[0].FailoverBndackReceivedTotal, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverBndupdPendingOutboundQueue, + prometheus.GaugeValue, + perflib[0].FailoverBndupdPendingOutboundQueue, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverTransitionsCommunicationinterruptedState, + prometheus.CounterValue, + perflib[0].FailoverTransitionsCommunicationinterruptedState, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverTransitionsPartnerdownState, + prometheus.CounterValue, + perflib[0].FailoverTransitionsPartnerdownState, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverTransitionsRecoverState, + prometheus.CounterValue, + perflib[0].FailoverTransitionsRecoverState, + ) + + ch <- prometheus.MustNewConstMetric( + c.FailoverBndupdDropped, + prometheus.CounterValue, + perflib[0].FailoverBndupdDropped, + ) + + return nil +} diff --git a/docs/README.md b/docs/README.md index 07d3bce4..1284cc07 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,6 +6,7 @@ This directory contains documentation of the collectors in the WMI exporter, wit - [`adfs`](collector.adfs.md) - [`cpu`](collector.cpu.md) - [`cs`](collector.cs.md) +- [`dhcp`](collector.dhcp.md) - [`dns`](collector.dns.md) - [`hyperv`](collector.hyperv.md) - [`iis`](collector.iis.md) diff --git a/docs/collector.dhcp.md b/docs/collector.dhcp.md new file mode 100644 index 00000000..01d369a6 --- /dev/null +++ b/docs/collector.dhcp.md @@ -0,0 +1,53 @@ +# dhcp collector + +The dhcp collector exposes DHCP Server metrics + +||| +-|- +Metric name prefix | `dhcp` +Data source | Perflib +Classes | `DHCP Server` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`packets_received_total` | Total number of packets received by the DHCP server | counter | None +`duplicates_dropped_total` | Total number of duplicate packets received by the DHCP server | counter | None +`packets_expired_total` | Total number of packets expired in the DHCP server message queue | counter | None +`active_queue_length` | Number of packets in the processing queue of the DHCP server | gauge | None +`conflict_check_queue_length` | Number of packets in the DHCP server queue waiting on conflict detection (ping) | gauge | None +`discovers_total` | Total DHCP Discovers received by the DHCP server | counter | None +`offers_total` | Total DHCP Offers sent by the DHCP server | counter | None +`requests_total` | Total DHCP Requests received by the DHCP server | counter | None +`informs_total` | Total DHCP Informs received by the DHCP server | counter | None +`acks_total` | Total DHCP Acks sent by the DHCP server | counter | None +`nacks_total` | Total DHCP Nacks sent by the DHCP server | counter | None +`declines_total` | Total DHCP Declines received by the DHCP server | counter | None +`releases_total` | Total DHCP Releases received by the DHCP server | counter | None +`offer_queue_length` | Number of packets in the offer queue of the DHCP server | gauge | None +`denied_due_to_match_total` | Total number of DHCP requests denied, based on matches from the Deny List | gauge | None +`denied_due_to_nonmatch_total` | Total number of DHCP requests denied, based on non-matches from the Allow List | gauge | None +`failover_bndupd_sent_total` | Number of DHCP failover Binding Update messages sent | counter | None +`failover_bndupd_received_total` | Number of DHCP failover Binding Update messages received | counter | None +`failover_bndack_sent_total` | Number of DHCP failover Binding Ack messages sent | counter | None +`failover_bndack_received_total` | Number of DHCP failover Binding Ack messages received | counter | None +`failover_bndupd_pending_in_outbound_queue` | Number of pending outbound DHCP failover Binding Update messages | counter | None +`failover_transitions_communicationinterrupted_state_total` | Total number of transitions into COMMUNICATION INTERRUPTED state | counter | None +`failover_transitions_partnerdown_state_total` | Total number of transitions into PARTNER DOWN state | counter | None +`failover_transitions_recover_total` | Total number of transitions into RECOVER state | counter | None +`failover_bndupd_dropped_total` | Total number of DHCP faileover Binding Updates dropped | counter | None + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ From 99ed969bf79e8cf344a7ae715176043e624cf8af Mon Sep 17 00:00:00 2001 From: Guillermo Sanchez Gavier Date: Fri, 15 May 2020 13:13:25 +0200 Subject: [PATCH 04/41] add wmi_service_info metric with display_name and pid labels (#516) * add wmi_service_info metric --- collector/service.go | 34 +++++++++++++++++++++++++++------- docs/collector.service.md | 1 + 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/collector/service.go b/collector/service.go index 37fc08b2..d053729f 100644 --- a/collector/service.go +++ b/collector/service.go @@ -3,6 +3,7 @@ package collector import ( + "strconv" "strings" "github.com/StackExchange/wmi" @@ -24,9 +25,10 @@ var ( // A serviceCollector is a Prometheus collector for WMI Win32_Service metrics type serviceCollector struct { - State *prometheus.Desc - StartMode *prometheus.Desc - Status *prometheus.Desc + Information *prometheus.Desc + State *prometheus.Desc + StartMode *prometheus.Desc + Status *prometheus.Desc queryWhereClause string } @@ -40,6 +42,12 @@ func NewserviceCollector() (Collector, error) { } return &serviceCollector{ + Information: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "info"), + "A metric with a constant '1' value labeled with service information", + []string{"name", "display_name", "process_id"}, + nil, + ), State: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "state"), "The state of the service (State)", @@ -75,10 +83,12 @@ func (c *serviceCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metr // Win32_Service docs: // - https://msdn.microsoft.com/en-us/library/aa394418(v=vs.85).aspx type Win32_Service struct { - Name string - State string - Status string - StartMode string + DisplayName string + Name string + ProcessId uint32 + State string + Status string + StartMode string } var ( @@ -123,6 +133,16 @@ func (c *serviceCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des } for _, service := range dst { + pid := strconv.FormatUint(uint64(service.ProcessId), 10) + ch <- prometheus.MustNewConstMetric( + c.Information, + prometheus.GaugeValue, + 1.0, + strings.ToLower(service.Name), + service.DisplayName, + pid, + ) + for _, state := range allStates { isCurrentState := 0.0 if state == strings.ToLower(service.State) { diff --git a/docs/collector.service.md b/docs/collector.service.md index e12cb654..a3b76463 100644 --- a/docs/collector.service.md +++ b/docs/collector.service.md @@ -20,6 +20,7 @@ Example: `--collector.service.services-where="Name='wmi_exporter'"` Name | Description | Type | Labels -----|-------------|------|------- +`wmi_service_info` | Contains service information in labels, constant 1 | gauge | name, display_name, process_id `wmi_service_state` | The state of the service, 1 if the current state, 0 otherwise | gauge | name, state `wmi_service_start_mode` | The start mode of the service, 1 if the current start mode, 0 otherwise | gauge | name, start_mode `wmi_service_status` | The status of the service, 1 if the current status, 0 otherwise | gauge | name, status From 7742ff6a1ce70127fd97012602a8809d7e8abb83 Mon Sep 17 00:00:00 2001 From: Bas Roovers Date: Wed, 20 May 2020 08:48:53 +0200 Subject: [PATCH 05/41] Replaced Get-WMIObject with Get-CimInstance for PS7 support --- tools/collector-generator/New-Collector.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/collector-generator/New-Collector.ps1 b/tools/collector-generator/New-Collector.ps1 index d926d277..43944386 100644 --- a/tools/collector-generator/New-Collector.ps1 +++ b/tools/collector-generator/New-Collector.ps1 @@ -11,10 +11,10 @@ Param( $ErrorActionPreference = "Stop" if($Credential -ne $null) { - $wmiObject = Get-WMIObject -ComputerName $ComputerName -Credential $Credential -Class $Class + $wmiObject = Get-CimInstance -ComputerName $ComputerName -Credential $Credential -Class $Class } else { - $wmiObject = Get-WMIObject -ComputerName $ComputerName -Class $Class + $wmiObject = Get-CimInstance -ComputerName $ComputerName -Class $Class } $members = $wmiObject ` From 2ea20ff62872ef2a10687511ac413417340499eb Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 24 May 2020 17:23:13 +0200 Subject: [PATCH 06/41] Check that collectors given on --collectors.enabled exist before trying to construct them --- collector/collector.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/collector/collector.go b/collector/collector.go index edcb880b..97812d76 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -1,6 +1,7 @@ package collector import ( + "fmt" "strconv" "strings" @@ -72,7 +73,11 @@ func Available() []string { return cs } func Build(collector string) (Collector, error) { - return builders[collector]() + builder, exists := builders[collector] + if !exists { + return nil, fmt.Errorf("Unknown collector %q", collector) + } + return builder() } func getPerfQuery(collectors []string) string { parts := make([]string, 0, len(collectors)) From 3c98edaa2c4949a30b15ccd4d2304fcd0da828c3 Mon Sep 17 00:00:00 2001 From: rmyhren Date: Sun, 24 May 2020 18:05:27 +0200 Subject: [PATCH 07/41] Adds MS Exchange collector (#508) Adds MS Exchange collector Co-authored-by: Robin Eikaas Co-authored-by: Robert Myhren --- README.md | 1 + collector/exchange.go | 609 +++++++++++++++++++++++++++++++++++++ docs/collector.exchange.md | 67 ++++ go.sum | 27 +- 4 files changed, 681 insertions(+), 23 deletions(-) create mode 100644 collector/exchange.go create mode 100644 docs/collector.exchange.md diff --git a/README.md b/README.md index af49e8c8..f8f3afc2 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Name | Description | Enabled by default [cs](docs/collector.cs.md) | "Computer System" metrics (system properties, num cpus/total memory) | ✓ [container](docs/collector.container.md) | Container metrics | [dns](docs/collector.dns.md) | DNS Server | +[exchange](docs/collector.exchange.md) | Exchange metrics | [hyperv](docs/collector.hyperv.md) | Hyper-V hosts | [iis](docs/collector.iis.md) | IIS sites and applications | [logical_disk](docs/collector.logical_disk.md) | Logical disks, disk I/O | ✓ diff --git a/collector/exchange.go b/collector/exchange.go new file mode 100644 index 00000000..90327d0c --- /dev/null +++ b/collector/exchange.go @@ -0,0 +1,609 @@ +// +build windows + +package collector + +import ( + "fmt" + "os" + "strings" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" + "gopkg.in/alecthomas/kingpin.v2" +) + +func init() { + registerCollector("exchange", newExchangeCollector, + "MSExchange ADAccess Processes", + "MSExchangeTransport Queues", + "MSExchange HttpProxy", + "MSExchange ActiveSync", + "MSExchange Availability Service", + "MSExchange OWA", + "MSExchangeAutodiscover", + "MSExchange WorkloadManagement Workloads", + "MSExchange RpcClientAccess", + ) +} + +type exchangeCollector struct { + LDAPReadTime *prometheus.Desc + LDAPSearchTime *prometheus.Desc + LDAPWriteTime *prometheus.Desc + LDAPTimeoutErrorsPerSec *prometheus.Desc + LongRunningLDAPOperationsPerMin *prometheus.Desc + ExternalActiveRemoteDeliveryQueueLength *prometheus.Desc + InternalActiveRemoteDeliveryQueueLength *prometheus.Desc + ActiveMailboxDeliveryQueueLength *prometheus.Desc + RetryMailboxDeliveryQueueLength *prometheus.Desc + UnreachableQueueLength *prometheus.Desc + ExternalLargestDeliveryQueueLength *prometheus.Desc + InternalLargestDeliveryQueueLength *prometheus.Desc + PoisonQueueLength *prometheus.Desc + MailboxServerLocatorAverageLatency *prometheus.Desc + AverageAuthenticationLatency *prometheus.Desc + AverageCASProcessingLatency *prometheus.Desc + MailboxServerProxyFailureRate *prometheus.Desc + OutstandingProxyRequests *prometheus.Desc + ProxyRequestsPerSec *prometheus.Desc + ActiveSyncRequestsPerSec *prometheus.Desc + PingCommandsPending *prometheus.Desc + SyncCommandsPerSec *prometheus.Desc + AvailabilityRequestsSec *prometheus.Desc + CurrentUniqueUsers *prometheus.Desc + OWARequestsPerSec *prometheus.Desc + AutodiscoverRequestsPerSec *prometheus.Desc + ActiveTasks *prometheus.Desc + CompletedTasks *prometheus.Desc + QueuedTasks *prometheus.Desc + YieldedTasks *prometheus.Desc + IsActive *prometheus.Desc + RPCAveragedLatency *prometheus.Desc + RPCRequests *prometheus.Desc + ActiveUserCount *prometheus.Desc + ConnectionCount *prometheus.Desc + RPCOperationsPerSec *prometheus.Desc + UserCount *prometheus.Desc + + ActiveCollFuncs []func(ctx *ScrapeContext, ch chan<- prometheus.Metric) error +} + +var ( + // All available collector functions + exchangeAllCollectorNames = []string{ + "ADAccessProcesses", + "TransportQueues", + "HttpProxy", + "ActiveSync", + "AvailabilityService", + "OutlookWebAccess", + "Autodiscover", + "WorkloadManagement", + "RpcClientAccess", + } + + argExchangeListAllCollectors = kingpin.Flag( + "collectors.exchange.list", + "List the collectors along with their perflib object name/ids", + ).Bool() +) + +// newExchangeCollector returns a new Collector +func newExchangeCollector() (Collector, error) { + + // desc creates a new prometheus description + desc := func(metricName string, description string, labels ...string) *prometheus.Desc { + return prometheus.NewDesc( + prometheus.BuildFQName(Namespace, "exchange", metricName), + description, + labels, + nil, + ) + } + + c := exchangeCollector{ + RPCAveragedLatency: desc("rpc_avg_latency_sec", "The latency (sec), averaged for the past 1024 packets"), + RPCRequests: desc("rpc_requests", "Number of client requests currently being processed by the RPC Client Access service"), + ActiveUserCount: desc("rpc_active_user_count", "Number of unique users that have shown some kind of activity in the last 2 minutes"), + ConnectionCount: desc("rpc_connection_count", "Total number of client connections maintained"), + RPCOperationsPerSec: desc("rpc_operations_total", "The rate at which RPC operations occur"), + UserCount: desc("rpc_user_count", "Number of users"), + LDAPReadTime: desc("ldap_read_time_sec", "Time (sec) to send an LDAP read request and receive a response", "name"), + LDAPSearchTime: desc("ldap_search_time_sec", "Time (sec) to send an LDAP search request and receive a response", "name"), + LDAPWriteTime: desc("ldap_write_time_sec", "Time (sec) to send an LDAP Add/Modify/Delete request and receive a response", "name"), + LDAPTimeoutErrorsPerSec: desc("ldap_timeout_errors_total", "Total number of LDAP timeout errors", "name"), + LongRunningLDAPOperationsPerMin: desc("ldap_long_running_ops_per_sec", "Long Running LDAP operations per second", "name"), + ExternalActiveRemoteDeliveryQueueLength: desc("transport_queues_external_active_remote_delivery", "External Active Remote Delivery Queue length", "name"), + InternalActiveRemoteDeliveryQueueLength: desc("transport_queues_internal_active_remote_delivery", "Internal Active Remote Delivery Queue length", "name"), + ActiveMailboxDeliveryQueueLength: desc("transport_queues_active_mailbox_delivery", "Active Mailbox Delivery Queue length", "name"), + RetryMailboxDeliveryQueueLength: desc("transport_queues_retry_mailbox_delivery", "Retry Mailbox Delivery Queue length", "name"), + UnreachableQueueLength: desc("transport_queues_unreachable", "Unreachable Queue length", "name"), + ExternalLargestDeliveryQueueLength: desc("transport_queues_external_largest_delivery", "External Largest Delivery Queue length", "name"), + InternalLargestDeliveryQueueLength: desc("transport_queues_internal_largest_delivery", "Internal Largest Delivery Queue length", "name"), + PoisonQueueLength: desc("transport_queues_poison", "Poison Queue length", "name"), + MailboxServerLocatorAverageLatency: desc("http_proxy_mailbox_server_locator_avg_latency_sec", "Average latency (sec) of MailboxServerLocator web service calls", "name"), + AverageAuthenticationLatency: desc("http_proxy_avg_auth_latency", "Average time spent authenticating CAS requests over the last 200 samples", "name"), + OutstandingProxyRequests: desc("http_proxy_outstanding_proxy_requests", "Number of concurrent outstanding proxy requests", "name"), + ProxyRequestsPerSec: desc("http_proxy_requests_total", "Number of proxy requests processed each second", "name"), + AvailabilityRequestsSec: desc("avail_service_requests_per_sec", "Number of requests serviced per second"), + CurrentUniqueUsers: desc("owa_current_unique_users", "Number of unique users currently logged on to Outlook Web App"), + OWARequestsPerSec: desc("owa_requests_total", "Number of requests handled by Outlook Web App per second"), + AutodiscoverRequestsPerSec: desc("autodiscover_requests_total", "Number of autodiscover service requests processed each second"), + ActiveTasks: desc("workload_active_tasks", "Number of active tasks currently running in the background for workload management", "name"), + CompletedTasks: desc("workload_completed_tasks", "Number of workload management tasks that have been completed", "name"), + QueuedTasks: desc("workload_queued_tasks", "Number of workload management tasks that are currently queued up waiting to be processed", "name"), + YieldedTasks: desc("workload_yielded_tasks", "The total number of tasks that have been yielded by a workload", "name"), + IsActive: desc("workload_is_active", "Active indicates whether the workload is in an active (1) or paused (0) state", "name"), + ActiveSyncRequestsPerSec: desc("activesync_requests_total", "Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load"), + AverageCASProcessingLatency: desc("http_proxy_avg_cas_proccessing_latency_sec", "Average latency (sec) of CAS processing time over the last 200 reqs", "name"), + MailboxServerProxyFailureRate: desc("http_proxy_mailbox_proxy_failure_rate", "% of failures between this CAS and MBX servers over the last 200 samples", "name"), + PingCommandsPending: desc("activesync_ping_cmds_pending", "Number of ping commands currently pending in the queue"), + SyncCommandsPerSec: desc("activesync_sync_cmds_total", "Number of sync commands processed per second. Clients use this command to synchronize items within a folder"), + } + + collectorDesc := map[string]string{ + "ADAccessProcesses": "[19108] MSExchange ADAccess Processes", + "TransportQueues": "[20524] MSExchangeTransport Queues", + "HttpProxy": "[36934] MSExchange HttpProxy", + "ActiveSync": "[25138] MSExchange ActiveSync", + "AvailabilityService": "[24914] MSExchange Availability Service", + "OutlookWebAccess": "[24618] MSExchange OWA", + "Autodiscover": "[29240] MSExchange Autodiscover", + "WorkloadManagement": "[19430] MSExchange WorkloadManagement Workloads", + "RpcClientAccess": "[29336] MSExchange RpcClientAccess", + } + + if *argExchangeListAllCollectors { + fmt.Printf("%-32s %-32s\n", "Collector Name", "[PerfID] Perflib Object") + for _, cname := range exchangeAllCollectorNames { + fmt.Printf("%-32s %-32s\n", cname, collectorDesc[cname]) + } + os.Exit(0) + } + + return &c, nil +} + +// Collect collects exchange metrics and sends them to prometheus +func (c *exchangeCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + for collectorName, collectorFunc := range map[string]func(ctx *ScrapeContext, ch chan<- prometheus.Metric) error{ + "ADAccessProcesses": c.collectADAccessProcesses, + "TransportQueues": c.collectTransportQueues, + "HttpProxy": c.collectHTTPProxy, + "ActiveSync": c.collectActiveSync, + "AvailabilityService": c.collectAvailabilityService, + "OutlookWebAccess": c.collectOWA, + "Autodiscover": c.collectAutoDiscover, + "WorkloadManagement": c.collectWorkloadManagementWorkloads, + "RpcClientAccess": c.collectRPC, + } { + if err := collectorFunc(ctx, ch); err != nil { + log.Errorf("Error in %s: %s", collectorName, err) + return err + } + } + return nil +} + +// Perflib: [19108] MSExchange ADAccess Processes +type perflibADAccessProcesses struct { + Name string + + LDAPReadTime float64 `perflib:"LDAP Read Time"` + LDAPSearchTime float64 `perflib:"LDAP Search Time"` + LDAPWriteTime float64 `perflib:"LDAP Write Time"` + LDAPTimeoutErrorsPerSec float64 `perflib:"LDAP Timeout Errors/sec"` + LongRunningLDAPOperationsPerMin float64 `perflib:"Long Running LDAP Operations/min"` +} + +func (c *exchangeCollector) collectADAccessProcesses(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibADAccessProcesses + if err := unmarshalObject(ctx.perfObjects["MSExchange ADAccess Processes"], &data); err != nil { + return err + } + + labelUseCount := make(map[string]int) + for _, proc := range data { + labelName := c.toLabelName(proc.Name) + if strings.HasSuffix(labelName, "_total") { + continue + } + + // since we're not including the PID suffix from the instance names in the label names, + // we get an occational duplicate. This seems to affect about 4 instances only on this object. + labelUseCount[labelName]++ + if labelUseCount[labelName] > 1 { + labelName = fmt.Sprintf("%s_%d", labelName, labelUseCount[labelName]) + } + ch <- prometheus.MustNewConstMetric( + c.LDAPReadTime, + prometheus.CounterValue, + c.msToSec(proc.LDAPReadTime), + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.LDAPSearchTime, + prometheus.CounterValue, + c.msToSec(proc.LDAPSearchTime), + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.LDAPWriteTime, + prometheus.CounterValue, + c.msToSec(proc.LDAPWriteTime), + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.LDAPTimeoutErrorsPerSec, + prometheus.CounterValue, + proc.LDAPTimeoutErrorsPerSec, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.LongRunningLDAPOperationsPerMin, + prometheus.CounterValue, + proc.LongRunningLDAPOperationsPerMin*60, + labelName, + ) + } + return nil +} + +// Perflib: [24914] MSExchange Availability Service +type perflibAvailabilityService struct { + RequestsSec float64 `perflib:"Availability Requests (sec)"` +} + +func (c *exchangeCollector) collectAvailabilityService(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibAvailabilityService + if err := unmarshalObject(ctx.perfObjects["MSExchange Availability Service"], &data); err != nil { + return err + } + + for _, availservice := range data { + ch <- prometheus.MustNewConstMetric( + c.AvailabilityRequestsSec, + prometheus.CounterValue, + availservice.RequestsSec, + ) + } + return nil +} + +// Perflib: [36934] MSExchange HttpProxy +type perflibHTTPProxy struct { + Name string + + MailboxServerLocatorAverageLatency float64 `perflib:"MailboxServerLocator Average Latency (Moving Average)"` + AverageAuthenticationLatency float64 `perflib:"Average Authentication Latency"` + AverageCASProcessingLatency float64 `perflib:"Average ClientAccess Server Processing Latency"` + MailboxServerProxyFailureRate float64 `perflib:"Mailbox Server Proxy Failure Rate"` + OutstandingProxyRequests float64 `perflib:"Outstanding Proxy Requests"` + ProxyRequestsPerSec float64 `perflib:"Proxy Requests/Sec"` +} + +func (c *exchangeCollector) collectHTTPProxy(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibHTTPProxy + if err := unmarshalObject(ctx.perfObjects["MSExchange HttpProxy"], &data); err != nil { + return err + } + + for _, instance := range data { + labelName := c.toLabelName(instance.Name) + ch <- prometheus.MustNewConstMetric( + c.MailboxServerLocatorAverageLatency, + prometheus.GaugeValue, + c.msToSec(instance.MailboxServerLocatorAverageLatency), + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.AverageAuthenticationLatency, + prometheus.GaugeValue, + instance.AverageAuthenticationLatency, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.AverageCASProcessingLatency, + prometheus.GaugeValue, + c.msToSec(instance.AverageCASProcessingLatency), + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.MailboxServerProxyFailureRate, + prometheus.GaugeValue, + instance.MailboxServerProxyFailureRate, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.OutstandingProxyRequests, + prometheus.GaugeValue, + instance.OutstandingProxyRequests, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.ProxyRequestsPerSec, + prometheus.CounterValue, + instance.ProxyRequestsPerSec, + labelName, + ) + } + return nil +} + +// Perflib: [24618] MSExchange OWA +type perflibOWA struct { + CurrentUniqueUsers float64 `perflib:"Current Unique Users"` + RequestsPerSec float64 `perflib:"Requests/sec"` +} + +func (c *exchangeCollector) collectOWA(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibOWA + if err := unmarshalObject(ctx.perfObjects["MSExchange OWA"], &data); err != nil { + return err + } + + for _, owa := range data { + ch <- prometheus.MustNewConstMetric( + c.CurrentUniqueUsers, + prometheus.GaugeValue, + owa.CurrentUniqueUsers, + ) + ch <- prometheus.MustNewConstMetric( + c.OWARequestsPerSec, + prometheus.CounterValue, + owa.RequestsPerSec, + ) + } + return nil +} + +// Perflib: [25138] MSExchange ActiveSync +type perflibActiveSync struct { + RequestsPerSec float64 `perflib:"Requests/sec"` + PingCommandsPending float64 `perflib:"Ping Commands Pending"` + SyncCommandsPerSec float64 `perflib:"Sync Commands/sec"` +} + +func (c *exchangeCollector) collectActiveSync(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibActiveSync + if err := unmarshalObject(ctx.perfObjects["MSExchange ActiveSync"], &data); err != nil { + return err + } + + for _, instance := range data { + ch <- prometheus.MustNewConstMetric( + c.ActiveSyncRequestsPerSec, + prometheus.CounterValue, + instance.RequestsPerSec, + ) + ch <- prometheus.MustNewConstMetric( + c.PingCommandsPending, + prometheus.GaugeValue, + instance.PingCommandsPending, + ) + ch <- prometheus.MustNewConstMetric( + c.SyncCommandsPerSec, + prometheus.CounterValue, + instance.SyncCommandsPerSec, + ) + } + return nil +} + +// Perflib: [29366] MSExchange RpcClientAccess +type perflibRPCClientAccess struct { + RPCAveragedLatency float64 `perflib:"RPC Averaged Latency"` + RPCRequests float64 `perflib:"RPC Requests"` + ActiveUserCount float64 `perflib:"Active User Count"` + ConnectionCount float64 `perflib:"Connection Count"` + RPCOperationsPerSec float64 `perflib:"RPC Operations/sec"` + UserCount float64 `perflib:"User Count"` +} + +func (c *exchangeCollector) collectRPC(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibRPCClientAccess + if err := unmarshalObject(ctx.perfObjects["MSExchange RpcClientAccess"], &data); err != nil { + return err + } + + for _, rpc := range data { + ch <- prometheus.MustNewConstMetric( + c.RPCAveragedLatency, + prometheus.GaugeValue, + c.msToSec(rpc.RPCAveragedLatency), + ) + ch <- prometheus.MustNewConstMetric( + c.RPCRequests, + prometheus.GaugeValue, + rpc.RPCRequests, + ) + ch <- prometheus.MustNewConstMetric( + c.ActiveUserCount, + prometheus.GaugeValue, + rpc.ActiveUserCount, + ) + ch <- prometheus.MustNewConstMetric( + c.ConnectionCount, + prometheus.GaugeValue, + rpc.ConnectionCount, + ) + ch <- prometheus.MustNewConstMetric( + c.RPCOperationsPerSec, + prometheus.CounterValue, + rpc.RPCOperationsPerSec, + ) + ch <- prometheus.MustNewConstMetric( + c.UserCount, + prometheus.GaugeValue, + rpc.UserCount, + ) + } + + return nil +} + +// Perflib: [20524] MSExchangeTransport Queues +type perflibTransportQueues struct { + Name string + + ExternalActiveRemoteDeliveryQueueLength float64 `perflib:"External Active Remote Delivery Queue Length"` + InternalActiveRemoteDeliveryQueueLength float64 `perflib:"Internal Active Remote Delivery Queue Length"` + ActiveMailboxDeliveryQueueLength float64 `perflib:"Active Mailbox Delivery Queue Length"` + RetryMailboxDeliveryQueueLength float64 `perflib:"Retry Mailbox Delivery Queue Length"` + UnreachableQueueLength float64 `perflib:"Unreachable Queue Length"` + ExternalLargestDeliveryQueueLength float64 `perflib:"External Largest Delivery Queue Length"` + InternalLargestDeliveryQueueLength float64 `perflib:"Internal Largest Delivery Queue Length"` + PoisonQueueLength float64 `perflib:"Poison Queue Length"` +} + +func (c *exchangeCollector) collectTransportQueues(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibTransportQueues + if err := unmarshalObject(ctx.perfObjects["MSExchangeTransport Queues"], &data); err != nil { + return err + } + + for _, queue := range data { + labelName := c.toLabelName(queue.Name) + if strings.HasSuffix(labelName, "_total") { + continue + } + ch <- prometheus.MustNewConstMetric( + c.ExternalActiveRemoteDeliveryQueueLength, + prometheus.GaugeValue, + queue.ExternalActiveRemoteDeliveryQueueLength, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.InternalActiveRemoteDeliveryQueueLength, + prometheus.GaugeValue, + queue.InternalActiveRemoteDeliveryQueueLength, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.ActiveMailboxDeliveryQueueLength, + prometheus.GaugeValue, + queue.ActiveMailboxDeliveryQueueLength, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.RetryMailboxDeliveryQueueLength, + prometheus.GaugeValue, + queue.RetryMailboxDeliveryQueueLength, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.UnreachableQueueLength, + prometheus.GaugeValue, + queue.UnreachableQueueLength, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.ExternalLargestDeliveryQueueLength, + prometheus.GaugeValue, + queue.ExternalLargestDeliveryQueueLength, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.InternalLargestDeliveryQueueLength, + prometheus.GaugeValue, + queue.InternalLargestDeliveryQueueLength, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.PoisonQueueLength, + prometheus.GaugeValue, + queue.PoisonQueueLength, + labelName, + ) + } + return nil +} + +// Perflib: [19430] MSExchange WorkloadManagement Workloads +type perflibWorkloadManagementWorkloads struct { + Name string + + ActiveTasks float64 `perflib:"ActiveTasks"` + CompletedTasks float64 `perflib:"CompletedTasks"` + QueuedTasks float64 `perflib:"QueuedTasks"` + YieldedTasks float64 `perflib:"YieldedTasks"` + IsActive float64 `perflib:"Active"` +} + +func (c *exchangeCollector) collectWorkloadManagementWorkloads(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibWorkloadManagementWorkloads + if err := unmarshalObject(ctx.perfObjects["MSExchange WorkloadManagement Workloads"], &data); err != nil { + return err + } + + for _, instance := range data { + labelName := c.toLabelName(instance.Name) + if strings.HasSuffix(labelName, "_total") { + continue + } + ch <- prometheus.MustNewConstMetric( + c.ActiveTasks, + prometheus.GaugeValue, + instance.ActiveTasks, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.CompletedTasks, + prometheus.CounterValue, + instance.CompletedTasks, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.QueuedTasks, + prometheus.CounterValue, + instance.QueuedTasks, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.YieldedTasks, + prometheus.CounterValue, + instance.YieldedTasks, + labelName, + ) + ch <- prometheus.MustNewConstMetric( + c.IsActive, + prometheus.GaugeValue, + instance.IsActive, + labelName, + ) + } + + return nil +} + +// [29240] MSExchangeAutodiscover +type perflibAutodiscover struct { + RequestsPerSec float64 `perflib:"Requests/sec"` +} + +func (c *exchangeCollector) collectAutoDiscover(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + var data []perflibAutodiscover + if err := unmarshalObject(ctx.perfObjects["MSExchangeAutodiscover"], &data); err != nil { + return err + } + for _, autodisc := range data { + ch <- prometheus.MustNewConstMetric( + c.AutodiscoverRequestsPerSec, + prometheus.CounterValue, + autodisc.RequestsPerSec, + ) + } + return nil +} + +// toLabelName converts strings to lowercase and replaces all whitespace and dots with underscores +func (c *exchangeCollector) toLabelName(name string) string { + s := strings.ReplaceAll(strings.Join(strings.Fields(strings.ToLower(name)), "_"), ".", "_") + s = strings.ReplaceAll(s, "__", "_") + return s +} + +// msToSec converts from ms to seconds +func (c *exchangeCollector) msToSec(t float64) float64 { + return t / 1000 +} diff --git a/docs/collector.exchange.md b/docs/collector.exchange.md new file mode 100644 index 00000000..ccf3d586 --- /dev/null +++ b/docs/collector.exchange.md @@ -0,0 +1,67 @@ +# exchange collector + +The exchange collector collects metrics from MS Exchange hosts through perflib +======= + + +||| +-|- +Metric name prefix | `exchange` +Classes | [Win32_PerfRawData_MSExchangeADAccess_MSExchangeADAccessProcesses](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_MSExchangeTransportQueues_MSExchangeTransportueues](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_ESE_MSExchangeDatabaseInstances](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_MSExchangeHttpProxy_MSExchangeHttpProxy](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_MSExchangeActiveSync_MSExchangeActiveSync](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_MSExchangeAvailabilityService_MSExchangeAvailabilityService](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_MSExchangeOWA_MSExchangeOWA](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_MSExchangeAutodiscover_MSExchangeAutodiscover](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_MSExchangeWorkloadManagementWorkloads_MSExchangeWorkloadManagementWorkloads](https://docs.microsoft.com/en-us/exchange/)
[Win32_PerfRawData_MSExchangeRpcClientAccess_MSExchangeRpcClientAccess](https://docs.microsoft.com/en-us/exchange/)
+Enabled by default? | No + +## Flags + +### `--collectors.exchange.list` +Lists the Perflib Objects that are queried for data along with the perlfib object id + +## Metrics +Name | Description +--------------|--------------- +`wmi_exchange_rpc_avg_latency_sec` | The latency (sec), averaged for the past 1024 packets +`wmi_exchange_rpc_requests` | Number of client requests currently being processed by the RPC Client Access service +`wmi_exchange_rpc_active_user_count` | Number of unique users that have shown some kind of activity in the last 2 minutes +`wmi_exchange_rpc_connection_count` | Total number of client connections maintained +`wmi_exchange_rpc_operations_total` | The rate at which RPC operations occur +`wmi_exchange_rpc_user_count` | Number of users +`wmi_exchange_ldap_read_time_sec` | Time (sec) to send an LDAP read request and receive a response +`wmi_exchange_ldap_search_time_sec` | Time (sec) to send an LDAP search request and receive a response +`wmi_exchange_ldap_write_time_sec` | Time (sec) to send an LDAP Add/Modify/Delete request and receive a response +`wmi_exchange_ldap_timeout_errors_total` | Total number of LDAP timeout errors +`wmi_exchange_ldap_long_running_ops_per_sec` | Long Running LDAP operations per second +`wmi_exchange_transport_queues_external_active_remote_delivery` | External Active Remote Delivery Queue length +`wmi_exchange_transport_queues_internal_active_remote_delivery` | Internal Active Remote Delivery Queue length +`wmi_exchange_transport_queues_active_mailbox_delivery` | Active Mailbox Delivery Queue length +`wmi_exchange_transport_queues_retry_mailbox_delivery` | Retry Mailbox Delivery Queue length +`wmi_exchange_transport_queues_unreachable` | Unreachable Queue lengt +`wmi_exchange_transport_queues_external_largest_delivery` | External Largest Delivery Queue length +`wmi_exchange_transport_queues_internal_largest_delivery` | Internal Largest Delivery Queue length +`wmi_exchange_transport_queues_poison` | Poison Queue length +`wmi_exchange_http_proxy_mailbox_server_locator_avg_latency_sec` | Average latency (sec) of MailboxServerLocator web service calls +`wmi_exchange_http_proxy_avg_auth_latency` | Average time spent authenticating CAS requests over the last 200 samples +`wmi_exchange_http_proxy_outstanding_proxy_requests` | Number of concurrent outstanding proxy requests +`wmi_exchange_http_proxy_requests_total` | Number of proxy requests processed each second +`wmi_exchange_avail_service_requests_per_sec` | Number of requests serviced per second +`wmi_exchange_owa_current_unique_users` | Number of unique users currently logged on to Outlook Web App +`wmi_exchange_owa_requests_total` | Number of requests handled by Outlook Web App per second +`wmi_exchange_autodiscover_requests_total` | Number of autodiscover service requests processed each second +`wmi_exchange_workload_active_tasks` | Number of active tasks currently running in the background for workload management +`wmi_exchange_workload_completed_tasks` | Number of workload management tasks that have been completed +`wmi_exchange_workload_queued_tasks` | Number of workload management tasks that are currently queued up waiting to be processed +`wmi_exchange_workload_yielded_tasks` | The total number of tasks that have been yielded by a workload +`wmi_exchange_workload_is_active` | Active indicates whether the workload is in an active (1) or paused (0) state +`wmi_exchange_activesync_requests_total` | Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load +`wmi_exchange_http_proxy_avg_cas_proccessing_latency_sec` | Average latency (sec) of CAS processing time over the last 200 reqs +`wmi_exchange_http_proxy_mailbox_proxy_failure_rate` | % of failures between this CAS and MBX servers over the last 200 sample +`wmi_exchange_activesync_ping_cmds_pending` | Number of ping commands currently pending in the queue +`wmi_exchange_activesync_sync_cmds_total` | Number of sync commands processed per second. Clients use this command to synchronize items within a folder + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ + diff --git a/go.sum b/go.sum index 66b567af..d20b9d92 100644 --- a/go.sum +++ b/go.sum @@ -4,15 +4,13 @@ github.com/Microsoft/hcsshim v0.8.6 h1:ZfF0+zZeYdzMIVMZHKtDKJvLHj76XCuVae/jNkjj0 github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a h1:BtpsbiV638WQZwhA98cEZw2BsbnQJrbd0BI7tsy0W1c= -github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= @@ -22,61 +20,44 @@ github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/protobuf v1.0.0 h1:lsek0oXi8iFE9L+EXARyHIjU5rlWIhhTkjDz3vHhWWQ= -github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/leoluk/perflib_exporter v0.0.1 h1:MRwP1Ohh/mVevUy4ZUzvSlxnJtm9/NWHeM3aROxnRiQ= -github.com/leoluk/perflib_exporter v0.0.1/go.mod h1:4APOQriqHobMzovXV7guPQv0ynKH6vZD3XNmT2MBc6w= github.com/leoluk/perflib_exporter v0.1.0 h1:fXe/mDaf9jR+Zk8FjFlcCSksACuIj2VNN4GyKHmQqtA= github.com/leoluk/perflib_exporter v0.1.0/go.mod h1:rpV0lYj7lemdTm31t7zpCqYqPnw7xs86f+BaaNBVYFM= -github.com/matttproud/golang_protobuf_extensions v1.0.0 h1:YNOwxxSJzSUARoD9KRZLzM9Y858MNGCOACTvCW9TSAc= -github.com/matttproud/golang_protobuf_extensions v1.0.0/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.8.0 h1:1921Yw9Gc3iSc4VQh3PIoOqgPCZS7G/4xQNVUp8Mda8= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5 h1:cLL6NowurKLMfCeQy4tIeph12XNQWgANCNvdyrOYKV4= -github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20180312112859-e4aa40a9169a h1:JLXgXKi9RCmLk8DMn8+PCvN++iwpD3KptUbVvHBsKtU= -github.com/prometheus/common v0.0.0-20180312112859-e4aa40a9169a/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20180310141954-54d17b57dd7d h1:iF+U2tTdys559fmqt0MNaC8QLIJh1twxIIOylDGhswM= -github.com/prometheus/procfs v0.0.0-20180310141954-54d17b57dd7d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/sirupsen/logrus v1.0.5 h1:8c8b5uO0zS4X6RPl/sd1ENwSkIc0/H2PaHxE3udaE8I= -github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -golang.org/x/crypto v0.0.0-20180312195533-182114d58262 h1:1NLVUmR8SQ7cNNA5Vo7ronpXbR+5A+9IwIC/bLE7D8Y= -golang.org/x/crypto v0.0.0-20180312195533-182114d58262/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180313075820-8c0ece68c283 h1:DE/w7won1Ns86VoWjUZ4cJS6//TObJntGkxuZ63asRc= -golang.org/x/sys v0.0.0-20180313075820-8c0ece68c283/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67 h1:1Fzlr8kkDLQwqMP8GxrhptBLqZG/EDpiATneiZHY998= From 6f90d83b83c4842edc8d3a188c66c2fa2ddf6d83 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 24 May 2020 20:38:05 +0200 Subject: [PATCH 08/41] Update module name --- exporter.go | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exporter.go b/exporter.go index 31f2ff6d..42e8e636 100644 --- a/exporter.go +++ b/exporter.go @@ -15,7 +15,7 @@ import ( "golang.org/x/sys/windows/svc" "github.com/StackExchange/wmi" - "github.com/martinlindhe/wmi_exporter/collector" + "github.com/prometheus-community/windows_exporter/collector" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/log" diff --git a/go.mod b/go.mod index 6d146dba..0f0cc99b 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/martinlindhe/wmi_exporter +module github.com/prometheus-community/windows_exporter go 1.13 From eaa23705d0703a71fba6f3cf9f05ee7ec6118376 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 24 May 2020 20:36:25 +0200 Subject: [PATCH 09/41] Change metric namespace from wmi to windows --- collector/collector.go | 2 +- collector/mssql.go | 4 ++-- collector/textfile.go | 4 ++-- exporter.go | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/collector/collector.go b/collector/collector.go index 97812d76..41708e3a 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -14,7 +14,7 @@ import ( // ... const ( // TODO: Make package-local - Namespace = "wmi" + Namespace = "windows" // Conversion factors ticksToSecondsScaleFactor = 1 / 1e7 diff --git a/collector/mssql.go b/collector/mssql.go index 25db71a5..ab980d8e 100644 --- a/collector/mssql.go +++ b/collector/mssql.go @@ -396,13 +396,13 @@ func NewMSSQLCollector() (Collector, error) { // meta mssqlScrapeDurationDesc: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "collector_duration_seconds"), - "wmi_exporter: Duration of an mssql child collection.", + "windows_exporter: Duration of an mssql child collection.", []string{"collector", "instance"}, nil, ), mssqlScrapeSuccessDesc: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "collector_success"), - "wmi_exporter: Whether a mssql child collector was successful.", + "windows_exporter: Whether a mssql child collector was successful.", []string{"collector", "instance"}, nil, ), diff --git a/collector/textfile.go b/collector/textfile.go index bfd8c522..3caf9808 100644 --- a/collector/textfile.go +++ b/collector/textfile.go @@ -40,7 +40,7 @@ var ( ).Default("C:\\Program Files\\wmi_exporter\\textfile_inputs").String() mtimeDesc = prometheus.NewDesc( - "wmi_textfile_mtime_seconds", + prometheus.BuildFQName(Namespace, "textfile", "mtime_seconds"), "Unixtime mtime of textfiles successfully read.", []string{"file"}, nil, @@ -281,7 +281,7 @@ fileLoop: // Export if there were errors. ch <- prometheus.MustNewConstMetric( prometheus.NewDesc( - "wmi_textfile_scrape_error", + prometheus.BuildFQName(Namespace, "textfile", "scrape_error"), "1 if there was an error opening or reading a file, 0 otherwise", nil, nil, ), diff --git a/exporter.go b/exporter.go index 42e8e636..8deed2fb 100644 --- a/exporter.go +++ b/exporter.go @@ -38,19 +38,19 @@ const ( var ( scrapeDurationDesc = prometheus.NewDesc( prometheus.BuildFQName(collector.Namespace, "exporter", "collector_duration_seconds"), - "wmi_exporter: Duration of a collection.", + "windows_exporter: Duration of a collection.", []string{"collector"}, nil, ) scrapeSuccessDesc = prometheus.NewDesc( prometheus.BuildFQName(collector.Namespace, "exporter", "collector_success"), - "wmi_exporter: Whether the collector was successful.", + "windows_exporter: Whether the collector was successful.", []string{"collector"}, nil, ) scrapeTimeoutDesc = prometheus.NewDesc( prometheus.BuildFQName(collector.Namespace, "exporter", "collector_timeout"), - "wmi_exporter: Whether the collector timed out.", + "windows_exporter: Whether the collector timed out.", []string{"collector"}, nil, ) @@ -452,7 +452,7 @@ func (mh *metricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { reg.MustRegister( prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}), prometheus.NewGoCollector(), - version.NewCollector("wmi_exporter"), + version.NewCollector("windows_exporter"), ) h := promhttp.HandlerFor(reg, promhttp.HandlerOpts{}) From 6efa6bed42462800467fb6be6680e6f382bc1f0d Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 24 May 2020 20:38:28 +0200 Subject: [PATCH 10/41] Update textfile collector default directory --- collector/textfile.go | 2 +- docs/collector.textfile.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/collector/textfile.go b/collector/textfile.go index 3caf9808..6881a7ca 100644 --- a/collector/textfile.go +++ b/collector/textfile.go @@ -37,7 +37,7 @@ var ( textFileDirectory = kingpin.Flag( "collector.textfile.directory", "Directory to read text files with metrics from.", - ).Default("C:\\Program Files\\wmi_exporter\\textfile_inputs").String() + ).Default("C:\\Program Files\\windows_exporter\\textfile_inputs").String() mtimeDesc = prometheus.NewDesc( prometheus.BuildFQName(Namespace, "textfile", "mtime_seconds"), diff --git a/docs/collector.textfile.md b/docs/collector.textfile.md index 6fa42c14..fad447f9 100644 --- a/docs/collector.textfile.md +++ b/docs/collector.textfile.md @@ -14,7 +14,7 @@ Enabled by default? | Yes The directory containing the files to be ingested. Only files with the extension `.prom` are read. The `.prom` file must end with an empty line feed to work properly. -Default value: `C:\Program Files\wmi_exporter\textfile_inputs` +Default value: `C:\Program Files\windows_exporter\textfile_inputs` Required: No @@ -25,8 +25,8 @@ are collected to give information about the reading of the metrics themselves. Name | Description | Type | Labels -----|-------------|------|------- -`wmi_textfile_scrape_error` | 1 if there was an error opening or reading a file, 0 otherwise | gauge | None -`wmi_textfile_mtime_seconds` | Unix epoch-formatted mtime (modified time) of textfiles successfully read | gauge | file +`windows_textfile_scrape_error` | 1 if there was an error opening or reading a file, 0 otherwise | gauge | None +`windows_textfile_mtime_seconds` | Unix epoch-formatted mtime (modified time) of textfiles successfully read | gauge | file ### Example metric _This collector does not yet have explained examples, we would appreciate your help adding them!_ @@ -38,7 +38,7 @@ _This collector does not yet have any useful queries added, we would appreciate _This collector does not yet have alerting examples, we would appreciate your help adding them!_ # Example use -This Powershell script, when run in the `collector.textfile.directory` (default `C:\Program Files\wmi_exporter\textfile_inputs`), generates a valid `.prom` file that should successfully ingested by wmi_exporter. +This Powershell script, when run in the `collector.textfile.directory` (default `C:\Program Files\windows_exporter\textfile_inputs`), generates a valid `.prom` file that should successfully ingested by windows_exporter. ```Powershell $alpha = 42 From 10caabe0b1de58537a777b6ac81c2aa32cfdd89c Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 24 May 2020 20:42:23 +0200 Subject: [PATCH 11/41] Update CI and installer --- .promu.yml | 4 ++-- appveyor.yml | 12 +++++----- installer/build.ps1 | 8 +++---- ...{wmi_exporter.wxs => windows_exporter.wxs} | 22 +++++++++---------- 4 files changed, 23 insertions(+), 23 deletions(-) rename installer/{wmi_exporter.wxs => windows_exporter.wxs} (65%) diff --git a/.promu.yml b/.promu.yml index 6dde96d1..61a975bb 100644 --- a/.promu.yml +++ b/.promu.yml @@ -1,8 +1,8 @@ repository: - path: github.com/martinlindhe/wmi_exporter + path: github.com/prometheus-community/windows_exporter build: binaries: - - name: wmi_exporter + - name: windows_exporter ldflags: | -X github.com/prometheus/common/version.Version={{.Version}} -X github.com/prometheus/common/version.Revision={{.Revision}} diff --git a/appveyor.yml b/appveyor.yml index 31ab881b..02d6bee5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ environment: GOPATH: c:\gopath GO111MODULE: on -clone_folder: c:\gopath\src\github.com\martinlindhe\wmi_exporter +clone_folder: c:\gopath\src\github.com\prometheus-community\windows_exporter install: - mkdir %GOPATH%\bin @@ -42,7 +42,7 @@ build_script: make crossbuild # GH requires all files to have different names, so add version/arch to differentiate foreach($Arch in "amd64","386") { - Rename-Item output\$Arch\wmi_exporter.exe -NewName wmi_exporter-$Version-$Arch.exe + Rename-Item output\$Arch\windows_exporter.exe -NewName windows_exporter-$Version-$Arch.exe } after_build: @@ -56,9 +56,9 @@ after_build: # The MSI version is not semver compliant, so just take the numerical parts $MSIVersion = $env:APPVEYOR_REPO_TAG_NAME -replace '^v?([0-9\.]+).*$','$1' foreach($Arch in "amd64","386") { - Write-Verbose "Building wmi_exporter $MSIVersion msi for $Arch" - .\installer\build.ps1 -PathToExecutable .\output\$Arch\wmi_exporter-$BuildVersion-$Arch.exe -Version $MSIVersion -Arch "$Arch" - Move-Item installer\Output\wmi_exporter-$MSIVersion-$Arch.msi output\$Arch\ + Write-Verbose "Building windows_exporter $MSIVersion msi for $Arch" + .\installer\build.ps1 -PathToExecutable .\output\$Arch\windows_exporter-$BuildVersion-$Arch.exe -Version $MSIVersion -Arch "$Arch" + Move-Item installer\Output\windows_exporter-$MSIVersion-$Arch.msi output\$Arch\ } - promu checksum output\ @@ -68,7 +68,7 @@ artifacts: deploy: - provider: GitHub - description: WMI Exporter version $(appveyor_build_version) + description: windows_exporter version $(appveyor_build_version) artifact: Artifacts auth_token: secure: 'CrXWeTf7qONUOEki5olFfGEUPMLDeHj61koDXV3OVEaLgtACmnVHsKUub9POflda' diff --git a/installer/build.ps1 b/installer/build.ps1 index c643d28a..46fb1c17 100644 --- a/installer/build.ps1 +++ b/installer/build.ps1 @@ -48,13 +48,13 @@ Get-FileIfNotExists "https://github.com/wixtoolset/wix3/releases/download/wix311 mkdir -Force WiX | Out-Null Expand-Archive -Path "${sourceDir}\wix-binaries.zip" -DestinationPath WiX -Force -Copy-Item -Force $PathToExecutable Work/wmi_exporter.exe +Copy-Item -Force $PathToExecutable Work/windows_exporter.exe -Write-Verbose "Creating wmi_exporter-${Version}-${Arch}.msi" +Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi" $wixArch = @{"amd64" = "x64"; "386" = "x86"}[$Arch] $wixOpts = "-ext WixFirewallExtension -ext WixUtilExtension" -Invoke-Expression "WiX\candle.exe -nologo -arch $wixArch $wixOpts -out Work\wmi_exporter.wixobj -dVersion=`"$Version`" wmi_exporter.wxs" -Invoke-Expression "WiX\light.exe -nologo -spdb $wixOpts -out `"Output\wmi_exporter-${Version}-${Arch}.msi`" Work\wmi_exporter.wixobj" +Invoke-Expression "WiX\candle.exe -nologo -arch $wixArch $wixOpts -out Work\windows_exporter.wixobj -dVersion=`"$Version`" windows_exporter.wxs" +Invoke-Expression "WiX\light.exe -nologo -spdb $wixOpts -out `"Output\windows_exporter-${Version}-${Arch}.msi`" Work\windows_exporter.wixobj" Write-Verbose "Done!" Pop-Location diff --git a/installer/wmi_exporter.wxs b/installer/windows_exporter.wxs similarity index 65% rename from installer/wmi_exporter.wxs rename to installer/windows_exporter.wxs index e84427ee..f880baf3 100644 --- a/installer/wmi_exporter.wxs +++ b/installer/windows_exporter.wxs @@ -8,12 +8,12 @@ - - - + + @@ -31,7 +31,7 @@ - + @@ -42,14 +42,14 @@ - - + + - + - - + + From 22672fc15fb68c53d0826bcc80730637c3c2e408 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 24 May 2020 20:43:37 +0200 Subject: [PATCH 12/41] Update console_template metrics --- .../console_templates/windows-overview.html | 140 ++++++++++++++++++ contrib/console_templates/wmi-overview.html | 140 ------------------ 2 files changed, 140 insertions(+), 140 deletions(-) create mode 100644 contrib/console_templates/windows-overview.html delete mode 100644 contrib/console_templates/wmi-overview.html diff --git a/contrib/console_templates/windows-overview.html b/contrib/console_templates/windows-overview.html new file mode 100644 index 00000000..c7090c16 --- /dev/null +++ b/contrib/console_templates/windows-overview.html @@ -0,0 +1,140 @@ +{{ template "head" . }} + +{{ template "prom_content_head" . }} +

Node Overview - {{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}

+ +

CPU Usage

+
+ + +

Network Utilization

+
+ + +

Disk I/O Utilization

+
+ + +

Memory

+
+ + +{{ template "prom_right_table_head" }} + Overview + + User CPU + {{ template "prom_query_drilldown" (args (printf "sum(irate(windows_cpu_time_total{job='node',instance='%s',mode='user'}[5m])) * 100 / count(count by (cpu)(windows_cpu_time_total{job='node',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }} + + + Privileged CPU + {{ template "prom_query_drilldown" (args (printf "sum(irate(windows_cpu_time_total{job='node',instance='%s',mode='privileged'}[5m])) * 100 / count(count by (cpu)(windows_cpu_time_total{job='node',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }} + + + Memory Total + {{ template "prom_query_drilldown" (args (printf "windows_cs_physical_memory_bytes{job='node',instance='%s'}" .Params.instance) "B" "humanize1024") }} + + + Memory Free + {{ template "prom_query_drilldown" (args (printf "windows_os_physical_memory_free_bytes{job='node',instance='%s'}" .Params.instance) "B" "humanize1024") }} + + + Network + +{{ range printf "windows_net_bytes_received_total{job='node',instance='%s',nic!='isatap_ec2_internal'}" .Params.instance | query | sortByLabel "nic" }} + + {{ .Labels.nic }} Received + {{ template "prom_query_drilldown" (args (printf "irate(windows_net_bytes_received_total{job='node',instance='%s',nic='%s'}[5m])" .Labels.instance .Labels.nic) "B/s" "humanize") }} + + + {{ .Labels.nic }} Transmitted + {{ template "prom_query_drilldown" (args (printf "irate(windows_net_bytes_sent_total{job='node',instance='%s',nic='%s'}[5m])" .Labels.instance .Labels.nic) "B/s" "humanize") }} + +{{ end }} + + + Disks + +{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }} + + {{ .Labels.volume }} Utilization + {{ template "prom_query_drilldown" (args (printf "100 - irate(windows_logical_disk_idle_seconds_total{job='node',instance='%s',volume='%s'}[5m]) * 100" .Labels.instance .Labels.volume) "%" "printf.1f") }} + +{{ end }} +{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }} + + {{ .Labels.volume }} Throughput + {{ template "prom_query_drilldown" (args (printf "irate(windows_logical_disk_read_bytes_total{job='node',instance='%s',volume='%s'}[5m]) + irate(windows_logical_disk_write_bytes_total{job='node',instance='%s',volume='%s'}[5m])" .Labels.instance .Labels.volume .Labels.instance .Labels.volume) "B/s" "humanize") }} + +{{ end }} + + Filesystem Fullness + +{{ define "roughlyNearZero" }} +{{ if gt .1 . }}~0{{ else }}{{ printf "%.1f" . }}{{ end }} +{{ end }} +{{ range printf "windows_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }} + + {{ .Labels.volume }} + {{ template "prom_query_drilldown" (args (printf "100 - windows_logical_disk_free_bytes{job='node',instance='%s',volume='%s'} / windows_logical_disk_size_bytes{job='node'} * 100" .Labels.instance .Labels.volume) "%" "roughlyNearZero") }} + +{{ end }} + +{{ template "prom_right_table_tail" }} + +{{ template "prom_content_tail" . }} + +{{ template "tail" }} diff --git a/contrib/console_templates/wmi-overview.html b/contrib/console_templates/wmi-overview.html deleted file mode 100644 index 2a2282c6..00000000 --- a/contrib/console_templates/wmi-overview.html +++ /dev/null @@ -1,140 +0,0 @@ -{{ template "head" . }} - -{{ template "prom_content_head" . }} -

Node Overview - {{ reReplaceAll "(.*?://)([^:/]+?)(:\\d+)?/.*" "$2" .Params.instance }}

- -

CPU Usage

-
- - -

Network Utilization

-
- - -

Disk I/O Utilization

-
- - -

Memory

-
- - -{{ template "prom_right_table_head" }} - Overview - - User CPU - {{ template "prom_query_drilldown" (args (printf "sum(irate(wmi_cpu_time_total{job='node',instance='%s',mode='user'}[5m])) * 100 / count(count by (cpu)(wmi_cpu_time_total{job='node',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }} - - - Privileged CPU - {{ template "prom_query_drilldown" (args (printf "sum(irate(wmi_cpu_time_total{job='node',instance='%s',mode='privileged'}[5m])) * 100 / count(count by (cpu)(wmi_cpu_time_total{job='node',instance='%s'}))" .Params.instance .Params.instance) "%" "printf.1f") }} - - - Memory Total - {{ template "prom_query_drilldown" (args (printf "wmi_cs_physical_memory_bytes{job='node',instance='%s'}" .Params.instance) "B" "humanize1024") }} - - - Memory Free - {{ template "prom_query_drilldown" (args (printf "wmi_os_physical_memory_free_bytes{job='node',instance='%s'}" .Params.instance) "B" "humanize1024") }} - - - Network - -{{ range printf "wmi_net_bytes_received_total{job='node',instance='%s',nic!='isatap_ec2_internal'}" .Params.instance | query | sortByLabel "nic" }} - - {{ .Labels.nic }} Received - {{ template "prom_query_drilldown" (args (printf "irate(wmi_net_bytes_received_total{job='node',instance='%s',nic='%s'}[5m])" .Labels.instance .Labels.nic) "B/s" "humanize") }} - - - {{ .Labels.nic }} Transmitted - {{ template "prom_query_drilldown" (args (printf "irate(wmi_net_bytes_sent_total{job='node',instance='%s',nic='%s'}[5m])" .Labels.instance .Labels.nic) "B/s" "humanize") }} - -{{ end }} - - - Disks - -{{ range printf "wmi_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }} - - {{ .Labels.volume }} Utilization - {{ template "prom_query_drilldown" (args (printf "100 - irate(wmi_logical_disk_idle_seconds_total{job='node',instance='%s',volume='%s'}[5m]) * 100" .Labels.instance .Labels.volume) "%" "printf.1f") }} - -{{ end }} -{{ range printf "wmi_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }} - - {{ .Labels.volume }} Throughput - {{ template "prom_query_drilldown" (args (printf "irate(wmi_logical_disk_read_bytes_total{job='node',instance='%s',volume='%s'}[5m]) + irate(wmi_logical_disk_write_bytes_total{job='node',instance='%s',volume='%s'}[5m])" .Labels.instance .Labels.volume .Labels.instance .Labels.volume) "B/s" "humanize") }} - -{{ end }} - - Filesystem Fullness - -{{ define "roughlyNearZero" }} -{{ if gt .1 . }}~0{{ else }}{{ printf "%.1f" . }}{{ end }} -{{ end }} -{{ range printf "wmi_logical_disk_size_bytes{job='node',instance='%s',volume!~'^HarddiskVolume.*$'}" .Params.instance | query | sortByLabel "volume" }} - - {{ .Labels.volume }} - {{ template "prom_query_drilldown" (args (printf "100 - wmi_logical_disk_free_bytes{job='node',instance='%s',volume='%s'} / wmi_logical_disk_size_bytes{job='node'} * 100" .Labels.instance .Labels.volume) "%" "roughlyNearZero") }} - -{{ end }} - -{{ template "prom_right_table_tail" }} - -{{ template "prom_content_tail" . }} - -{{ template "tail" }} From c1a137f7a87f2df664aa8fedcfbc58c7946745f3 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 24 May 2020 20:45:54 +0200 Subject: [PATCH 13/41] Rename misc variables wmi->windows --- exporter.go | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/exporter.go b/exporter.go index 8deed2fb..3b8b6562 100644 --- a/exporter.go +++ b/exporter.go @@ -23,8 +23,7 @@ import ( "gopkg.in/alecthomas/kingpin.v2" ) -// WmiCollector implements the prometheus.Collector interface. -type WmiCollector struct { +type windowsCollector struct { maxScrapeDuration time.Duration collectors map[string]collector.Collector } @@ -32,7 +31,7 @@ type WmiCollector struct { const ( defaultCollectors = "cpu,cs,logical_disk,net,os,service,system,textfile" defaultCollectorsPlaceholder = "[defaults]" - serviceName = "wmi_exporter" + serviceName = "windows_exporter" ) var ( @@ -74,7 +73,7 @@ var ( // Describe sends all the descriptors of the collectors included to // the provided channel. -func (coll WmiCollector) Describe(ch chan<- *prometheus.Desc) { +func (coll windowsCollector) Describe(ch chan<- *prometheus.Desc) { ch <- scrapeDurationDesc ch <- scrapeSuccessDesc } @@ -89,7 +88,7 @@ const ( // Collect sends the collected metrics from each of the collectors to // prometheus. -func (coll WmiCollector) Collect(ch chan<- prometheus.Metric) { +func (coll windowsCollector) Collect(ch chan<- prometheus.Metric) { ch <- prometheus.MustNewConstMetric( startTimeDesc, prometheus.CounterValue, @@ -244,8 +243,8 @@ func loadCollectors(list string) (map[string]collector.Collector, error) { func initWbem() { // This initialization prevents a memory leak on WMF 5+. See - // https://github.com/martinlindhe/wmi_exporter/issues/77 and linked issues - // for details. + // https://github.com/prometheus-community/windows_exporter/issues/77 and + // linked issues for details. log.Debugf("Initializing SWbemServices") s, err := wmi.InitializeSWbemServices(wmi.DefaultClient) if err != nil { @@ -259,7 +258,7 @@ func main() { var ( listenAddress = kingpin.Flag( "telemetry.addr", - "host:port for WMI exporter.", + "host:port for exporter.", ).Default(":9182").String() metricsPath = kingpin.Flag( "telemetry.path", @@ -284,7 +283,7 @@ func main() { ) log.AddFlags(kingpin.CommandLine) - kingpin.Version(version.Print("wmi_exporter")) + kingpin.Version(version.Print("windows_exporter")) kingpin.HelpFlag.Short('h') kingpin.Parse() @@ -312,7 +311,7 @@ func main() { stopCh := make(chan bool) if !isInteractive { go func() { - err = svc.Run(serviceName, &wmiExporterService{stopCh: stopCh}) + err = svc.Run(serviceName, &windowsExporterService{stopCh: stopCh}) if err != nil { log.Errorf("Failed to start service: %v", err) } @@ -328,8 +327,8 @@ func main() { h := &metricsHandler{ timeoutMargin: *timeoutMargin, - collectorFactory: func(timeout time.Duration) *WmiCollector { - return &WmiCollector{ + collectorFactory: func(timeout time.Duration) *windowsCollector { + return &windowsCollector{ collectors: collectors, maxScrapeDuration: timeout, } @@ -340,25 +339,26 @@ func main() { http.HandleFunc("/health", healthCheck) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte(` -WMI Exporter +windows_exporter -

WMI Exporter

+

windows_exporter

Metrics

+

` + version.Info() + `

`)) }) - log.Infoln("Starting WMI exporter", version.Info()) + log.Infoln("Starting windows_exporter", version.Info()) log.Infoln("Build context", version.BuildContext()) go func() { log.Infoln("Starting server on", *listenAddress) - log.Fatalf("cannot start WMI exporter: %s", http.ListenAndServe(*listenAddress, nil)) + log.Fatalf("cannot start windows_exporter: %s", http.ListenAndServe(*listenAddress, nil)) }() for { if <-stopCh { - log.Info("Shutting down WMI exporter") + log.Info("Shutting down windows_exporter") break } } @@ -399,11 +399,11 @@ func withConcurrencyLimit(n int, next http.HandlerFunc) http.HandlerFunc { } } -type wmiExporterService struct { +type windowsExporterService struct { stopCh chan<- bool } -func (s *wmiExporterService) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) { +func (s *windowsExporterService) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) { const cmdsAccepted = svc.AcceptStop | svc.AcceptShutdown changes <- svc.Status{State: svc.StartPending} changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted} @@ -428,7 +428,7 @@ loop: type metricsHandler struct { timeoutMargin float64 - collectorFactory func(timeout time.Duration) *WmiCollector + collectorFactory func(timeout time.Duration) *windowsCollector } func (mh *metricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { From a1db538118800b04e610d842ae8a6380e4505948 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 24 May 2020 20:47:16 +0200 Subject: [PATCH 14/41] Update docs --- README.md | 24 +- docs/README.md | 2 +- docs/collector-template.md | 94 +-- docs/collector.ad.md | 176 +++--- docs/collector.adfs.md | 102 ++-- docs/collector.container.md | 84 +-- docs/collector.cpu.md | 24 +- docs/collector.cs.md | 60 +- docs/collector.dns.md | 98 ++-- docs/collector.exchange.md | 74 +-- docs/collector.hyperv.md | 204 +++---- docs/collector.iis.md | 280 ++++----- docs/collector.logical_disk.md | 8 +- docs/collector.logon.md | 6 +- docs/collector.memory.md | 124 ++-- docs/collector.msmq.md | 66 +-- docs/collector.mssql.md | 550 +++++++++--------- docs/collector.net.md | 124 ++-- docs/collector.netframework_clrexceptions.md | 63 +- docs/collector.netframework_clrinterop.md | 61 +- docs/collector.netframework_clrjit.md | 63 +- docs/collector.netframework_clrloading.md | 73 ++- ...llector.netframework_clrlocksandthreads.md | 69 ++- docs/collector.netframework_clrmemory.md | 79 ++- docs/collector.netframework_clrremoting.md | 66 +-- docs/collector.netframework_clrsecurity.md | 62 +- docs/collector.os.md | 132 ++--- docs/collector.process.md | 130 ++--- docs/collector.remote_fx.md | 102 ++-- docs/collector.service.md | 216 +++---- docs/collector.system.md | 80 +-- docs/collector.tcp.md | 72 +-- docs/collector.terminal_services.md | 96 +-- docs/collector.textfile.md | 112 ++-- docs/collector.thermalzone.md | 6 +- docs/collector.vmware.md | 92 +-- 36 files changed, 1834 insertions(+), 1840 deletions(-) diff --git a/README.md b/README.md index f8f3afc2..c30b6486 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# WMI exporter +# windows_exporter -[![Build status](https://ci.appveyor.com/api/projects/status/ljwan71as6pf2joe/branch/master?svg=true)](https://ci.appveyor.com/project/martinlindhe/wmi-exporter) +[![Build status](https://ci.appveyor.com/api/projects/status/ljwan71as6pf2joe/branch/master?svg=true)](https://ci.appveyor.com/project/prometheus-community/windows_exporter) -Prometheus exporter for Windows machines, using the WMI (Windows Management Instrumentation). +A Prometheus exporter for Windows machines. ## Collectors @@ -46,9 +46,9 @@ Name | Description | Enabled by default See the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples. ## Installation -The latest release can be downloaded from the [releases page](https://github.com/martinlindhe/wmi_exporter/releases). +The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases). -Each release provides a .msi installer. The installer will setup the WMI Exporter as a Windows service, as well as create an exception in the Windows Firewall. +Each release provides a .msi installer. The installer will setup the windows_exporter as a Windows service, as well as create an exception in the Windows Firewall. If the installer is run without any parameters, the exporter will run with default settings for enabled collectors, ports, etc. The following parameters are available: @@ -74,21 +74,21 @@ msiexec /i ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--c On some older versions of Windows you may need to surround parameter values with double quotes to get the install command parsing properly: ```powershell -msiexec /i C:\Users\Administrator\Downloads\wmi_exporter.msi ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,thermalzone" TEXTFILE_DIR="C:\custom_metrics\" +msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,thermalzone" TEXTFILE_DIR="C:\custom_metrics\" ``` ## Roadmap -See [open issues](https://github.com/martinlindhe/wmi_exporter/issues) +See [open issues](https://github.com/prometheus-community/windows_exporter/issues) ## Usage go get -u github.com/prometheus/promu - go get -u github.com/martinlindhe/wmi_exporter - cd $env:GOPATH/src/github.com/martinlindhe/wmi_exporter + go get -u github.com/prometheus-community/windows_exporter + cd $env:GOPATH/src/github.com/prometheus-community/windows_exporter promu build -v . - .\wmi_exporter.exe + .\windows_exporter.exe The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182) @@ -96,11 +96,11 @@ The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182 ### Enable only service collector and specify a custom query - .\wmi_exporter.exe --collectors.enabled "service" --collector.service.services-where "Name='wmi_exporter'" + .\windows_exporter.exe --collectors.enabled "service" --collector.service.services-where "Name='windows_exporter'" ### Enable only process collector and specify a custom query - .\wmi_exporter.exe --collectors.enabled "process" --collector.process.whitelist="firefox.+" + .\windows_exporter.exe --collectors.enabled "process" --collector.process.whitelist="firefox.+" When there are multiple processes with the same name, WMI represents those after the first instance as `process-name#index`. So to get them all, rather than just the first one, the [regular expression](https://en.wikipedia.org/wiki/Regular_expression) must use `.+`. See [process](docs/collector.process.md) for more information. diff --git a/docs/README.md b/docs/README.md index 4188cbb0..eb739864 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,5 @@ # Documentation -This directory contains documentation of the collectors in the WMI exporter, with information such as what metrics are exported, any flags for additional configuration, and some example usage in alerts and queries. +This directory contains documentation of the collectors in the windows_exporter, with information such as what metrics are exported, any flags for additional configuration, and some example usage in alerts and queries. # Collectors - [`ad`](collector.ad.md) diff --git a/docs/collector-template.md b/docs/collector-template.md index 116def4d..62a6b761 100644 --- a/docs/collector-template.md +++ b/docs/collector-template.md @@ -1,47 +1,47 @@ -# %name% collector - -The %name% collector exposes metrics about ... - -||| --|- -Metric name prefix | `%name%` -Classes | [`...`](https://msdn.microsoft.com/en-us/library/...) -Enabled by default? | Yes/No - -## Flags - -### `--collector....` - -Add description... - -Example: `--collector....` - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_...` | ... | counter/gauge/histogram/summary | ... - -### Example metric - -...: - -`wmi_...{...} 1` - -## Useful queries -### Add queries... - -`...` - -## Alerting examples -### Add alerts... - -```yaml - - alert: "" - expr: "" - for: "" - labels: - urgency: "" - annotations: - summary: "" -``` +# %name% collector + +The %name% collector exposes metrics about ... + +||| +-|- +Metric name prefix | `%name%` +Classes | [`...`](https://msdn.microsoft.com/en-us/library/...) +Enabled by default? | Yes/No + +## Flags + +### `--collector....` + +Add description... + +Example: `--collector....` + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_...` | ... | counter/gauge/histogram/summary | ... + +### Example metric + +...: + +`windows_...{...} 1` + +## Useful queries +### Add queries... + +`...` + +## Alerting examples +### Add alerts... + +```yaml + - alert: "" + expr: "" + for: "" + labels: + urgency: "" + annotations: + summary: "" +``` diff --git a/docs/collector.ad.md b/docs/collector.ad.md index 6f71e191..9ae159b9 100644 --- a/docs/collector.ad.md +++ b/docs/collector.ad.md @@ -1,88 +1,88 @@ -# ad collector - -The ad collector exposes metrics about a Active Directory Domain Services domain controller - -||| --|- -Metric name prefix | `ad` -Classes | [`Win32_PerfRawData_DirectoryServices_DirectoryServices`](https://msdn.microsoft.com/en-us/library/ms803980.aspx) -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_ad_address_book_operations_total` | _Not yet documented_ | counter | `operation` -`wmi_ad_address_book_client_sessions` | _Not yet documented_ | gauge | None -`wmi_ad_approximate_highest_distinguished_name_tag` | _Not yet documented_ | gauge | None -`wmi_ad_atq_estimated_delay_seconds` | _Not yet documented_ | gauge | None -`wmi_ad_atq_outstanding_requests` | _Not yet documented_ | gauge | None -`wmi_ad_atq_average_request_latency` | _Not yet documented_ | gauge | None -`wmi_ad_atq_current_threads` | _Not yet documented_ | gauge | `service` -`wmi_ad_searches_total` | _Not yet documented_ | counter | `scope` -`wmi_ad_database_operations_total` | _Not yet documented_ | counter | `operation` -`wmi_ad_binds_total` | _Not yet documented_ | counter | `bind_method` -`wmi_ad_replication_highest_usn` | _Not yet documented_ | counter | `state` -`wmi_ad_replication_data_intrasite_bytes_total` | _Not yet documented_ | counter | `direction` -`wmi_ad_replication_data_intersite_bytes_total` | _Not yet documented_ | counter | `direction` -`wmi_ad_replication_inbound_sync_objects_remaining` | _Not yet documented_ | gauge | None -`wmi_ad_replication_inbound_link_value_updates_remaining` | _Not yet documented_ | gauge | None -`wmi_ad_replication_inbound_objects_updated_total` | _Not yet documented_ | counter | None -`wmi_ad_replication_inbound_objects_filtered_total` | _Not yet documented_ | counter | None -`wmi_ad_replication_inbound_properties_updated_total` | _Not yet documented_ | counter | None -`wmi_ad_replication_inbound_properties_filtered_total` | _Not yet documented_ | counter | None -`wmi_ad_replication_pending_operations` | _Not yet documented_ | gauge | None -`wmi_ad_replication_pending_synchronizations` | _Not yet documented_ | gauge | None -`wmi_ad_replication_sync_requests_total` | _Not yet documented_ | counter | None -`wmi_ad_replication_sync_requests_success_total` | _Not yet documented_ | counter | None -`wmi_ad_replication_sync_requests_schema_mismatch_failure_total` | _Not yet documented_ | counter | None -`wmi_ad_name_translations_total` | _Not yet documented_ | counter | `target_name` -`wmi_ad_change_monitors_registered` | _Not yet documented_ | gauge | None -`wmi_ad_change_monitor_updates_pending` | _Not yet documented_ | gauge | None -`wmi_ad_name_cache_hits_total` | _Not yet documented_ | counter | None -`wmi_ad_name_cache_lookups_total` | _Not yet documented_ | counter | None -`wmi_ad_directory_operations_total` | _Not yet documented_ | counter | `operation`, `origin` -`wmi_ad_directory_search_suboperations_total` | _Not yet documented_ | counter | None -`wmi_ad_security_descriptor_propagation_events_total` | _Not yet documented_ | counter | None -`wmi_ad_security_descriptor_propagation_events_queued` | _Not yet documented_ | gauge | None -`wmi_ad_security_descriptor_propagation_access_wait_total_seconds` | _Not yet documented_ | gauge | None -`wmi_ad_security_descriptor_propagation_items_queued_total` | _Not yet documented_ | counter | None -`wmi_ad_directory_service_threads` | _Not yet documented_ | gauge | None -`wmi_ad_ldap_closed_connections_total` | _Not yet documented_ | counter | None -`wmi_ad_ldap_opened_connections_total` | _Not yet documented_ | counter | `type` -`wmi_ad_ldap_active_threads` | _Not yet documented_ | gauge | None -`wmi_ad_ldap_last_bind_time_seconds` | _Not yet documented_ | gauge | None -`wmi_ad_ldap_searches_total` | _Not yet documented_ | counter | None -`wmi_ad_ldap_udp_operations_total` | _Not yet documented_ | counter | None -`wmi_ad_ldap_writes_total` | _Not yet documented_ | counter | None -`wmi_ad_link_values_cleaned_total` | _Not yet documented_ | counter | None -`wmi_ad_phantom_objects_cleaned_total` | _Not yet documented_ | counter | None -`wmi_ad_phantom_objects_visited_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_group_membership_evaluations_total` | _Not yet documented_ | counter | `group_type` -`wmi_ad_sam_group_membership_global_catalog_evaluations_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_group_membership_evaluations_nontransitive_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_group_membership_evaluations_transitive_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_group_evaluation_latency` | _Not yet documented_ | gauge | `evaluation_type` -`wmi_ad_sam_computer_creation_requests_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_computer_creation_successful_requests_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_user_creation_requests_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_user_creation_successful_requests_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_query_display_requests_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_enumerations_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_membership_changes_total` | _Not yet documented_ | counter | None -`wmi_ad_sam_password_changes_total` | _Not yet documented_ | counter | None -`wmi_ad_tombstoned_objects_collected_total` | _Not yet documented_ | counter | None -`wmi_ad_tombstoned_objects_visited_total` | _Not yet documented_ | counter | None - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# ad collector + +The ad collector exposes metrics about a Active Directory Domain Services domain controller + +||| +-|- +Metric name prefix | `ad` +Classes | [`Win32_PerfRawData_DirectoryServices_DirectoryServices`](https://msdn.microsoft.com/en-us/library/ms803980.aspx) +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_ad_address_book_operations_total` | _Not yet documented_ | counter | `operation` +`windows_ad_address_book_client_sessions` | _Not yet documented_ | gauge | None +`windows_ad_approximate_highest_distinguished_name_tag` | _Not yet documented_ | gauge | None +`windows_ad_atq_estimated_delay_seconds` | _Not yet documented_ | gauge | None +`windows_ad_atq_outstanding_requests` | _Not yet documented_ | gauge | None +`windows_ad_atq_average_request_latency` | _Not yet documented_ | gauge | None +`windows_ad_atq_current_threads` | _Not yet documented_ | gauge | `service` +`windows_ad_searches_total` | _Not yet documented_ | counter | `scope` +`windows_ad_database_operations_total` | _Not yet documented_ | counter | `operation` +`windows_ad_binds_total` | _Not yet documented_ | counter | `bind_method` +`windows_ad_replication_highest_usn` | _Not yet documented_ | counter | `state` +`windows_ad_replication_data_intrasite_bytes_total` | _Not yet documented_ | counter | `direction` +`windows_ad_replication_data_intersite_bytes_total` | _Not yet documented_ | counter | `direction` +`windows_ad_replication_inbound_sync_objects_remaining` | _Not yet documented_ | gauge | None +`windows_ad_replication_inbound_link_value_updates_remaining` | _Not yet documented_ | gauge | None +`windows_ad_replication_inbound_objects_updated_total` | _Not yet documented_ | counter | None +`windows_ad_replication_inbound_objects_filtered_total` | _Not yet documented_ | counter | None +`windows_ad_replication_inbound_properties_updated_total` | _Not yet documented_ | counter | None +`windows_ad_replication_inbound_properties_filtered_total` | _Not yet documented_ | counter | None +`windows_ad_replication_pending_operations` | _Not yet documented_ | gauge | None +`windows_ad_replication_pending_synchronizations` | _Not yet documented_ | gauge | None +`windows_ad_replication_sync_requests_total` | _Not yet documented_ | counter | None +`windows_ad_replication_sync_requests_success_total` | _Not yet documented_ | counter | None +`windows_ad_replication_sync_requests_schema_mismatch_failure_total` | _Not yet documented_ | counter | None +`windows_ad_name_translations_total` | _Not yet documented_ | counter | `target_name` +`windows_ad_change_monitors_registered` | _Not yet documented_ | gauge | None +`windows_ad_change_monitor_updates_pending` | _Not yet documented_ | gauge | None +`windows_ad_name_cache_hits_total` | _Not yet documented_ | counter | None +`windows_ad_name_cache_lookups_total` | _Not yet documented_ | counter | None +`windows_ad_directory_operations_total` | _Not yet documented_ | counter | `operation`, `origin` +`windows_ad_directory_search_suboperations_total` | _Not yet documented_ | counter | None +`windows_ad_security_descriptor_propagation_events_total` | _Not yet documented_ | counter | None +`windows_ad_security_descriptor_propagation_events_queued` | _Not yet documented_ | gauge | None +`windows_ad_security_descriptor_propagation_access_wait_total_seconds` | _Not yet documented_ | gauge | None +`windows_ad_security_descriptor_propagation_items_queued_total` | _Not yet documented_ | counter | None +`windows_ad_directory_service_threads` | _Not yet documented_ | gauge | None +`windows_ad_ldap_closed_connections_total` | _Not yet documented_ | counter | None +`windows_ad_ldap_opened_connections_total` | _Not yet documented_ | counter | `type` +`windows_ad_ldap_active_threads` | _Not yet documented_ | gauge | None +`windows_ad_ldap_last_bind_time_seconds` | _Not yet documented_ | gauge | None +`windows_ad_ldap_searches_total` | _Not yet documented_ | counter | None +`windows_ad_ldap_udp_operations_total` | _Not yet documented_ | counter | None +`windows_ad_ldap_writes_total` | _Not yet documented_ | counter | None +`windows_ad_link_values_cleaned_total` | _Not yet documented_ | counter | None +`windows_ad_phantom_objects_cleaned_total` | _Not yet documented_ | counter | None +`windows_ad_phantom_objects_visited_total` | _Not yet documented_ | counter | None +`windows_ad_sam_group_membership_evaluations_total` | _Not yet documented_ | counter | `group_type` +`windows_ad_sam_group_membership_global_catalog_evaluations_total` | _Not yet documented_ | counter | None +`windows_ad_sam_group_membership_evaluations_nontransitive_total` | _Not yet documented_ | counter | None +`windows_ad_sam_group_membership_evaluations_transitive_total` | _Not yet documented_ | counter | None +`windows_ad_sam_group_evaluation_latency` | _Not yet documented_ | gauge | `evaluation_type` +`windows_ad_sam_computer_creation_requests_total` | _Not yet documented_ | counter | None +`windows_ad_sam_computer_creation_successful_requests_total` | _Not yet documented_ | counter | None +`windows_ad_sam_user_creation_requests_total` | _Not yet documented_ | counter | None +`windows_ad_sam_user_creation_successful_requests_total` | _Not yet documented_ | counter | None +`windows_ad_sam_query_display_requests_total` | _Not yet documented_ | counter | None +`windows_ad_sam_enumerations_total` | _Not yet documented_ | counter | None +`windows_ad_sam_membership_changes_total` | _Not yet documented_ | counter | None +`windows_ad_sam_password_changes_total` | _Not yet documented_ | counter | None +`windows_ad_tombstoned_objects_collected_total` | _Not yet documented_ | counter | None +`windows_ad_tombstoned_objects_visited_total` | _Not yet documented_ | counter | None + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.adfs.md b/docs/collector.adfs.md index cd00dfd4..e104dd37 100644 --- a/docs/collector.adfs.md +++ b/docs/collector.adfs.md @@ -1,51 +1,51 @@ -# adfs collector - -The adfs collector exposes metrics about Active Directory Federation Services. Note that this collector has only been tested against ADFS 4.0 (2016). -Other ADFS versions may work but are not tested. - -||| --|- -Metric name prefix | `adfs` -Data source | Perflib -Counters | `AD FS` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_adfs_ad_login_connection_failures` | Total number of connection failures between the ADFS server and the Active Directory domain controller(s) | counter | None -`wmi_adfs_certificate_authentications` | Total number of [User Certificate](https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configure-user-certificate-authentication) authentications. I.E. smart cards or mobile devices with provisioned client certificates | counter | None -`wmi_adfs_device_authentications` | Total number of [device authentications](https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/device-authentication-controls-in-ad-fs) (SignedToken, clientTLS, PkeyAuth). Device authentication is only available on ADFS 2016 or later | counter | None -`wmi_adfs_extranet_account_lockouts` | Total number of [extranet lockouts](https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configure-ad-fs-extranet-smart-lockout-protection). Requires the Extranet Lockout feature to be enabled | counter | None -`wmi_adfs_federated_authentications` | Total number of authentications from federated sources. E.G. Office365 | counter | None -`wmi_adfs_passport_authentications` | Total number of authentications from [Microsoft Passport](https://en.wikipedia.org/wiki/Microsoft_account) (now named Microsoft Account) | counter | None -`wmi_adfs_password_change_failed` | Total number of failed password changes. The Password Change Portal must be enabled in the AD FS Management tool in order to allow user password changes | counter | None -`wmi_adfs_password_change_succeeded` | Total number of succeeded password changes. The Password Change Portal must be enabled in the AD FS Management tool in order to allow user password changes | counter | None -`wmi_adfs_token_requests` | Total number of requested access tokens | counter | None -`wmi_adfs_windows_integrated_authentications` | Total number of Windows integrated authentications using Kerberos or NTLM | counter | None - -### Example metric -Show rate of device authentications in AD FS: -``` -rate(wmi_adfs_device_authentications)[2m] -``` - -## Useful queries - -## Alerting examples -**prometheus.rules** -```yaml - - alert: "HighExtranetLockouts" - expr: "rate(wmi_adfs_extranet_account_lockouts)[2m] > 100" - for: "10m" - labels: - severity: "high" - annotations: - summary: "High number of AD FS extranet lockouts" - description: "High number of AD FS extranet lockouts may indicate a password spray attack.\n Server: {{ $labels.instance }}\n Number of lockouts: {{ $value }}" -``` +# adfs collector + +The adfs collector exposes metrics about Active Directory Federation Services. Note that this collector has only been tested against ADFS 4.0 (2016). +Other ADFS versions may work but are not tested. + +||| +-|- +Metric name prefix | `adfs` +Data source | Perflib +Counters | `AD FS` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_adfs_ad_login_connection_failures` | Total number of connection failures between the ADFS server and the Active Directory domain controller(s) | counter | None +`windows_adfs_certificate_authentications` | Total number of [User Certificate](https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configure-user-certificate-authentication) authentications. I.E. smart cards or mobile devices with provisioned client certificates | counter | None +`windows_adfs_device_authentications` | Total number of [device authentications](https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/device-authentication-controls-in-ad-fs) (SignedToken, clientTLS, PkeyAuth). Device authentication is only available on ADFS 2016 or later | counter | None +`windows_adfs_extranet_account_lockouts` | Total number of [extranet lockouts](https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configure-ad-fs-extranet-smart-lockout-protection). Requires the Extranet Lockout feature to be enabled | counter | None +`windows_adfs_federated_authentications` | Total number of authentications from federated sources. E.G. Office365 | counter | None +`windows_adfs_passport_authentications` | Total number of authentications from [Microsoft Passport](https://en.wikipedia.org/wiki/Microsoft_account) (now named Microsoft Account) | counter | None +`windows_adfs_password_change_failed` | Total number of failed password changes. The Password Change Portal must be enabled in the AD FS Management tool in order to allow user password changes | counter | None +`windows_adfs_password_change_succeeded` | Total number of succeeded password changes. The Password Change Portal must be enabled in the AD FS Management tool in order to allow user password changes | counter | None +`windows_adfs_token_requests` | Total number of requested access tokens | counter | None +`windows_adfs_windows_integrated_authentications` | Total number of Windows integrated authentications using Kerberos or NTLM | counter | None + +### Example metric +Show rate of device authentications in AD FS: +``` +rate(windows_adfs_device_authentications)[2m] +``` + +## Useful queries + +## Alerting examples +**prometheus.rules** +```yaml + - alert: "HighExtranetLockouts" + expr: "rate(windows_adfs_extranet_account_lockouts)[2m] > 100" + for: "10m" + labels: + severity: "high" + annotations: + summary: "High number of AD FS extranet lockouts" + description: "High number of AD FS extranet lockouts may indicate a password spray attack.\n Server: {{ $labels.instance }}\n Number of lockouts: {{ $value }}" +``` diff --git a/docs/collector.container.md b/docs/collector.container.md index e12a311c..fecc8b66 100644 --- a/docs/collector.container.md +++ b/docs/collector.container.md @@ -1,42 +1,42 @@ -# container collector - -The container collector exposes metrics about containers running on system - -||| --|- -Metric name prefix | `container` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_container_available` | Available | counter | `container_id` -`wmi_container_count` | Number of containers | gauge | `container_id` -`wmi_container_cpu_usage_seconds_kernelmode` | Run time in Kernel mode in Seconds | counter | `container_id` -`wmi_container_cpu_usage_seconds_usermode` | Run Time in User mode in Seconds | counter | `container_id` -`wmi_container_cpu_usage_seconds_total` | Total Run time in Seconds | counter | `container_id` -`wmi_container_memory_usage_commit_bytes` | Memory Usage Commit Bytes | gauge | `container_id` -`wmi_container_memory_usage_commit_peak_bytes` | Memory Usage Commit Peak Bytes | gauge | `container_id` -`wmi_container_memory_usage_private_working_set_bytes` | Memory Usage Private Working Set Bytes | gauge | `container_id` -`wmi_container_network_receive_bytes_total` | Bytes Received on Interface | counter | `container_id`, `interface` -`wmi_container_network_receive_packets_total` | Packets Received on Interface | counter | `container_id`, `interface` -`wmi_container_network_receive_packets_dropped_total` | Dropped Incoming Packets on Interface | counter | `container_id`, `interface` -`wmi_container_network_transmit_bytes_total` | Bytes Sent on Interface | counter | `container_id`, `interface` -`wmi_container_network_transmit_packets_total` | Packets Sent on Interface | counter | `container_id`, `interface` -`wmi_container_network_transmit_packets_dropped_total` | Dropped Outgoing Packets on Interface | counter | `container_id`, `interface` - -### Example metric -_wmi_container_network_receive_bytes_total{container_id="docker://1bd30e8b8ac28cbd76a9b697b4d7bb9d760267b0733d1bc55c60024e98d1e43e",interface="822179E7-002C-4280-ABBA-28BCFE401826"} 9.3305343e+07_ - -This metric means that total _9.3305343e+07_ bytes received on interface _822179E7-002C-4280-ABBA-28BCFE401826_ for container _docker://1bd30e8b8ac28cbd76a9b697b4d7bb9d760267b0733d1bc55c60024e98d1e43e_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# container collector + +The container collector exposes metrics about containers running on system + +||| +-|- +Metric name prefix | `container` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_container_available` | Available | counter | `container_id` +`windows_container_count` | Number of containers | gauge | `container_id` +`windows_container_cpu_usage_seconds_kernelmode` | Run time in Kernel mode in Seconds | counter | `container_id` +`windows_container_cpu_usage_seconds_usermode` | Run Time in User mode in Seconds | counter | `container_id` +`windows_container_cpu_usage_seconds_total` | Total Run time in Seconds | counter | `container_id` +`windows_container_memory_usage_commit_bytes` | Memory Usage Commit Bytes | gauge | `container_id` +`windows_container_memory_usage_commit_peak_bytes` | Memory Usage Commit Peak Bytes | gauge | `container_id` +`windows_container_memory_usage_private_working_set_bytes` | Memory Usage Private Working Set Bytes | gauge | `container_id` +`windows_container_network_receive_bytes_total` | Bytes Received on Interface | counter | `container_id`, `interface` +`windows_container_network_receive_packets_total` | Packets Received on Interface | counter | `container_id`, `interface` +`windows_container_network_receive_packets_dropped_total` | Dropped Incoming Packets on Interface | counter | `container_id`, `interface` +`windows_container_network_transmit_bytes_total` | Bytes Sent on Interface | counter | `container_id`, `interface` +`windows_container_network_transmit_packets_total` | Packets Sent on Interface | counter | `container_id`, `interface` +`windows_container_network_transmit_packets_dropped_total` | Dropped Outgoing Packets on Interface | counter | `container_id`, `interface` + +### Example metric +_windows_container_network_receive_bytes_total{container_id="docker://1bd30e8b8ac28cbd76a9b697b4d7bb9d760267b0733d1bc55c60024e98d1e43e",interface="822179E7-002C-4280-ABBA-28BCFE401826"} 9.3305343e+07_ + +This metric means that total _9.3305343e+07_ bytes received on interface _822179E7-002C-4280-ABBA-28BCFE401826_ for container _docker://1bd30e8b8ac28cbd76a9b697b4d7bb9d760267b0733d1bc55c60024e98d1e43e_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.cpu.md b/docs/collector.cpu.md index 1871921b..d26af937 100644 --- a/docs/collector.cpu.md +++ b/docs/collector.cpu.md @@ -18,31 +18,31 @@ These metrics are available on all versions of Windows: Name | Description | Type | Labels -----|-------------|------|------- -`wmi_cpu_cstate_seconds_total` | Time spent in low-power idle states | counter | `core`, `state` -`wmi_cpu_time_total` | Time that processor spent in different modes (idle, user, system, ...) | counter | `core`, `mode` -`wmi_cpu_interrupts_total` | Total number of received and serviced hardware interrupts | counter | `core` -`wmi_cpu_dpcs_total` | Total number of received and serviced deferred procedure calls (DPCs) | counter | `core` +`windows_cpu_cstate_seconds_total` | Time spent in low-power idle states | counter | `core`, `state` +`windows_cpu_time_total` | Time that processor spent in different modes (idle, user, system, ...) | counter | `core`, `mode` +`windows_cpu_interrupts_total` | Total number of received and serviced hardware interrupts | counter | `core` +`windows_cpu_dpcs_total` | Total number of received and serviced deferred procedure calls (DPCs) | counter | `core` These metrics are only exposed on Windows Server 2008R2 and later: Name | Description | Type | Labels -----|-------------|------|------- -`wmi_cpu_clock_interrupts_total` | Total number of received and serviced clock tick interrupts | `core` -`wmi_cpu_idle_break_events_total` | Total number of time processor was woken from idle | `core` -`wmi_cpu_parking_status` | Parking Status represents whether a processor is parked or not | `gauge` -`wmi_cpu_core_frequency_mhz` | Core frequency in megahertz | `gauge` -`wmi_cpu_processor_performance` | Processor Performance is the average performance of the processor while it is executing instructions, as a percentage of the nominal performance of the processor. On some processors, Processor Performance may exceed 100% | `gauge` +`windows_cpu_clock_interrupts_total` | Total number of received and serviced clock tick interrupts | `core` +`windows_cpu_idle_break_events_total` | Total number of time processor was woken from idle | `core` +`windows_cpu_parking_status` | Parking Status represents whether a processor is parked or not | `gauge` +`windows_cpu_core_frequency_mhz` | Core frequency in megahertz | `gauge` +`windows_cpu_processor_performance` | Processor Performance is the average performance of the processor while it is executing instructions, as a percentage of the nominal performance of the processor. On some processors, Processor Performance may exceed 100% | `gauge` ### Example metric Show frequency of host CPU cores ``` -wmi_cpu_core_frequency_mhz{instance="localhost"} +windows_cpu_core_frequency_mhz{instance="localhost"} ``` ## Useful queries Show cpu usage by mode. ``` -sum by (mode) (irate(wmi_cpu_time_total{instance="localhost"}[5m])) +sum by (mode) (irate(windows_cpu_time_total{instance="localhost"}[5m])) ``` ## Alerting examples @@ -50,7 +50,7 @@ sum by (mode) (irate(wmi_cpu_time_total{instance="localhost"}[5m])) ```yaml # Alert on hosts with more than 80% CPU usage over a 10 minute period - alert: CpuUsage - expr: 100 - (avg by (instance) (irate(wmi_cpu_time_total{mode="idle"}[2m])) * 100) > 80 + expr: 100 - (avg by (instance) (irate(windows_cpu_time_total{mode="idle"}[2m])) * 100) > 80 for: 10m labels: severity: warning diff --git a/docs/collector.cs.md b/docs/collector.cs.md index 8a914e8e..68c2495e 100644 --- a/docs/collector.cs.md +++ b/docs/collector.cs.md @@ -1,30 +1,30 @@ -# cs collector - -The cs collector exposes metrics detailing the hardware of the computer system - -||| --|- -Metric name prefix | `cs` -Classes | [`Win32_ComputerSystem`](https://msdn.microsoft.com/en-us/library/aa394102) -Enabled by default? | Yes - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_cs_logical_processors` | Number of installed logical processors | gauge | None -`wmi_cs_physical_memory_bytes` | Total installed physical memory | gauge | None -`wmi_cs_hostname` | Labeled system hostname information | gauge | `hostname`, `domain`, `fqdn` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# cs collector + +The cs collector exposes metrics detailing the hardware of the computer system + +||| +-|- +Metric name prefix | `cs` +Classes | [`Win32_ComputerSystem`](https://msdn.microsoft.com/en-us/library/aa394102) +Enabled by default? | Yes + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_cs_logical_processors` | Number of installed logical processors | gauge | None +`windows_cs_physical_memory_bytes` | Total installed physical memory | gauge | None +`windows_cs_hostname` | Labeled system hostname information | gauge | `hostname`, `domain`, `fqdn` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.dns.md b/docs/collector.dns.md index 8a29dea5..41c93d28 100644 --- a/docs/collector.dns.md +++ b/docs/collector.dns.md @@ -1,49 +1,49 @@ -# dns collector - -The dns collector exposes metrics about the DNS server - -||| --|- -Metric name prefix | `dns` -Classes | [`Win32_PerfRawData_DNS_DNS`](https://technet.microsoft.com/en-us/library/cc977686.aspx) -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_dns_zone_transfer_requests_received_total` | _Not yet documented_ | counter | `qtype` -`wmi_dns_zone_transfer_requests_sent_total` | _Not yet documented_ | counter | `qtype` -`wmi_dns_zone_transfer_response_received_total` | _Not yet documented_ | counter | `qtype` -`wmi_dns_zone_transfer_success_received_total` | _Not yet documented_ | counter | `qtype`, `protocol` -`wmi_dns_zone_transfer_success_sent_total` | _Not yet documented_ | counter | `qtype` -`wmi_dns_zone_transfer_failures_total` | _Not yet documented_ | counter | None -`wmi_dns_memory_used_bytes_total` | _Not yet documented_ | gauge | `area` -`wmi_dns_dynamic_updates_queued` | _Not yet documented_ | gauge | None -`wmi_dns_dynamic_updates_received_total` | _Not yet documented_ | counter | `operation` -`wmi_dns_dynamic_updates_failures_total` | _Not yet documented_ | counter | `reason` -`wmi_dns_notify_received_total` | _Not yet documented_ | counter | None -`wmi_dns_notify_sent_total` | _Not yet documented_ | counter | None -`wmi_dns_secure_update_failures_total` | _Not yet documented_ | counter | None -`wmi_dns_secure_update_received_total` | _Not yet documented_ | counter | None -`wmi_dns_queries_total` | _Not yet documented_ | counter | `protocol` -`wmi_dns_responses_total` | _Not yet documented_ | counter | `protocol` -`wmi_dns_recursive_queries_total` | _Not yet documented_ | counter | None -`wmi_dns_recursive_query_failures_total` | _Not yet documented_ | counter | None -`wmi_dns_recursive_query_send_timeouts_total` | _Not yet documented_ | counter | None -`wmi_dns_wins_queries_total` | _Not yet documented_ | counter | `direction` -`wmi_dns_wins_responses_total` | _Not yet documented_ | counter | `direction` -`wmi_dns_unmatched_responses_total` | _Not yet documented_ | counter | None - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# dns collector + +The dns collector exposes metrics about the DNS server + +||| +-|- +Metric name prefix | `dns` +Classes | [`Win32_PerfRawData_DNS_DNS`](https://technet.microsoft.com/en-us/library/cc977686.aspx) +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_dns_zone_transfer_requests_received_total` | _Not yet documented_ | counter | `qtype` +`windows_dns_zone_transfer_requests_sent_total` | _Not yet documented_ | counter | `qtype` +`windows_dns_zone_transfer_response_received_total` | _Not yet documented_ | counter | `qtype` +`windows_dns_zone_transfer_success_received_total` | _Not yet documented_ | counter | `qtype`, `protocol` +`windows_dns_zone_transfer_success_sent_total` | _Not yet documented_ | counter | `qtype` +`windows_dns_zone_transfer_failures_total` | _Not yet documented_ | counter | None +`windows_dns_memory_used_bytes_total` | _Not yet documented_ | gauge | `area` +`windows_dns_dynamic_updates_queued` | _Not yet documented_ | gauge | None +`windows_dns_dynamic_updates_received_total` | _Not yet documented_ | counter | `operation` +`windows_dns_dynamic_updates_failures_total` | _Not yet documented_ | counter | `reason` +`windows_dns_notify_received_total` | _Not yet documented_ | counter | None +`windows_dns_notify_sent_total` | _Not yet documented_ | counter | None +`windows_dns_secure_update_failures_total` | _Not yet documented_ | counter | None +`windows_dns_secure_update_received_total` | _Not yet documented_ | counter | None +`windows_dns_queries_total` | _Not yet documented_ | counter | `protocol` +`windows_dns_responses_total` | _Not yet documented_ | counter | `protocol` +`windows_dns_recursive_queries_total` | _Not yet documented_ | counter | None +`windows_dns_recursive_query_failures_total` | _Not yet documented_ | counter | None +`windows_dns_recursive_query_send_timeouts_total` | _Not yet documented_ | counter | None +`windows_dns_wins_queries_total` | _Not yet documented_ | counter | `direction` +`windows_dns_wins_responses_total` | _Not yet documented_ | counter | `direction` +`windows_dns_unmatched_responses_total` | _Not yet documented_ | counter | None + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.exchange.md b/docs/collector.exchange.md index ccf3d586..041ed326 100644 --- a/docs/collector.exchange.md +++ b/docs/collector.exchange.md @@ -18,43 +18,43 @@ Lists the Perflib Objects that are queried for data along with the perlfib objec ## Metrics Name | Description --------------|--------------- -`wmi_exchange_rpc_avg_latency_sec` | The latency (sec), averaged for the past 1024 packets -`wmi_exchange_rpc_requests` | Number of client requests currently being processed by the RPC Client Access service -`wmi_exchange_rpc_active_user_count` | Number of unique users that have shown some kind of activity in the last 2 minutes -`wmi_exchange_rpc_connection_count` | Total number of client connections maintained -`wmi_exchange_rpc_operations_total` | The rate at which RPC operations occur -`wmi_exchange_rpc_user_count` | Number of users -`wmi_exchange_ldap_read_time_sec` | Time (sec) to send an LDAP read request and receive a response -`wmi_exchange_ldap_search_time_sec` | Time (sec) to send an LDAP search request and receive a response -`wmi_exchange_ldap_write_time_sec` | Time (sec) to send an LDAP Add/Modify/Delete request and receive a response -`wmi_exchange_ldap_timeout_errors_total` | Total number of LDAP timeout errors -`wmi_exchange_ldap_long_running_ops_per_sec` | Long Running LDAP operations per second -`wmi_exchange_transport_queues_external_active_remote_delivery` | External Active Remote Delivery Queue length -`wmi_exchange_transport_queues_internal_active_remote_delivery` | Internal Active Remote Delivery Queue length -`wmi_exchange_transport_queues_active_mailbox_delivery` | Active Mailbox Delivery Queue length -`wmi_exchange_transport_queues_retry_mailbox_delivery` | Retry Mailbox Delivery Queue length -`wmi_exchange_transport_queues_unreachable` | Unreachable Queue lengt -`wmi_exchange_transport_queues_external_largest_delivery` | External Largest Delivery Queue length -`wmi_exchange_transport_queues_internal_largest_delivery` | Internal Largest Delivery Queue length -`wmi_exchange_transport_queues_poison` | Poison Queue length -`wmi_exchange_http_proxy_mailbox_server_locator_avg_latency_sec` | Average latency (sec) of MailboxServerLocator web service calls -`wmi_exchange_http_proxy_avg_auth_latency` | Average time spent authenticating CAS requests over the last 200 samples -`wmi_exchange_http_proxy_outstanding_proxy_requests` | Number of concurrent outstanding proxy requests -`wmi_exchange_http_proxy_requests_total` | Number of proxy requests processed each second -`wmi_exchange_avail_service_requests_per_sec` | Number of requests serviced per second -`wmi_exchange_owa_current_unique_users` | Number of unique users currently logged on to Outlook Web App -`wmi_exchange_owa_requests_total` | Number of requests handled by Outlook Web App per second -`wmi_exchange_autodiscover_requests_total` | Number of autodiscover service requests processed each second -`wmi_exchange_workload_active_tasks` | Number of active tasks currently running in the background for workload management -`wmi_exchange_workload_completed_tasks` | Number of workload management tasks that have been completed -`wmi_exchange_workload_queued_tasks` | Number of workload management tasks that are currently queued up waiting to be processed -`wmi_exchange_workload_yielded_tasks` | The total number of tasks that have been yielded by a workload -`wmi_exchange_workload_is_active` | Active indicates whether the workload is in an active (1) or paused (0) state -`wmi_exchange_activesync_requests_total` | Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load -`wmi_exchange_http_proxy_avg_cas_proccessing_latency_sec` | Average latency (sec) of CAS processing time over the last 200 reqs -`wmi_exchange_http_proxy_mailbox_proxy_failure_rate` | % of failures between this CAS and MBX servers over the last 200 sample -`wmi_exchange_activesync_ping_cmds_pending` | Number of ping commands currently pending in the queue -`wmi_exchange_activesync_sync_cmds_total` | Number of sync commands processed per second. Clients use this command to synchronize items within a folder +`windows_exchange_rpc_avg_latency_sec` | The latency (sec), averaged for the past 1024 packets +`windows_exchange_rpc_requests` | Number of client requests currently being processed by the RPC Client Access service +`windows_exchange_rpc_active_user_count` | Number of unique users that have shown some kind of activity in the last 2 minutes +`windows_exchange_rpc_connection_count` | Total number of client connections maintained +`windows_exchange_rpc_operations_total` | The rate at which RPC operations occur +`windows_exchange_rpc_user_count` | Number of users +`windows_exchange_ldap_read_time_sec` | Time (sec) to send an LDAP read request and receive a response +`windows_exchange_ldap_search_time_sec` | Time (sec) to send an LDAP search request and receive a response +`windows_exchange_ldap_write_time_sec` | Time (sec) to send an LDAP Add/Modify/Delete request and receive a response +`windows_exchange_ldap_timeout_errors_total` | Total number of LDAP timeout errors +`windows_exchange_ldap_long_running_ops_per_sec` | Long Running LDAP operations per second +`windows_exchange_transport_queues_external_active_remote_delivery` | External Active Remote Delivery Queue length +`windows_exchange_transport_queues_internal_active_remote_delivery` | Internal Active Remote Delivery Queue length +`windows_exchange_transport_queues_active_mailbox_delivery` | Active Mailbox Delivery Queue length +`windows_exchange_transport_queues_retry_mailbox_delivery` | Retry Mailbox Delivery Queue length +`windows_exchange_transport_queues_unreachable` | Unreachable Queue lengt +`windows_exchange_transport_queues_external_largest_delivery` | External Largest Delivery Queue length +`windows_exchange_transport_queues_internal_largest_delivery` | Internal Largest Delivery Queue length +`windows_exchange_transport_queues_poison` | Poison Queue length +`windows_exchange_http_proxy_mailbox_server_locator_avg_latency_sec` | Average latency (sec) of MailboxServerLocator web service calls +`windows_exchange_http_proxy_avg_auth_latency` | Average time spent authenticating CAS requests over the last 200 samples +`windows_exchange_http_proxy_outstanding_proxy_requests` | Number of concurrent outstanding proxy requests +`windows_exchange_http_proxy_requests_total` | Number of proxy requests processed each second +`windows_exchange_avail_service_requests_per_sec` | Number of requests serviced per second +`windows_exchange_owa_current_unique_users` | Number of unique users currently logged on to Outlook Web App +`windows_exchange_owa_requests_total` | Number of requests handled by Outlook Web App per second +`windows_exchange_autodiscover_requests_total` | Number of autodiscover service requests processed each second +`windows_exchange_workload_active_tasks` | Number of active tasks currently running in the background for workload management +`windows_exchange_workload_completed_tasks` | Number of workload management tasks that have been completed +`windows_exchange_workload_queued_tasks` | Number of workload management tasks that are currently queued up waiting to be processed +`windows_exchange_workload_yielded_tasks` | The total number of tasks that have been yielded by a workload +`windows_exchange_workload_is_active` | Active indicates whether the workload is in an active (1) or paused (0) state +`windows_exchange_activesync_requests_total` | Num HTTP requests received from the client via ASP.NET per sec. Shows Current user load +`windows_exchange_http_proxy_avg_cas_proccessing_latency_sec` | Average latency (sec) of CAS processing time over the last 200 reqs +`windows_exchange_http_proxy_mailbox_proxy_failure_rate` | % of failures between this CAS and MBX servers over the last 200 sample +`windows_exchange_activesync_ping_cmds_pending` | Number of ping commands currently pending in the queue +`windows_exchange_activesync_sync_cmds_total` | Number of sync commands processed per second. Clients use this command to synchronize items within a folder ### Example metric _This collector does not yet have explained examples, we would appreciate your help adding them!_ diff --git a/docs/collector.hyperv.md b/docs/collector.hyperv.md index c9e545dd..135321ee 100644 --- a/docs/collector.hyperv.md +++ b/docs/collector.hyperv.md @@ -1,102 +1,102 @@ - # hyperv collector - -The hyperv collector exposes metrics about the Hyper-V hypervisor - -||| --|- -Metric name prefix | `hyperv` -Classes | `Win32_PerfRawData_VmmsVirtualMachineStats_HyperVVirtualMachineHealthSummary`
`Win32_PerfRawData_VidPerfProvider_HyperVVMVidPartition`
`Win32_PerfRawData_HvStats_HyperVHypervisorRootPartition`
`Win32_PerfRawData_HvStats_HyperVHypervisor`
`Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor`
`Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor`
`Win32_PerfRawData_NvspSwitchStats_HyperVVirtualSwitch`
`Win32_PerfRawData_EthernetPerfProvider_HyperVLegacyNetworkAdapter`
`Win32_PerfRawData_Counters_HyperVVirtualStorageDevice`
`Win32_PerfRawData_NvspNicStats_HyperVVirtualNetworkAdapter` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_hyperv_health_critical` | _Not yet documented_ | counter | None -`wmi_hyperv_health_ok` | _Not yet documented_ | counter | None -`wmi_hyperv_vid_physical_pages_allocated` | _Not yet documented_ | counter | `vm` -`wmi_hyperv_vid_preferred_numa_node_index` | _Not yet documented_ | counter | `vm` -`wmi_hyperv_vid_remote_physical_pages` | _Not yet documented_ | counter | `vm` -`wmi_hyperv_root_partition_address_spaces` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_attached_devices` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_deposited_pages` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_device_dma_errors` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_device_interrupt_errors` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_device_interrupt_mappings` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_device_interrupt_throttle_events` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_preferred_numa_node_index` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_gpa_space_modifications` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_io_tlb_flush_cost` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_io_tlb_flush` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_recommended_virtual_tlb_size` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_physical_pages_allocated` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_1G_device_pages` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_1G_gpa_pages` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_2M_device_pages` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_2M_gpa_pages` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_4K_device_pages` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_4K_gpa_pages` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_virtual_tlb_flush_entires` | _Not yet documented_ | counter | None -`wmi_hyperv_root_partition_virtual_tlb_pages` | _Not yet documented_ | counter | None -`wmi_hyperv_hypervisor_virtual_processors` | _Not yet documented_ | counter | None -`wmi_hyperv_hypervisor_logical_processors` | _Not yet documented_ | counter | None -`wmi_hyperv_host_cpu_guest_run_time` | _Not yet documented_ | counter | `core` -`wmi_hyperv_host_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `core` -`wmi_hyperv_host_cpu_remote_run_time` | _Not yet documented_ | counter | `core` -`wmi_hyperv_host_cpu_total_run_time` | _Not yet documented_ | counter | `core` -`wmi_hyperv_vm_cpu_guest_run_time` | _Not yet documented_ | counter | `vm`, `core` -`wmi_hyperv_vm_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `vm`, `core` -`wmi_hyperv_vm_cpu_remote_run_time` | _Not yet documented_ | counter | `vm`, `core` -`wmi_hyperv_vm_cpu_total_run_time` | _Not yet documented_ | counter | `vm`, `core` -`wmi_hyperv_vswitch_broadcast_packets_received_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_broadcast_packets_sent_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_bytes_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_bytes_received_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_bytes_sent_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_directed_packets_received_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_directed_packets_send_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_dropped_packets_incoming_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_dropped_packets_outcoming_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_extensions_dropped_packets_incoming_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_extensions_dropped_packets_outcoming_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_learned_mac_addresses_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_multicast_packets_received_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_multicast_packets_sent_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_number_of_send_channel_moves_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_number_of_vmq_moves_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_packets_flooded_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_packets_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_packets_received_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_packets_sent_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_vswitch_purged_mac_addresses_total` | _Not yet documented_ | counter | `vswitch` -`wmi_hyperv_ethernet_bytes_dropped` | _Not yet documented_ | counter | `adapter` -`wmi_hyperv_ethernet_bytes_received` | _Not yet documented_ | counter | `adapter` -`wmi_hyperv_ethernet_bytes_sent` | _Not yet documented_ | counter | `adapter` -`wmi_hyperv_ethernet_frames_dropped` | _Not yet documented_ | counter | `adapter` -`wmi_hyperv_ethernet_frames_received` | _Not yet documented_ | counter | `adapter` -`wmi_hyperv_ethernet_frames_sent` | _Not yet documented_ | counter | `adapter` -`wmi_hyperv_vm_device_error_count` | _Not yet documented_ | counter | `vm_device` -`wmi_hyperv_vm_device_queue_length` | _Not yet documented_ | counter | `vm_device` -`wmi_hyperv_vm_device_bytes_read` | _Not yet documented_ | counter | `vm_device` -`wmi_hyperv_vm_device_operations_read` | _Not yet documented_ | counter | `vm_device` -`wmi_hyperv_vm_device_bytes_written` | _Not yet documented_ | counter | `vm_device` -`wmi_hyperv_vm_device_operations_written` | _Not yet documented_ | counter | `vm_device` -`wmi_hyperv_vm_interface_bytes_received` | _Not yet documented_ | counter | `vm_interface` -`wmi_hyperv_vm_interface_bytes_sent` | _Not yet documented_ | counter | `vm_interface` -`wmi_hyperv_vm_interface_packets_incoming_dropped` | _Not yet documented_ | counter | `vm_interface` -`wmi_hyperv_vm_interface_packets_outgoing_dropped` | _Not yet documented_ | counter | `vm_interface` -`wmi_hyperv_vm_interface_packets_received` | _Not yet documented_ | counter | `vm_interface` -`wmi_hyperv_vm_interface_packets_sent` | _Not yet documented_ | counter | `vm_interface` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ + # hyperv collector + +The hyperv collector exposes metrics about the Hyper-V hypervisor + +||| +-|- +Metric name prefix | `hyperv` +Classes | `Win32_PerfRawData_VmmsVirtualMachineStats_HyperVVirtualMachineHealthSummary`
`Win32_PerfRawData_VidPerfProvider_HyperVVMVidPartition`
`Win32_PerfRawData_HvStats_HyperVHypervisorRootPartition`
`Win32_PerfRawData_HvStats_HyperVHypervisor`
`Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor`
`Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor`
`Win32_PerfRawData_NvspSwitchStats_HyperVVirtualSwitch`
`Win32_PerfRawData_EthernetPerfProvider_HyperVLegacyNetworkAdapter`
`Win32_PerfRawData_Counters_HyperVVirtualStorageDevice`
`Win32_PerfRawData_NvspNicStats_HyperVVirtualNetworkAdapter` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_hyperv_health_critical` | _Not yet documented_ | counter | None +`windows_hyperv_health_ok` | _Not yet documented_ | counter | None +`windows_hyperv_vid_physical_pages_allocated` | _Not yet documented_ | counter | `vm` +`windows_hyperv_vid_preferred_numa_node_index` | _Not yet documented_ | counter | `vm` +`windows_hyperv_vid_remote_physical_pages` | _Not yet documented_ | counter | `vm` +`windows_hyperv_root_partition_address_spaces` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_attached_devices` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_deposited_pages` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_device_dma_errors` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_device_interrupt_errors` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_device_interrupt_mappings` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_device_interrupt_throttle_events` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_preferred_numa_node_index` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_gpa_space_modifications` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_io_tlb_flush_cost` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_io_tlb_flush` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_recommended_virtual_tlb_size` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_physical_pages_allocated` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_1G_device_pages` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_1G_gpa_pages` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_2M_device_pages` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_2M_gpa_pages` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_4K_device_pages` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_4K_gpa_pages` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_virtual_tlb_flush_entires` | _Not yet documented_ | counter | None +`windows_hyperv_root_partition_virtual_tlb_pages` | _Not yet documented_ | counter | None +`windows_hyperv_hypervisor_virtual_processors` | _Not yet documented_ | counter | None +`windows_hyperv_hypervisor_logical_processors` | _Not yet documented_ | counter | None +`windows_hyperv_host_cpu_guest_run_time` | _Not yet documented_ | counter | `core` +`windows_hyperv_host_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `core` +`windows_hyperv_host_cpu_remote_run_time` | _Not yet documented_ | counter | `core` +`windows_hyperv_host_cpu_total_run_time` | _Not yet documented_ | counter | `core` +`windows_hyperv_vm_cpu_guest_run_time` | _Not yet documented_ | counter | `vm`, `core` +`windows_hyperv_vm_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `vm`, `core` +`windows_hyperv_vm_cpu_remote_run_time` | _Not yet documented_ | counter | `vm`, `core` +`windows_hyperv_vm_cpu_total_run_time` | _Not yet documented_ | counter | `vm`, `core` +`windows_hyperv_vswitch_broadcast_packets_received_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_broadcast_packets_sent_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_bytes_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_bytes_received_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_bytes_sent_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_directed_packets_received_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_directed_packets_send_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_dropped_packets_incoming_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_dropped_packets_outcoming_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_extensions_dropped_packets_incoming_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_extensions_dropped_packets_outcoming_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_learned_mac_addresses_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_multicast_packets_received_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_multicast_packets_sent_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_number_of_send_channel_moves_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_number_of_vmq_moves_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_packets_flooded_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_packets_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_packets_received_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_packets_sent_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_vswitch_purged_mac_addresses_total` | _Not yet documented_ | counter | `vswitch` +`windows_hyperv_ethernet_bytes_dropped` | _Not yet documented_ | counter | `adapter` +`windows_hyperv_ethernet_bytes_received` | _Not yet documented_ | counter | `adapter` +`windows_hyperv_ethernet_bytes_sent` | _Not yet documented_ | counter | `adapter` +`windows_hyperv_ethernet_frames_dropped` | _Not yet documented_ | counter | `adapter` +`windows_hyperv_ethernet_frames_received` | _Not yet documented_ | counter | `adapter` +`windows_hyperv_ethernet_frames_sent` | _Not yet documented_ | counter | `adapter` +`windows_hyperv_vm_device_error_count` | _Not yet documented_ | counter | `vm_device` +`windows_hyperv_vm_device_queue_length` | _Not yet documented_ | counter | `vm_device` +`windows_hyperv_vm_device_bytes_read` | _Not yet documented_ | counter | `vm_device` +`windows_hyperv_vm_device_operations_read` | _Not yet documented_ | counter | `vm_device` +`windows_hyperv_vm_device_bytes_written` | _Not yet documented_ | counter | `vm_device` +`windows_hyperv_vm_device_operations_written` | _Not yet documented_ | counter | `vm_device` +`windows_hyperv_vm_interface_bytes_received` | _Not yet documented_ | counter | `vm_interface` +`windows_hyperv_vm_interface_bytes_sent` | _Not yet documented_ | counter | `vm_interface` +`windows_hyperv_vm_interface_packets_incoming_dropped` | _Not yet documented_ | counter | `vm_interface` +`windows_hyperv_vm_interface_packets_outgoing_dropped` | _Not yet documented_ | counter | `vm_interface` +`windows_hyperv_vm_interface_packets_received` | _Not yet documented_ | counter | `vm_interface` +`windows_hyperv_vm_interface_packets_sent` | _Not yet documented_ | counter | `vm_interface` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.iis.md b/docs/collector.iis.md index 65524563..4b4b3a48 100644 --- a/docs/collector.iis.md +++ b/docs/collector.iis.md @@ -1,140 +1,140 @@ -# iis collector - -The iis collector exposes metrics about the IIS server - -||| --|- -Metric name prefix | `iis` -Classes | `Win32_PerfRawData_W3SVC_WebService`
`Win32_PerfRawData_APPPOOLCountersProvider_APPPOOLWAS`
`Win32_PerfRawData_W3SVCW3WPCounterProvider_W3SVCW3WP`
`Win32_PerfRawData_W3SVC_WebServiceCache` -Enabled by default? | No - -## Flags - -### `--collector.iis.site-whitelist` - -If given, a site needs to match the whitelist regexp in order for the corresponding metrics to be reported. - -### `--collector.iis.site-blacklist` - -If given, a site needs to *not* match the blacklist regexp in order for the corresponding metrics to be reported. - -### `--collector.iis.app-whitelist` - -If given, an application needs to match the whitelist regexp in order for the corresponding metrics to be reported. - -### `--collector.iis.app-blacklist` - -If given, an application needs to *not* match the blacklist regexp in order for the corresponding metrics to be reported. - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_iis_current_anonymous_users` | _Not yet documented_ | counter | `site` -`wmi_iis_current_blocked_async_io_requests` | _Not yet documented_ | counter | `site` -`wmi_iis_current_cgi_requests` | _Not yet documented_ | counter | `site` -`wmi_iis_current_connections` | _Not yet documented_ | counter | `site` -`wmi_iis_current_isapi_extension_requests` | _Not yet documented_ | counter | `site` -`wmi_iis_current_non_anonymous_users` | _Not yet documented_ | counter | `site` -`wmi_iis_received_bytes_total` | _Not yet documented_ | counter | `site` -`wmi_iis_sent_bytes_total` | _Not yet documented_ | counter | `site` -`wmi_iis_anonymous_users_total` | _Not yet documented_ | counter | `site` -`wmi_iis_blocked_async_io_requests_total` | _Not yet documented_ | counter | `site` -`wmi_iis_cgi_requests_total` | _Not yet documented_ | counter | `site` -`wmi_iis_connection_attempts_all_instances_total` | _Not yet documented_ | counter | `site` -`wmi_iis_requests_total` | _Not yet documented_ | counter | `site`, `method` -`wmi_iis_files_received_total` | _Not yet documented_ | counter | `site` -`wmi_iis_files_sent_total` | _Not yet documented_ | counter | `site` -`wmi_iis_ipapi_extension_requests_total` | _Not yet documented_ | counter | `site` -`wmi_iis_locked_errors_total` | _Not yet documented_ | counter | `site` -`wmi_iis_logon_attempts_total` | _Not yet documented_ | counter | `site` -`wmi_iis_non_anonymous_users_total` | _Not yet documented_ | counter | `site` -`wmi_iis_not_found_errors_total` | _Not yet documented_ | counter | `site` -`wmi_iis_rejected_async_io_requests_total` | _Not yet documented_ | counter | `site` -`wmi_iis_current_application_pool_state` | _Not yet documented_ | counter | `app`, `state` -`wmi_iis_current_application_pool_start_time` | _Not yet documented_ | counter | `app` -`wmi_iis_current_worker_processes` | _Not yet documented_ | counter | `app` -`wmi_iis_maximum_worker_processes` | _Not yet documented_ | counter | `app` -`wmi_iis_recent_worker_process_failures` | _Not yet documented_ | counter | `app` -`wmi_iis_time_since_last_worker_process_failure` | _Not yet documented_ | counter | `app` -`wmi_iis_total_application_pool_recycles` | _Not yet documented_ | counter | `app` -`wmi_iis_total_application_pool_start_time` | _Not yet documented_ | counter | `app` -`wmi_iis_total_worker_processes_created` | _Not yet documented_ | counter | `app` -`wmi_iis_total_worker_process_failures` | _Not yet documented_ | counter | `app` -`wmi_iis_total_worker_process_ping_failures` | _Not yet documented_ | counter | `app` -`wmi_iis_total_worker_process_shutdown_failures` | _Not yet documented_ | counter | `app` -`wmi_iis_total_worker_process_startup_failures` | _Not yet documented_ | counter | `app` -`wmi_iis_worker_cache_active_flushed_entries` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_file_cache_memory_bytes` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_file_cache_max_memory_bytes` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_file_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_file_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_file_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_file_cache_items` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_file_cache_items_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_file_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_uri_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_uri_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_uri_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_uri_cache_items` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_uri_cache_items_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_uri_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_metadata_cache_items` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_metadata_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_metadata_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_metadata_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_metadata_cache_items_cached_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_metadata_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_output_cache_active_flushed_items` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_output_cache_items` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_output_cache_memory_bytes` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_output_queries_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_output_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_output_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_output_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_threads` | _Not yet documented_ | counter | `app`, `pid`, `state` -`wmi_iis_worker_max_threads` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_requests_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_current_requests` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_request_errors_total` | _Not yet documented_ | counter | `app`, `pid`, `status_code` -`wmi_iis_worker_current_websocket_requests` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_websocket_connection_attempts_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_websocket_connection_accepted_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_worker_websocket_connection_rejected_total` | _Not yet documented_ | counter | `app`, `pid` -`wmi_iis_server_cache_active_flushed_entries` | _Not yet documented_ | counter | None -`wmi_iis_server_file_cache_memory_bytes` | _Not yet documented_ | counter | None -`wmi_iis_server_file_cache_max_memory_bytes` | _Not yet documented_ | counter | None -`wmi_iis_server_file_cache_flushes_total` | _Not yet documented_ | counter | None -`wmi_iis_server_file_cache_queries_total` | _Not yet documented_ | counter | None -`wmi_iis_server_file_cache_hits_total` | _Not yet documented_ | counter | None -`wmi_iis_server_file_cache_items` | _Not yet documented_ | counter | None -`wmi_iis_server_file_cache_items_total` | _Not yet documented_ | counter | None -`wmi_iis_server_file_cache_items_flushed_total` | _Not yet documented_ | counter | None -`wmi_iis_server_uri_cache_flushes_total` | _Not yet documented_ | counter | `mode` -`wmi_iis_server_uri_cache_queries_total` | _Not yet documented_ | counter | `mode` -`wmi_iis_server_uri_cache_hits_total` | _Not yet documented_ | counter | `mode` -`wmi_iis_server_uri_cache_items` | _Not yet documented_ | counter | `mode` -`wmi_iis_server_uri_cache_items_total` | _Not yet documented_ | counter | `mode` -`wmi_iis_server_uri_cache_items_flushed_total` | _Not yet documented_ | counter | `mode` -`wmi_iis_server_metadata_cache_items` | _Not yet documented_ | counter | None -`wmi_iis_server_metadata_cache_flushes_total` | _Not yet documented_ | counter | None -`wmi_iis_server_metadata_cache_queries_total` | _Not yet documented_ | counter | None -`wmi_iis_server_metadata_cache_hits_total` | _Not yet documented_ | counter | None -`wmi_iis_server_metadata_cache_items_cached_total` | _Not yet documented_ | counter | None -`wmi_iis_server_metadata_cache_items_flushed_total` | _Not yet documented_ | counter | None -`wmi_iis_server_output_cache_active_flushed_items` | _Not yet documented_ | counter | None -`wmi_iis_server_output_cache_items` | _Not yet documented_ | counter | None -`wmi_iis_server_output_cache_memory_bytes` | _Not yet documented_ | counter | None -`wmi_iis_server_output_cache_queries_total` | _Not yet documented_ | counter | None -`wmi_iis_server_output_cache_hits_total` | _Not yet documented_ | counter | None -`wmi_iis_server_output_cache_items_flushed_total` | _Not yet documented_ | counter | None -`wmi_iis_server_output_cache_flushes_total` | _Not yet documented_ | counter | None - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# iis collector + +The iis collector exposes metrics about the IIS server + +||| +-|- +Metric name prefix | `iis` +Classes | `Win32_PerfRawData_W3SVC_WebService`
`Win32_PerfRawData_APPPOOLCountersProvider_APPPOOLWAS`
`Win32_PerfRawData_W3SVCW3WPCounterProvider_W3SVCW3WP`
`Win32_PerfRawData_W3SVC_WebServiceCache` +Enabled by default? | No + +## Flags + +### `--collector.iis.site-whitelist` + +If given, a site needs to match the whitelist regexp in order for the corresponding metrics to be reported. + +### `--collector.iis.site-blacklist` + +If given, a site needs to *not* match the blacklist regexp in order for the corresponding metrics to be reported. + +### `--collector.iis.app-whitelist` + +If given, an application needs to match the whitelist regexp in order for the corresponding metrics to be reported. + +### `--collector.iis.app-blacklist` + +If given, an application needs to *not* match the blacklist regexp in order for the corresponding metrics to be reported. + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_iis_current_anonymous_users` | _Not yet documented_ | counter | `site` +`windows_iis_current_blocked_async_io_requests` | _Not yet documented_ | counter | `site` +`windows_iis_current_cgi_requests` | _Not yet documented_ | counter | `site` +`windows_iis_current_connections` | _Not yet documented_ | counter | `site` +`windows_iis_current_isapi_extension_requests` | _Not yet documented_ | counter | `site` +`windows_iis_current_non_anonymous_users` | _Not yet documented_ | counter | `site` +`windows_iis_received_bytes_total` | _Not yet documented_ | counter | `site` +`windows_iis_sent_bytes_total` | _Not yet documented_ | counter | `site` +`windows_iis_anonymous_users_total` | _Not yet documented_ | counter | `site` +`windows_iis_blocked_async_io_requests_total` | _Not yet documented_ | counter | `site` +`windows_iis_cgi_requests_total` | _Not yet documented_ | counter | `site` +`windows_iis_connection_attempts_all_instances_total` | _Not yet documented_ | counter | `site` +`windows_iis_requests_total` | _Not yet documented_ | counter | `site`, `method` +`windows_iis_files_received_total` | _Not yet documented_ | counter | `site` +`windows_iis_files_sent_total` | _Not yet documented_ | counter | `site` +`windows_iis_ipapi_extension_requests_total` | _Not yet documented_ | counter | `site` +`windows_iis_locked_errors_total` | _Not yet documented_ | counter | `site` +`windows_iis_logon_attempts_total` | _Not yet documented_ | counter | `site` +`windows_iis_non_anonymous_users_total` | _Not yet documented_ | counter | `site` +`windows_iis_not_found_errors_total` | _Not yet documented_ | counter | `site` +`windows_iis_rejected_async_io_requests_total` | _Not yet documented_ | counter | `site` +`windows_iis_current_application_pool_state` | _Not yet documented_ | counter | `app`, `state` +`windows_iis_current_application_pool_start_time` | _Not yet documented_ | counter | `app` +`windows_iis_current_worker_processes` | _Not yet documented_ | counter | `app` +`windows_iis_maximum_worker_processes` | _Not yet documented_ | counter | `app` +`windows_iis_recent_worker_process_failures` | _Not yet documented_ | counter | `app` +`windows_iis_time_since_last_worker_process_failure` | _Not yet documented_ | counter | `app` +`windows_iis_total_application_pool_recycles` | _Not yet documented_ | counter | `app` +`windows_iis_total_application_pool_start_time` | _Not yet documented_ | counter | `app` +`windows_iis_total_worker_processes_created` | _Not yet documented_ | counter | `app` +`windows_iis_total_worker_process_failures` | _Not yet documented_ | counter | `app` +`windows_iis_total_worker_process_ping_failures` | _Not yet documented_ | counter | `app` +`windows_iis_total_worker_process_shutdown_failures` | _Not yet documented_ | counter | `app` +`windows_iis_total_worker_process_startup_failures` | _Not yet documented_ | counter | `app` +`windows_iis_worker_cache_active_flushed_entries` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_file_cache_memory_bytes` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_file_cache_max_memory_bytes` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_file_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_file_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_file_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_file_cache_items` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_file_cache_items_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_file_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_uri_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_uri_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_uri_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_uri_cache_items` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_uri_cache_items_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_uri_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_metadata_cache_items` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_metadata_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_metadata_cache_queries_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_metadata_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_metadata_cache_items_cached_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_metadata_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_output_cache_active_flushed_items` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_output_cache_items` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_output_cache_memory_bytes` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_output_queries_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_output_cache_hits_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_output_cache_items_flushed_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_output_cache_flushes_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_threads` | _Not yet documented_ | counter | `app`, `pid`, `state` +`windows_iis_worker_max_threads` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_requests_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_current_requests` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_request_errors_total` | _Not yet documented_ | counter | `app`, `pid`, `status_code` +`windows_iis_worker_current_websocket_requests` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_websocket_connection_attempts_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_websocket_connection_accepted_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_worker_websocket_connection_rejected_total` | _Not yet documented_ | counter | `app`, `pid` +`windows_iis_server_cache_active_flushed_entries` | _Not yet documented_ | counter | None +`windows_iis_server_file_cache_memory_bytes` | _Not yet documented_ | counter | None +`windows_iis_server_file_cache_max_memory_bytes` | _Not yet documented_ | counter | None +`windows_iis_server_file_cache_flushes_total` | _Not yet documented_ | counter | None +`windows_iis_server_file_cache_queries_total` | _Not yet documented_ | counter | None +`windows_iis_server_file_cache_hits_total` | _Not yet documented_ | counter | None +`windows_iis_server_file_cache_items` | _Not yet documented_ | counter | None +`windows_iis_server_file_cache_items_total` | _Not yet documented_ | counter | None +`windows_iis_server_file_cache_items_flushed_total` | _Not yet documented_ | counter | None +`windows_iis_server_uri_cache_flushes_total` | _Not yet documented_ | counter | `mode` +`windows_iis_server_uri_cache_queries_total` | _Not yet documented_ | counter | `mode` +`windows_iis_server_uri_cache_hits_total` | _Not yet documented_ | counter | `mode` +`windows_iis_server_uri_cache_items` | _Not yet documented_ | counter | `mode` +`windows_iis_server_uri_cache_items_total` | _Not yet documented_ | counter | `mode` +`windows_iis_server_uri_cache_items_flushed_total` | _Not yet documented_ | counter | `mode` +`windows_iis_server_metadata_cache_items` | _Not yet documented_ | counter | None +`windows_iis_server_metadata_cache_flushes_total` | _Not yet documented_ | counter | None +`windows_iis_server_metadata_cache_queries_total` | _Not yet documented_ | counter | None +`windows_iis_server_metadata_cache_hits_total` | _Not yet documented_ | counter | None +`windows_iis_server_metadata_cache_items_cached_total` | _Not yet documented_ | counter | None +`windows_iis_server_metadata_cache_items_flushed_total` | _Not yet documented_ | counter | None +`windows_iis_server_output_cache_active_flushed_items` | _Not yet documented_ | counter | None +`windows_iis_server_output_cache_items` | _Not yet documented_ | counter | None +`windows_iis_server_output_cache_memory_bytes` | _Not yet documented_ | counter | None +`windows_iis_server_output_cache_queries_total` | _Not yet documented_ | counter | None +`windows_iis_server_output_cache_hits_total` | _Not yet documented_ | counter | None +`windows_iis_server_output_cache_items_flushed_total` | _Not yet documented_ | counter | None +`windows_iis_server_output_cache_flushes_total` | _Not yet documented_ | counter | None + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.logical_disk.md b/docs/collector.logical_disk.md index 9345d1cd..489af4b2 100644 --- a/docs/collector.logical_disk.md +++ b/docs/collector.logical_disk.md @@ -38,13 +38,13 @@ Name | Description | Type | Labels ### Example metric Query the rate of write operations to a disk ``` -rate(wmi_logical_disk_read_bytes_total{instance="localhost", volume=~"C:"}[2m]) +rate(windows_logical_disk_read_bytes_total{instance="localhost", volume=~"C:"}[2m]) ``` ## Useful queries Calculate rate of total IOPS for disk ``` -rate(wmi_logical_disk_reads_total{instance="localhost", volume="C:"}[2m]) + rate(wmi_logical_disk_writes_total{instance="localhost", volume="C:"}[2m]) +rate(windows_logical_disk_reads_total{instance="localhost", volume="C:"}[2m]) + rate(windows_logical_disk_writes_total{instance="localhost", volume="C:"}[2m]) ``` ## Alerting examples @@ -56,7 +56,7 @@ groups: # Sends an alert when disk space usage is above 95% - alert: DiskSpaceUsage - expr: 100.0 - 100 * (wmi_logical_disk_free_bytes / wmi_logical_disk_size_bytes) > 95 + expr: 100.0 - 100 * (windows_logical_disk_free_bytes / windows_logical_disk_size_bytes) > 95 for: 10m labels: severity: high @@ -66,7 +66,7 @@ groups: # Alerts on disks with over 85% space usage predicted to fill within the next four days - alert: DiskFilling - expr: 100 * (wmi_logical_disk_free_bytes / wmi_logical_disk_size_bytes) < 15 and predict_linear(wmi_logical_disk_free_bytes[6h], 4 * 24 * 3600) < 0 + expr: 100 * (windows_logical_disk_free_bytes / windows_logical_disk_size_bytes) < 15 and predict_linear(windows_logical_disk_free_bytes[6h], 4 * 24 * 3600) < 0 for: 10m labels: severity: warning diff --git a/docs/collector.logon.md b/docs/collector.logon.md index ca6f9d98..78d8c2fd 100644 --- a/docs/collector.logon.md +++ b/docs/collector.logon.md @@ -16,18 +16,18 @@ None Name | Description | Type | Labels -----|-------------|------|------- -`wmi_logon_logon_type` | Number of active user logon sessions | gauge | status +`windows_logon_logon_type` | Number of active user logon sessions | gauge | status ### Example metric Query the total number of interactive logon sessions ``` -wmi_logon_logon_type{status="interactive"} +windows_logon_logon_type{status="interactive"} ``` ## Useful queries Query the total number of local and remote (I.E. Terminal Services) interactive sessions. ``` -wmi_logon_logon_type{status=~"interactive|remoteinteractive"} +windows_logon_logon_type{status=~"interactive|remoteinteractive"} ``` ## Alerting examples diff --git a/docs/collector.memory.md b/docs/collector.memory.md index 32ff538a..eb28106b 100644 --- a/docs/collector.memory.md +++ b/docs/collector.memory.md @@ -1,62 +1,62 @@ -# memory collector - -The memory collector exposes metrics about system memory usage - -||| --|- -Metric name prefix | `memory` -Data source | Perflib -Classes | `Win32_PerfRawData_PerfOS_Memory` -Enabled by default? | Yes - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_cs_logical_processors` | Number of installed logical processors | gauge | None -`wmi_cs_physical_memory_bytes` | Total installed physical memory | gauge | None -`wmi_memory_available_bytes` | The amount of physical memory immediately available for allocation to a process or for system use. It is equal to the sum of memory assigned to the standby (cached), free and zero page lists | gauge | None -`wmi_memory_cache_bytes` | Number of bytes currently being used by the file system cache | gauge | None -`wmi_memory_cache_bytes_peak` | Maximum number of CacheBytes after the system was last restarted | gauge | None -`wmi_memory_cache_faults_total` | Number of faults which occur when a page sought in the file system cache is not found there and must be retrieved from elsewhere in memory (soft fault) or from disk (hard fault) | gauge | None -`wmi_memory_commit_limit` | Amount of virtual memory, in bytes, that can be committed without having to extend the paging file(s) | gauge | None -`wmi_memory_committed_bytes` | Amount of committed virtual memory, in bytes | gauge | None -`wmi_memory_demand_zero_faults_total` | The number of zeroed pages required to satisfy faults. Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space | gauge | None -`wmi_memory_free_and_zero_page_list_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_free_system_page_table_entries` | Number of page table entries not being used by the system | gauge | None -`wmi_memory_modified_page_list_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_page_faults_total` | Overall rate at which faulted pages are handled by the processor | gauge | None -`wmi_memory_swap_page_reads_total` | Number of disk page reads (a single read operation reading several pages is still only counted once) | gauge | None -`wmi_memory_swap_pages_read_total` | Number of pages read across all page reads (ie counting all pages read even if they are read in a single operation) | gauge | None -`wmi_memory_swap_pages_written_total` | Number of pages written across all page writes (ie counting all pages written even if they are written in a single operation) | gauge | None -`wmi_memory_swap_page_operations_total` | Total number of swap page read and writes (PagesPersec) | gauge | None -`wmi_memory_swap_page_writes_total` | Number of disk page writes (a single write operation writing several pages is still only counted once) | gauge | None -`wmi_memory_pool_nonpaged_allocs_total` | The number of calls to allocate space in the nonpaged pool. The nonpaged pool is an area of system memory area for objects that cannot be written to disk, and must remain in physical memory as long as they are allocated | gauge | None -`wmi_memory_pool_nonpaged_bytes_total` | Number of bytes in the non-paged pool | gauge | None -`wmi_memory_pool_paged_allocs_total` | Number of calls to allocate space in the paged pool, regardless of the amount of space allocated in each call | gauge | None -`wmi_memory_pool_paged_bytes` | Number of bytes in the paged pool | gauge | None -`wmi_memory_pool_paged_resident_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_standby_cache_core_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_standby_cache_normal_priority_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_standby_cache_reserve_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_system_cache_resident_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_system_code_resident_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_system_code_total_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_system_driver_resident_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_system_driver_total_bytes` | _Not yet documented_ | gauge | None -`wmi_memory_transition_faults_total` | _Not yet documented_ | gauge | None -`wmi_memory_transition_pages_repurposed_total` | _Not yet documented_ | gauge | None -`wmi_memory_write_copies_total` | The number of page faults caused by attempting to write that were satisfied by copying the page from elsewhere in physical memory | gauge | None - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# memory collector + +The memory collector exposes metrics about system memory usage + +||| +-|- +Metric name prefix | `memory` +Data source | Perflib +Classes | `Win32_PerfRawData_PerfOS_Memory` +Enabled by default? | Yes + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_cs_logical_processors` | Number of installed logical processors | gauge | None +`windows_cs_physical_memory_bytes` | Total installed physical memory | gauge | None +`windows_memory_available_bytes` | The amount of physical memory immediately available for allocation to a process or for system use. It is equal to the sum of memory assigned to the standby (cached), free and zero page lists | gauge | None +`windows_memory_cache_bytes` | Number of bytes currently being used by the file system cache | gauge | None +`windows_memory_cache_bytes_peak` | Maximum number of CacheBytes after the system was last restarted | gauge | None +`windows_memory_cache_faults_total` | Number of faults which occur when a page sought in the file system cache is not found there and must be retrieved from elsewhere in memory (soft fault) or from disk (hard fault) | gauge | None +`windows_memory_commit_limit` | Amount of virtual memory, in bytes, that can be committed without having to extend the paging file(s) | gauge | None +`windows_memory_committed_bytes` | Amount of committed virtual memory, in bytes | gauge | None +`windows_memory_demand_zero_faults_total` | The number of zeroed pages required to satisfy faults. Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space | gauge | None +`windows_memory_free_and_zero_page_list_bytes` | _Not yet documented_ | gauge | None +`windows_memory_free_system_page_table_entries` | Number of page table entries not being used by the system | gauge | None +`windows_memory_modified_page_list_bytes` | _Not yet documented_ | gauge | None +`windows_memory_page_faults_total` | Overall rate at which faulted pages are handled by the processor | gauge | None +`windows_memory_swap_page_reads_total` | Number of disk page reads (a single read operation reading several pages is still only counted once) | gauge | None +`windows_memory_swap_pages_read_total` | Number of pages read across all page reads (ie counting all pages read even if they are read in a single operation) | gauge | None +`windows_memory_swap_pages_written_total` | Number of pages written across all page writes (ie counting all pages written even if they are written in a single operation) | gauge | None +`windows_memory_swap_page_operations_total` | Total number of swap page read and writes (PagesPersec) | gauge | None +`windows_memory_swap_page_writes_total` | Number of disk page writes (a single write operation writing several pages is still only counted once) | gauge | None +`windows_memory_pool_nonpaged_allocs_total` | The number of calls to allocate space in the nonpaged pool. The nonpaged pool is an area of system memory area for objects that cannot be written to disk, and must remain in physical memory as long as they are allocated | gauge | None +`windows_memory_pool_nonpaged_bytes_total` | Number of bytes in the non-paged pool | gauge | None +`windows_memory_pool_paged_allocs_total` | Number of calls to allocate space in the paged pool, regardless of the amount of space allocated in each call | gauge | None +`windows_memory_pool_paged_bytes` | Number of bytes in the paged pool | gauge | None +`windows_memory_pool_paged_resident_bytes` | _Not yet documented_ | gauge | None +`windows_memory_standby_cache_core_bytes` | _Not yet documented_ | gauge | None +`windows_memory_standby_cache_normal_priority_bytes` | _Not yet documented_ | gauge | None +`windows_memory_standby_cache_reserve_bytes` | _Not yet documented_ | gauge | None +`windows_memory_system_cache_resident_bytes` | _Not yet documented_ | gauge | None +`windows_memory_system_code_resident_bytes` | _Not yet documented_ | gauge | None +`windows_memory_system_code_total_bytes` | _Not yet documented_ | gauge | None +`windows_memory_system_driver_resident_bytes` | _Not yet documented_ | gauge | None +`windows_memory_system_driver_total_bytes` | _Not yet documented_ | gauge | None +`windows_memory_transition_faults_total` | _Not yet documented_ | gauge | None +`windows_memory_transition_pages_repurposed_total` | _Not yet documented_ | gauge | None +`windows_memory_write_copies_total` | The number of page faults caused by attempting to write that were satisfied by copying the page from elsewhere in physical memory | gauge | None + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.msmq.md b/docs/collector.msmq.md index ce833022..c973219e 100644 --- a/docs/collector.msmq.md +++ b/docs/collector.msmq.md @@ -1,33 +1,33 @@ -# msmq collector - -The msmq collector exposes metrics about the queues on a MSMQ server - -||| --|- -Metric name prefix | `msmq` -Classes | `Win32_PerfRawData_MSMQ_MSMQQueue` -Enabled by default? | No - -## Flags - -### `--collector.msmq.msmq-where` - -A WMI filter on which queues to include. `%` is a wildcard, and can be used to match on substrings. - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_msmq_bytes_in_journal_queue` | Size of queue journal in bytes | gauge | `name` -`wmi_msmq_bytes_in_queue` | Size of queue in bytes | gauge | `name` -`wmi_msmq_messages_in_journal_queue` | Count messages in queue journal | gauge | `name` -`wmi_msmq_messages_in_queue` | Count messages in queue | gauge | `name` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# msmq collector + +The msmq collector exposes metrics about the queues on a MSMQ server + +||| +-|- +Metric name prefix | `msmq` +Classes | `Win32_PerfRawData_MSMQ_MSMQQueue` +Enabled by default? | No + +## Flags + +### `--collector.msmq.msmq-where` + +A WMI filter on which queues to include. `%` is a wildcard, and can be used to match on substrings. + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_msmq_bytes_in_journal_queue` | Size of queue journal in bytes | gauge | `name` +`windows_msmq_bytes_in_queue` | Size of queue in bytes | gauge | `name` +`windows_msmq_messages_in_journal_queue` | Count messages in queue journal | gauge | `name` +`windows_msmq_messages_in_queue` | Count messages in queue | gauge | `name` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.mssql.md b/docs/collector.mssql.md index b645c7ad..bbc559af 100644 --- a/docs/collector.mssql.md +++ b/docs/collector.mssql.md @@ -1,275 +1,275 @@ -# mssql collector - -The mssql collector exposes metrics about the MSSQL server - -||| --|- -Metric name prefix | `mssql` -Classes | [`Win32_PerfRawData_MSSQLSERVER_SQLServerAccessMethods`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerAvailabilityReplica`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-availability-replica)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerDatabaseReplica`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-database-replica)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerDatabases`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object?view=sql-server-2017)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerGeneralStatistics`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-general-statistics-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerLocks`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-locks-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerMemoryManager`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-memory-manager-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerSQLStatistics`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-sql-statistics-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerSQLErrors`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-sql-errors-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerTransactions`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-transactions-object) -Enabled by default? | No - -## Flags - -### `--collectors.mssql.classes-enabled` - -Comma-separated list of MSSQL WMI classes to use. Supported values are `accessmethods`, `availreplica`, `bufman`, `databases`, `dbreplica`, `genstats`, `locks`, `memmgr`, `sqlstats`, `sqlerrors` and `transactions`. - -### `--collectors.mssql.class-print` - -If true, print available mssql WMI classes and exit. Only displays if the mssql collector is enabled. - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_mssql_collector_duration_seconds` | The time taken for each sub-collector to return | counter | `collector`, `instance` -`wmi_mssql_collector_success` | 1 if sub-collector succeeded, 0 otherwise | counter | `collector`, `instance` -`wmi_mssql_accessmethods_au_batch_cleanups` | The total number of batches that were completed successfully by the background task that cleans up deferred dropped allocation units | counter | `instance` -`wmi_mssql_accessmethods_au_cleanups` | The total number of allocation units that were successfully dropped the background task that cleans up deferred dropped allocation units. Each allocation unit drop requires multiple batches | counter | `instance` -`wmi_mssql_accessmethods_by_reference_lob_creates` | The total count of large object (lob) values that were passed by reference. By-reference lobs are used in certain bulk operations to avoid the cost of passing them by value | counter | `instance` -`wmi_mssql_accessmethods_by_reference_lob_uses` | The total count of by-reference lob values that were used. By-reference lobs are used in certain bulk operations to avoid the cost of passing them by-value | counter | `instance` -`wmi_mssql_accessmethods_lob_read_aheads` | The total count of lob pages on which readahead was issued | counter | `instance` -`wmi_mssql_accessmethods_column_value_pulls` | The total count of column values that were pulled in-row from off-row | counter | `instance` -`wmi_mssql_accessmethods_column_value_pushes` | The total count of column values that were pushed from in-row to off-row | counter | `instance` -`wmi_mssql_accessmethods_deferred_dropped_aus` | The total number of allocation units waiting to be dropped by the background task that cleans up deferred dropped allocation units | counter | `instance` -`wmi_mssql_accessmethods_deferred_dropped_rowsets` | The number of rowsets created as a result of aborted online index build operations that are waiting to be dropped by the background task that cleans up deferred dropped rowsets | counter | `instance` -`wmi_mssql_accessmethods_dropped_rowset_cleanups` | The number of rowsets per second created as a result of aborted online index build operations that were successfully dropped by the background task that cleans up deferred dropped rowsets | counter | `instance` -`wmi_mssql_accessmethods_dropped_rowset_skips` | The number of rowsets per second created as a result of aborted online index build operations that were skipped by the background task that cleans up deferred dropped rowsets created | counter | `instance` -`wmi_mssql_accessmethods_extent_deallocations` | Number of extents deallocated per second in all databases in this instance of SQL Server | counter | `instance` -`wmi_mssql_accessmethods_extent_allocations` | Number of extents allocated per second in all databases in this instance of SQL Server | counter | `instance` -`wmi_mssql_accessmethods_au_batch_cleanup_failures` | The number of batches per second that failed and required retry, by the background task that cleans up deferred dropped allocation units. Failure could be due to lack of memory or disk space, hardware failure and other reasons | counter | `instance` -`wmi_mssql_accessmethods_leaf_page_cookie_failures` | The number of times that a leaf page cookie could not be used during an index search since changes happened on the leaf page. The cookie is used to speed up index search | counter | `instance` -`wmi_mssql_accessmethods_tree_page_cookie_failures` | The number of times that a tree page cookie could not be used during an index search since changes happened on the parent pages of those tree pages. The cookie is used to speed up index search | counter | `instance` -`wmi_mssql_accessmethods_forwarded_records` | Number of records per second fetched through forwarded record pointers | counter | `instance` -`wmi_mssql_accessmethods_free_space_page_fetches` | Number of pages fetched per second by free space scans. These scans search for free space within pages already allocated to an allocation unit, to satisfy requests to insert or modify record fragments | counter | `instance` -`wmi_mssql_accessmethods_free_space_scans` | Number of scans per second that were initiated to search for free space within pages already allocated to an allocation unit to insert or modify record fragment. Each scan may find multiple pages | counter | `instance` -`wmi_mssql_accessmethods_full_scans` | Number of unrestricted full scans per second. These can be either base-table or full-index scans | counter | `instance` -`wmi_mssql_accessmethods_index_searches` | Number of index searches per second. These are used to start a range scan, reposition a range scan, revalidate a scan point, fetch a single index record, and search down the index to locate where to insert a new row | counter | `instance` -`wmi_mssql_accessmethods_insysxact_waits` | Number of times a reader needs to wait for a page because the InSysXact bit is set | counter | `instance` -`wmi_mssql_accessmethods_lob_handle_creates` | Count of temporary lobs created | counter | `instance` -`wmi_mssql_accessmethods_lob_handle_destroys` | Count of temporary lobs destroyed | counter | `instance` -`wmi_mssql_accessmethods_lob_ss_provider_creates` | Count of LOB Storage Service Providers (LobSSP) created. One worktable created per LobSSP | counter | `instance` -`wmi_mssql_accessmethods_lob_ss_provider_destroys` | Count of LobSSP destroyed | counter | `instance` -`wmi_mssql_accessmethods_lob_ss_provider_truncations` | Count of LobSSP truncated | counter | `instance` -`wmi_mssql_accessmethods_mixed_page_allocations` | Number of pages allocated per second from mixed extents. These could be used for storing the IAM pages and the first eight pages that are allocated to an allocation unit | counter | `instance` -`wmi_mssql_accessmethods_page_compression_attempts` | Number of pages evaluated for page-level compression. Includes pages that were not compressed because significant savings could be achieved. Includes all objects in the instance of SQL Server | counter | `instance` -`wmi_mssql_accessmethods_page_deallocations` | Number of pages deallocated per second in all databases in this instance of SQL Server. These include pages from mixed extents and uniform extents | counter | `instance` -`wmi_mssql_accessmethods_page_allocations` | Number of pages allocated per second in all databases in this instance of SQL Server. These include pages allocations from both mixed extents and uniform extents | counter | `instance` -`wmi_mssql_accessmethods_page_compressions` | Number of data pages that are compressed by using PAGE compression. Includes all objects in the instance of SQL Server | counter | `instance` -`wmi_mssql_accessmethods_page_splits` | Number of page splits per second that occur as the result of overflowing index pages | counter | `instance` -`wmi_mssql_accessmethods_probe_scans` | Number of probe scans per second that are used to find at most one single qualified row in an index or base table directly | counter | `instance` -`wmi_mssql_accessmethods_range_scans` | Number of qualified range scans through indexes per second | counter | `instance` -`wmi_mssql_accessmethods_scan_point_revalidations` | Number of times per second that the scan point had to be revalidated to continue the scan | counter | `instance` -`wmi_mssql_accessmethods_ghost_record_skips` | Number of ghosted records per second skipped during scans | counter | `instance` -`wmi_mssql_accessmethods_table_lock_escalations` | Number of times locks on a table were escalated to the TABLE or HoBT granularity | counter | `instance` -`wmi_mssql_accessmethods_leaf_page_cookie_uses` | Number of times a leaf page cookie is used successfully during an index search since no change happened on the leaf page. The cookie is used to speed up index search | counter | `instance` -`wmi_mssql_accessmethods_tree_page_cookie_uses` | Number of times a tree page cookie is used successfully during an index search since no change happened on the parent page of the tree page. The cookie is used to speed up index search | counter | `instance` -`wmi_mssql_accessmethods_workfile_creates` | Number of work files created per second. For example, work files could be used to store temporary results for hash joins and hash aggregates | counter | `instance` -`wmi_mssql_accessmethods_worktables_creates` | Number of work tables created per second. For example, work tables could be used to store temporary results for query spool, lob variables, XML variables, and cursors | counter | `instance` -`wmi_mssql_accessmethods_worktables_from_cache_ratio` | Percentage of work tables created where the initial two pages of the work table were not allocated but were immediately available from the work table cache | counter | `instance` -`wmi_mssql_availreplica_received_from_replica_bytes` | Number of bytes received from the availability replica per second. Pings and status updates will generate network traffic even on databases with no user updates | counter | `instance`, `replica` -`wmi_mssql_availreplica_sent_to_replica_bytes` | Number of bytes sent to the remote availability replica per second. On the primary replica this is the number of bytes sent to the secondary replica. On the secondary replica this is the number of bytes sent to the primary replica | counter | `instance`, `replica` -`wmi_mssql_availreplica_sent_to_transport_bytes` | Actual number of bytes sent per second over the network to the remote availability replica. On the primary replica this is the number of bytes sent to the secondary replica. On the secondary replica this is the number of bytes sent to the primary replica | counter | `instance`, `replica` -`wmi_mssql_availreplica_initiated_flow_controls` | Time in milliseconds that log stream messages waited for send flow control, in the last second | counter | `instance`, `replica` -`wmi_mssql_availreplica_flow_control_wait_seconds` | Number of times flow-control initiated in the last second. Flow Control Time (ms/sec) divided by Flow Control/sec is the average time per wait | counter | `instance`, `replica` -`wmi_mssql_availreplica_receives_from_replica` | Number of Always On messages received from thereplica per second | counter | `instance`, `replica` -`wmi_mssql_availreplica_resent_messages` | Number of Always On messages resent in the last second | counter | `instance`, `replica` -`wmi_mssql_availreplica_sends_to_replica` | Number of Always On messages sent to this availability replica per second | counter | `instance`, `replica` -`wmi_mssql_availreplica_sends_to_transport` | Actual number of Always On messages sent per second over the network to the remote availability replica | counter | `instance`, `replica` -`wmi_mssql_bufman_background_writer_pages` | Number of pages flushed to enforce the recovery interval settings | counter | `instance` -`wmi_mssql_bufman_buffer_cache_hit_ratio` | Indicates the percentage of pages found in the buffer cache without having to read from disk. The ratio is the total number of cache hits divided by the total number of cache lookups over the last few thousand page accesses | counter | `instance` -`wmi_mssql_bufman_checkpoint_pages` | Indicates the number of pages flushed to disk per second by a checkpoint or other operation that require all dirty pages to be flushed | counter | `instance` -`wmi_mssql_bufman_database_pages` | Indicates the number of pages in the buffer pool with database content | counter | `instance` -`wmi_mssql_bufman_extension_allocated_pages` | Total number of non-free cache pages in the buffer pool extension file | counter | `instance` -`wmi_mssql_bufman_extension_free_pages` | Total number of free cache pages in the buffer pool extension file | counter | `instance` -`wmi_mssql_bufman_extension_in_use_as_percentage` | _Not yet documented_ | counter | `instance` -`wmi_mssql_bufman_extension_outstanding_io` | Percentage of the buffer pool extension paging file occupied by buffer manager pages | counter | `instance` -`wmi_mssql_bufman_extension_page_evictions` | Number of pages evicted from the buffer pool extension file per second | counter | `instance` -`wmi_mssql_bufman_extension_page_reads` | Number of pages read from the buffer pool extension file per second | counter | `instance` -`wmi_mssql_bufman_extension_page_unreferenced_seconds` | Average seconds a page will stay in the buffer pool extension without references to it | counter | `instance` -`wmi_mssql_bufman_extension_page_writes` | Number of pages written to the buffer pool extension file per second | counter | `instance` -`wmi_mssql_bufman_free_list_stalls` | Indicates the number of requests per second that had to wait for a free page | counter | `instance` -`wmi_mssql_bufman_integral_controller_slope` | The slope that integral controller for the buffer pool last used, times -10 billion | counter | `instance` -`wmi_mssql_bufman_lazywrites` | Indicates the number of buffers written per second by the buffer manager's lazy writer | counter | `instance` -`wmi_mssql_bufman_page_life_expectancy_seconds` | Indicates the number of seconds a page will stay in the buffer pool without references | counter | `instance` -`wmi_mssql_bufman_page_lookups` | Indicates the number of requests per second to find a page in the buffer pool | counter | `instance` -`wmi_mssql_bufman_page_reads` | Indicates the number of physical database page reads that are issued per second | counter | `instance` -`wmi_mssql_bufman_page_writes` | Indicates the number of physical database page writes that are issued per second | counter | `instance` -`wmi_mssql_bufman_read_ahead_pages` | Indicates the number of pages read per second in anticipation of use | counter | `instance` -`wmi_mssql_bufman_read_ahead_issuing_seconds` | Time (microseconds) spent issuing readahead | counter | `instance` -`wmi_mssql_bufman_target_pages` | Ideal number of pages in the buffer pool | counter | `instance` -`wmi_mssql_dbreplica_database_flow_control_wait_seconds` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_database_initiated_flow_controls` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_received_file_bytes` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_group_commits` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_group_commit_stall_seconds` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_apply_pending_queue` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_apply_ready_queue` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_compressed_bytes` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_decompressed_bytes` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_received_bytes` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_compression_cachehits` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_compression_cachemisses` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_compressions` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_decompressions` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_remaining_for_undo` | The amount of log, in bytes, remaining to complete the undo phase | counter | `instance`, `replica` -`wmi_mssql_dbreplica_log_send_queue` | Amount of log records in the log files of the primary database, in kilobytes, that haven't been sent to the secondary replica | counter | `instance`, `replica` -`wmi_mssql_dbreplica_mirrored_write_transactions` | Number of transactions that were written to the primary database and then waited to commit until the log was sent to the secondary database, in the last second | counter | `instance`, `replica` -`wmi_mssql_dbreplica_recovery_queue_records` | Amount of log records in the log files of the secondary replica that have not been redone | counter | `instance`, `replica` -`wmi_mssql_dbreplica_redo_blocks` | Number of times the redo thread was blocked on locks held by readers of the database | counter | `instance`, `replica` -`wmi_mssql_dbreplica_redo_remaining_bytes` | The amount of log, in kilobytes, remaining to be redone to finish the reverting phase | counter | `instance`, `replica` -`wmi_mssql_dbreplica_redone_bytes` | Amount of log records redone on the secondary database in the last second | counter | `instance`, `replica` -`wmi_mssql_dbreplica_redones` | _Not yet documented_ | counter | `instance`, `replica` -`wmi_mssql_dbreplica_total_log_requiring_undo` | Total kilobytes of log that must be undone | counter | `instance`, `replica` -`wmi_mssql_dbreplica_transaction_delay_seconds` | Delay in waiting for unterminated commit acknowledgment for all the current transactions | counter | `instance`, `replica` -`wmi_mssql_databases_active_transactions` | Number of active transactions for the database | counter | `instance`, `database` -`wmi_mssql_databases_backup_restore_operations` | Read/write throughput for backup and restore operations of a database per second | counter | `instance`, `database` -`wmi_mssql_databases_bulk_copy_rows` | Number of rows bulk copied per second | counter | `instance`, `database` -`wmi_mssql_databases_bulk_copy_bytes` | Amount of data bulk copied (in kilobytes) per second | counter | `instance`, `database` -`wmi_mssql_databases_commit_table_entries` | he size (row count) of the in-memory portion of the commit table for the database | counter | `instance`, `database` -`wmi_mssql_databases_data_files_size_bytes` | Cumulative size (in kilobytes) of all the data files in the database including any automatic growth. Monitoring this counter is useful, for example, for determining the correct size of tempdb | counter | `instance`, `database` -`wmi_mssql_databases_dbcc_logical_scan_bytes` | Number of logical read scan bytes per second for database console commands (DBCC) | counter | `instance`, `database` -`wmi_mssql_databases_group_commit_stall_seconds` | Group stall time (microseconds) per second | counter | `instance`, `database` -`wmi_mssql_databases_log_flushed_bytes` | Total number of log bytes flushed | counter | `instance`, `database` -`wmi_mssql_databases_log_cache_hit_ratio` | Percentage of log cache reads satisfied from the log cache | counter | `instance`, `database` -`wmi_mssql_databases_log_cache_reads` | Reads performed per second through the log manager cache | counter | `instance`, `database` -`wmi_mssql_databases_log_files_size_bytes` | Cumulative size (in kilobytes) of all the transaction log files in the database | counter | `instance`, `database` -`wmi_mssql_databases_log_files_used_size_bytes` | The cumulative used size of all the log files in the database | counter | `instance`, `database` -`wmi_mssql_databases_log_flushes` | Total wait time (in milliseconds) to flush the log. On an Always On secondary database, this value indicates the wait time for log records to be hardened to disk | counter | `instance`, `database` -`wmi_mssql_databases_log_flush_waits` | Number of commits per second waiting for the log flush | counter | `instance`, `database` -`wmi_mssql_databases_log_flush_wait_seconds` | Number of commits per second waiting for the log flush | counter | `instance`, `database` -`wmi_mssql_databases_log_flush_write_seconds` | Time in milliseconds for performing writes of log flushes that were completed in the last second | counter | `instance`, `database` -`wmi_mssql_databases_log_growths` | Total number of times the transaction log for the database has been expanded | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_cache_misses` | Number of requests for which the log block was not available in the log pool | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_disk_reads` | Number of disk reads that the log pool issued to fetch log blocks | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_hash_deletes` | Rate of raw hash entry deletes from the Log Pool | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_hash_inserts` | Rate of raw hash entry inserts into the Log Pool | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_invalid_hash_entries` | Rate of hash lookups failing due to being invalid | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_log_scan_pushes` | Rate of Log block pushes by log scans, which may come from disk or memory | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_log_writer_pushes` | Rate of Log block pushes by log writer thread | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_empty_free_pool_pushes` | Rate of Log block push fails due to empty free pool | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_low_memory_pushes` | Rate of Log block push fails due to being low on memory | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_no_free_buffer_pushes` | Rate of Log block push fails due to free buffer unavailable | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_req_behind_trunc` | Log pool cache misses due to block requested being behind truncation LSN | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_requests_old_vlf` | Log Pool requests that were not in the last VLF of the log | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_requests` | The number of log-block requests processed by the log pool | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_total_active_log_bytes` | Current total active log stored in the shared cache buffer manager in bytes | counter | `instance`, `database` -`wmi_mssql_databases_log_pool_total_shared_pool_bytes` | Current total memory usage of the shared cache buffer manager in bytes | counter | `instance`, `database` -`wmi_mssql_databases_log_shrinks` | Total number of log shrinks for this database | counter | `instance`, `database` -`wmi_mssql_databases_log_truncations` | The number of times the transaction log has been truncated (in Simple Recovery Model) | counter | `instance`, `database` -`wmi_mssql_databases_log_used_percent` | Percentage of space in the log that is in use | counter | `instance`, `database` -`wmi_mssql_databases_pending_repl_transactions` | Number of transactions in the transaction log of the publication database marked for replication, but not yet delivered to the distribution database | counter | `instance`, `database` -`wmi_mssql_databases_repl_transactions` | Number of transactions per second read out of the transaction log of the publication database and delivered to the distribution database | counter | `instance`, `database` -`wmi_mssql_databases_shrink_data_movement_bytes` | Amount of data being moved per second by autoshrink operations, or DBCC SHRINKDATABASE or DBCC SHRINKFILE statements | counter | `instance`, `database` -`wmi_mssql_databases_tracked_transactions` | Number of committed transactions recorded in the commit table for the database | counter | `instance`, `database` -`wmi_mssql_databases_transactions` | Number of transactions started for the database per second | counter | `instance`, `database` -`wmi_mssql_databases_write_transactions` | Number of transactions that wrote to the database and committed, in the last second | counter | `instance`, `database` -`wmi_mssql_databases_xtp_controller_dlc_fetch_latency_seconds` | Average latency in microseconds between log blocks entering the Direct Log Consumer and being retrieved by the XTP controller, per second | counter | `instance`, `database` -`wmi_mssql_databases_xtp_controller_dlc_peak_latency_seconds` | The largest recorded latency, in microseconds, of a fetch from the Direct Log Consumer by the XTP controller | counter | `instance`, `database` -`wmi_mssql_databases_xtp_controller_log_processed_bytes` | The amount of log bytes processed by the XTP controller thread, per second | counter | `instance`, `database` -`wmi_mssql_databases_xtp_memory_used_bytes` | The amount of memory used by XTP in the database | counter | `instance`, `database` -`wmi_mssql_genstats_active_temp_tables` | Number of temporary tables/table variables in use | counter | `instance` -`wmi_mssql_genstats_connection_resets` | Total number of logins started from the connection pool | counter | `instance` -`wmi_mssql_genstats_event_notifications_delayed_drop` | Number of event notifications waiting to be dropped by a system thread | counter | `instance` -`wmi_mssql_genstats_http_authenticated_requests` | Number of authenticated HTTP requests started per second | counter | `instance` -`wmi_mssql_genstats_logical_connections` | Number of logical connections to the system | counter | `instance` -`wmi_mssql_genstats_logins` | Total number of logins started per second. This does not include pooled connections | counter | `instance` -`wmi_mssql_genstats_logouts` | Total number of logout operations started per second | counter | `instance` -`wmi_mssql_genstats_mars_deadlocks` | Number of MARS deadlocks detected | counter | `instance` -`wmi_mssql_genstats_non_atomic_yields` | Number of non-atomic yields per second | counter | `instance` -`wmi_mssql_genstats_blocked_processes` | Number of currently blocked processes | counter | `instance` -`wmi_mssql_genstats_soap_empty_requests` | Number of empty SOAP requests started per second | counter | `instance` -`wmi_mssql_genstats_soap_method_invocations` | Number of SOAP method invocations started per second | counter | `instance` -`wmi_mssql_genstats_soap_session_initiate_requests` | Number of SOAP Session initiate requests started per second | counter | `instance` -`wmi_mssql_genstats_soap_session_terminate_requests` | Number of SOAP Session terminate requests started per second | counter | `instance` -`wmi_mssql_genstats_soapsql_requests` | Number of SOAP SQL requests started per second | counter | `instance` -`wmi_mssql_genstats_soapwsdl_requests` | Number of SOAP Web Service Description Language requests started per second | counter | `instance` -`wmi_mssql_genstats_sql_trace_io_provider_lock_waits` | Number of waits for the File IO Provider lock per second | counter | `instance` -`wmi_mssql_genstats_tempdb_recovery_unit_ids_generated` | Number of duplicate tempdb recovery unit id generated | counter | `instance` -`wmi_mssql_genstats_tempdb_rowset_ids_generated` | Number of duplicate tempdb rowset id generated | counter | `instance` -`wmi_mssql_genstats_temp_tables_creations` | Number of temporary tables/table variables created per second | counter | `instance` -`wmi_mssql_genstats_temp_tables_awaiting_destruction` | Number of temporary tables/table variables waiting to be destroyed by the cleanup system thread | counter | `instance` -`wmi_mssql_genstats_trace_event_notification_queue_size` | Number of trace event notification instances waiting in the internal queue to be sent through Service Broker | counter | `instance` -`wmi_mssql_genstats_transactions` | Number of transaction enlistments (local, DTC, bound all combined) | counter | `instance` -`wmi_mssql_genstats_user_connections` | Counts the number of users currently connected to SQL Server | counter | `instance` -`wmi_mssql_locks_average_wait_seconds` | Average amount of wait time (in milliseconds) for each lock request that resulted in a wait | counter | `instance`, `resource` -`wmi_mssql_locks_lock_requests` | Number of new locks and lock conversions per second requested from the lock manager | counter | `instance`, `resource` -`wmi_mssql_locks_lock_timeouts` | Number of lock requests per second that timed out, but excluding requests for NOWAIT locks | counter | `instance`, `resource` -`wmi_mssql_locks_lock_timeouts_excluding_NOWAIT` | Number of lock requests per second that timed out, including requests for NOWAIT locks | counter | `instance`, `resource` -`wmi_mssql_locks_lock_waits` | Total wait time (in milliseconds) for locks in the last second | counter | `instance`, `resource` -`wmi_mssql_locks_lock_wait_seconds` | Number of lock requests per second that required the caller to wait | counter | `instance`, `resource` -`wmi_mssql_locks_deadlocks` | Number of lock requests per second that resulted in a deadlock | counter | `instance`, `resource` -`wmi_mssql_memmgr_connection_memory_bytes` | Specifies the total amount of dynamic memory the server is using for maintaining connections | counter | `instance` -`wmi_mssql_memmgr_database_cache_memory_bytes` | Specifies the amount of memory the server is currently using for the database pages cache | counter | `instance` -`wmi_mssql_memmgr_external_benefit_of_memory` | An internal estimation of the performance benefit from adding memory to a specific cache | counter | `instance` -`wmi_mssql_memmgr_free_memory_bytes` | Specifies the amount of committed memory currently not used by the server | counter | `instance` -`wmi_mssql_memmgr_granted_workspace_memory_bytes` | Specifies the total amount of memory currently granted to executing processes, such as hash, sort, bulk copy, and index creation operations | counter | `instance` -`wmi_mssql_memmgr_lock_blocks` | Specifies the current number of lock blocks in use on the server (refreshed periodically). A lock block represents an individual locked resource, such as a table, page, or row | counter | `instance` -`wmi_mssql_memmgr_allocated_lock_blocks` | Specifies the current number of allocated lock blocks. At server startup, the number of allocated lock blocks plus the number of allocated lock owner blocks depends on the SQL Server Locks configuration option. If more lock blocks are needed, the value increases | counter | `instance` -`wmi_mssql_memmgr_lock_memory_bytes` | Specifies the total amount of dynamic memory the server is using for locks | counter | `instance` -`wmi_mssql_memmgr_lock_owner_blocks` | Specifies the current number of allocated lock owner blocks. At server startup, the number of allocated lock owner blocks and the number of allocated lock blocks depend on the SQL Server Locks configuration option. If more lock owner blocks are needed, the value increases dynamically | counter | `instance` -`wmi_mssql_memmgr_allocated_lock_owner_blocks` | _Not yet documented_ | counter | `instance` -`wmi_mssql_memmgr_log_pool_memory_bytes` | Total amount of dynamic memory the server is using for Log Pool | counter | `instance` -`wmi_mssql_memmgr_maximum_workspace_memory_bytes` | Indicates the maximum amount of memory available for executing processes, such as hash, sort, bulk copy, and index creation operations | counter | `instance` -`wmi_mssql_memmgr_outstanding_memory_grants` | Specifies the total number of processes that have successfully acquired a workspace memory grant | counter | `instance` -`wmi_mssql_memmgr_pending_memory_grants` | Specifies the total number of processes waiting for a workspace memory grant | counter | `instance` -`wmi_mssql_memmgr_optimizer_memory_bytes` | Specifies the total amount of dynamic memory the server is using for query optimization | counter | `instance` -`wmi_mssql_memmgr_reserved_server_memory_bytes` | ndicates the amount of memory the server has reserved for future usage. This counter shows the current unused amount of memory initially granted that is shown in Granted Workspace Memory | counter | `instance` -`wmi_mssql_memmgr_sql_cache_memory_bytes` | Specifies the total amount of dynamic memory the server is using for the dynamic SQL cache | counter | `instance` -`wmi_mssql_memmgr_stolen_server_memory_bytes` | Specifies the amount of memory the server is using for purposes other than database pages | counter | `instance` -`wmi_mssql_memmgr_target_server_memory_bytes` | Indicates the ideal amount of memory the server can consume | counter | `instance` -`wmi_mssql_memmgr_total_server_memory_bytes` | Specifies the amount of memory the server has committed using the memory manager | counter | `instance` -`wmi_mssql_sqlstats_auto_parameterization_attempts` | Number of failed auto-parameterization attempts per second. This should be small. Note that auto-parameterizations are also known as simple parameterizations in later versions of SQL Server | counter | `instance` -`wmi_mssql_sqlstats_batch_requests` | _Not yet documented_ | counter | `instance` -`wmi_mssql_sqlstats_failed_auto_parameterization_attempts` | _Not yet documented_ | counter | `instance` -`wmi_mssql_sqlstats_forced_parameterizations` | Number of successful forced parameterizations per second | counter | `instance` -`wmi_mssql_sqlstats_guided_plan_executions` | Number of plan executions per second in which the query plan has been generated by using a plan guide | counter | `instance` -`wmi_mssql_sqlstats_misguided_plan_executions` | Number of plan executions per second in which a plan guide could not be honored during plan generation | counter | `instance` -`wmi_mssql_sqlstats_safe_auto_parameterization_attempts` | Number of safe auto-parameterization attempts per second | counter | `instance` -`wmi_mssql_sqlstats_sql_attentions` | Number of attentions per second | counter | `instance` -`wmi_mssql_sqlstats_sql_compilations` | Number of SQL compilations per second | counter | `instance` -`wmi_mssql_sqlstats_sql_recompilations` | Number of statement recompiles per second | counter | `instance` -`wmi_mssql_sqlstats_unsafe_auto_parameterization_attempts` | Number of unsafe auto-parameterization attempts per second. | counter | `instance` -`wmi_mssql_sql_errors_total` | Information for all errors | counter | `instance`, `resource` -`wmi_mssql_transactions_tempdb_free_space_bytes` | The amount of space (in kilobytes) available in tempdb | gauge | `instance` -`wmi_mssql_transactions_longest_transaction_running_seconds` | The length of time (in seconds) since the start of the transaction that has been active longer than any other current transaction | gauge | `instance` -`wmi_mssql_transactions_nonsnapshot_version_active_total` | The number of currently active transactions that are not using snapshot isolation level and have made data modifications that have generated row versions in the tempdb version store | counter | `instance` -`wmi_mssql_transactions_snapshot_active_total` | The number of currently active transactions using the snapshot isolation level | counter | `instance` -`wmi_mssql_transactions_active_total` | The number of currently active transactions of all types | counter | `instance` -`wmi_mssql_transactions_update_conflicts_total` | The percentage of those transactions using the snapshot isolation level that have encountered update conflicts within the last second | counter | `instance` -`wmi_mssql_transactions_update_snapshot_active_total` | The number of currently active transactions using the snapshot isolation level and have modified data | counter | `instance` -`wmi_mssql_transactions_version_cleanup_rate_bytes` | The rate (in kilobytes per second) at which row versions are removed from the snapshot isolation version store in tempdb | gauge | `instance` -`wmi_mssql_transactions_version_generation_rate_bytes` | The rate (in kilobytes per second) at which new row versions are added to the snapshot isolation version store in tempdb | gauge | `instance` -`wmi_mssql_transactions_version_store_size_bytes` | he amount of space (in kilobytes) in tempdb being used to store snapshot isolation level row versions | gauge | `instance` -`wmi_mssql_transactions_version_store_units` | The number of active allocation units in the snapshot isolation version store in tempdb | counter | `instance` -`wmi_mssql_transactions_version_store_creation_units` | The number of allocation units that have been created in the snapshot isolation store since the instance of the Database Engine was started | counter | `instance` -`wmi_mssql_transactions_version_store_truncation_units` | The number of allocation units that have been removed from the snapshot isolation store since the instance of the Database Engine was started | counter | `instance` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries - -### Buffer Cache Hit Ratio - -When you read the counter in perfmon you will get the the percentage pages found in the buffer cache. This percentage is calculated internally based on the total number of cache hits divided by the total number of cache lookups over the last few thousand page accesses. -This collector retrieves the two internal values separately. In order to calculate the Buffer Cache Hit Ratio in PromQL. - -``` -wmi_mssql_bufman_buffer_cache_hits{instance="host:9182", exported_instance="MSSQLSERVER"} / -wmi_mssql_bufman_buffer_cache_lookups{instance="host:9182", exported_instance="MSSQLSERVER"} -``` - -This principal can be used for following metrics too: -- AccessMethodsWorktablesFromCacheHitRatio - - accessmethods_worktables_from_cache_hits - - accessmethods_worktables_from_cache_lookups -- LogCacheHitRatio - - databases_log_cache_hits - - databases_log_cache_lookups -- AverageLockWaitTime - - locks_wait_time_seconds - - locks_count - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# mssql collector + +The mssql collector exposes metrics about the MSSQL server + +||| +-|- +Metric name prefix | `mssql` +Classes | [`Win32_PerfRawData_MSSQLSERVER_SQLServerAccessMethods`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerAvailabilityReplica`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-availability-replica)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerDatabaseReplica`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-database-replica)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerDatabases`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object?view=sql-server-2017)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerGeneralStatistics`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-general-statistics-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerLocks`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-locks-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerMemoryManager`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-memory-manager-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerSQLStatistics`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-sql-statistics-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerSQLErrors`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-sql-errors-object)
[`Win32_PerfRawData_MSSQLSERVER_SQLServerTransactions`](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-transactions-object) +Enabled by default? | No + +## Flags + +### `--collectors.mssql.classes-enabled` + +Comma-separated list of MSSQL WMI classes to use. Supported values are `accessmethods`, `availreplica`, `bufman`, `databases`, `dbreplica`, `genstats`, `locks`, `memmgr`, `sqlstats`, `sqlerrors` and `transactions`. + +### `--collectors.mssql.class-print` + +If true, print available mssql WMI classes and exit. Only displays if the mssql collector is enabled. + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_mssql_collector_duration_seconds` | The time taken for each sub-collector to return | counter | `collector`, `instance` +`windows_mssql_collector_success` | 1 if sub-collector succeeded, 0 otherwise | counter | `collector`, `instance` +`windows_mssql_accessmethods_au_batch_cleanups` | The total number of batches that were completed successfully by the background task that cleans up deferred dropped allocation units | counter | `instance` +`windows_mssql_accessmethods_au_cleanups` | The total number of allocation units that were successfully dropped the background task that cleans up deferred dropped allocation units. Each allocation unit drop requires multiple batches | counter | `instance` +`windows_mssql_accessmethods_by_reference_lob_creates` | The total count of large object (lob) values that were passed by reference. By-reference lobs are used in certain bulk operations to avoid the cost of passing them by value | counter | `instance` +`windows_mssql_accessmethods_by_reference_lob_uses` | The total count of by-reference lob values that were used. By-reference lobs are used in certain bulk operations to avoid the cost of passing them by-value | counter | `instance` +`windows_mssql_accessmethods_lob_read_aheads` | The total count of lob pages on which readahead was issued | counter | `instance` +`windows_mssql_accessmethods_column_value_pulls` | The total count of column values that were pulled in-row from off-row | counter | `instance` +`windows_mssql_accessmethods_column_value_pushes` | The total count of column values that were pushed from in-row to off-row | counter | `instance` +`windows_mssql_accessmethods_deferred_dropped_aus` | The total number of allocation units waiting to be dropped by the background task that cleans up deferred dropped allocation units | counter | `instance` +`windows_mssql_accessmethods_deferred_dropped_rowsets` | The number of rowsets created as a result of aborted online index build operations that are waiting to be dropped by the background task that cleans up deferred dropped rowsets | counter | `instance` +`windows_mssql_accessmethods_dropped_rowset_cleanups` | The number of rowsets per second created as a result of aborted online index build operations that were successfully dropped by the background task that cleans up deferred dropped rowsets | counter | `instance` +`windows_mssql_accessmethods_dropped_rowset_skips` | The number of rowsets per second created as a result of aborted online index build operations that were skipped by the background task that cleans up deferred dropped rowsets created | counter | `instance` +`windows_mssql_accessmethods_extent_deallocations` | Number of extents deallocated per second in all databases in this instance of SQL Server | counter | `instance` +`windows_mssql_accessmethods_extent_allocations` | Number of extents allocated per second in all databases in this instance of SQL Server | counter | `instance` +`windows_mssql_accessmethods_au_batch_cleanup_failures` | The number of batches per second that failed and required retry, by the background task that cleans up deferred dropped allocation units. Failure could be due to lack of memory or disk space, hardware failure and other reasons | counter | `instance` +`windows_mssql_accessmethods_leaf_page_cookie_failures` | The number of times that a leaf page cookie could not be used during an index search since changes happened on the leaf page. The cookie is used to speed up index search | counter | `instance` +`windows_mssql_accessmethods_tree_page_cookie_failures` | The number of times that a tree page cookie could not be used during an index search since changes happened on the parent pages of those tree pages. The cookie is used to speed up index search | counter | `instance` +`windows_mssql_accessmethods_forwarded_records` | Number of records per second fetched through forwarded record pointers | counter | `instance` +`windows_mssql_accessmethods_free_space_page_fetches` | Number of pages fetched per second by free space scans. These scans search for free space within pages already allocated to an allocation unit, to satisfy requests to insert or modify record fragments | counter | `instance` +`windows_mssql_accessmethods_free_space_scans` | Number of scans per second that were initiated to search for free space within pages already allocated to an allocation unit to insert or modify record fragment. Each scan may find multiple pages | counter | `instance` +`windows_mssql_accessmethods_full_scans` | Number of unrestricted full scans per second. These can be either base-table or full-index scans | counter | `instance` +`windows_mssql_accessmethods_index_searches` | Number of index searches per second. These are used to start a range scan, reposition a range scan, revalidate a scan point, fetch a single index record, and search down the index to locate where to insert a new row | counter | `instance` +`windows_mssql_accessmethods_insysxact_waits` | Number of times a reader needs to wait for a page because the InSysXact bit is set | counter | `instance` +`windows_mssql_accessmethods_lob_handle_creates` | Count of temporary lobs created | counter | `instance` +`windows_mssql_accessmethods_lob_handle_destroys` | Count of temporary lobs destroyed | counter | `instance` +`windows_mssql_accessmethods_lob_ss_provider_creates` | Count of LOB Storage Service Providers (LobSSP) created. One worktable created per LobSSP | counter | `instance` +`windows_mssql_accessmethods_lob_ss_provider_destroys` | Count of LobSSP destroyed | counter | `instance` +`windows_mssql_accessmethods_lob_ss_provider_truncations` | Count of LobSSP truncated | counter | `instance` +`windows_mssql_accessmethods_mixed_page_allocations` | Number of pages allocated per second from mixed extents. These could be used for storing the IAM pages and the first eight pages that are allocated to an allocation unit | counter | `instance` +`windows_mssql_accessmethods_page_compression_attempts` | Number of pages evaluated for page-level compression. Includes pages that were not compressed because significant savings could be achieved. Includes all objects in the instance of SQL Server | counter | `instance` +`windows_mssql_accessmethods_page_deallocations` | Number of pages deallocated per second in all databases in this instance of SQL Server. These include pages from mixed extents and uniform extents | counter | `instance` +`windows_mssql_accessmethods_page_allocations` | Number of pages allocated per second in all databases in this instance of SQL Server. These include pages allocations from both mixed extents and uniform extents | counter | `instance` +`windows_mssql_accessmethods_page_compressions` | Number of data pages that are compressed by using PAGE compression. Includes all objects in the instance of SQL Server | counter | `instance` +`windows_mssql_accessmethods_page_splits` | Number of page splits per second that occur as the result of overflowing index pages | counter | `instance` +`windows_mssql_accessmethods_probe_scans` | Number of probe scans per second that are used to find at most one single qualified row in an index or base table directly | counter | `instance` +`windows_mssql_accessmethods_range_scans` | Number of qualified range scans through indexes per second | counter | `instance` +`windows_mssql_accessmethods_scan_point_revalidations` | Number of times per second that the scan point had to be revalidated to continue the scan | counter | `instance` +`windows_mssql_accessmethods_ghost_record_skips` | Number of ghosted records per second skipped during scans | counter | `instance` +`windows_mssql_accessmethods_table_lock_escalations` | Number of times locks on a table were escalated to the TABLE or HoBT granularity | counter | `instance` +`windows_mssql_accessmethods_leaf_page_cookie_uses` | Number of times a leaf page cookie is used successfully during an index search since no change happened on the leaf page. The cookie is used to speed up index search | counter | `instance` +`windows_mssql_accessmethods_tree_page_cookie_uses` | Number of times a tree page cookie is used successfully during an index search since no change happened on the parent page of the tree page. The cookie is used to speed up index search | counter | `instance` +`windows_mssql_accessmethods_workfile_creates` | Number of work files created per second. For example, work files could be used to store temporary results for hash joins and hash aggregates | counter | `instance` +`windows_mssql_accessmethods_worktables_creates` | Number of work tables created per second. For example, work tables could be used to store temporary results for query spool, lob variables, XML variables, and cursors | counter | `instance` +`windows_mssql_accessmethods_worktables_from_cache_ratio` | Percentage of work tables created where the initial two pages of the work table were not allocated but were immediately available from the work table cache | counter | `instance` +`windows_mssql_availreplica_received_from_replica_bytes` | Number of bytes received from the availability replica per second. Pings and status updates will generate network traffic even on databases with no user updates | counter | `instance`, `replica` +`windows_mssql_availreplica_sent_to_replica_bytes` | Number of bytes sent to the remote availability replica per second. On the primary replica this is the number of bytes sent to the secondary replica. On the secondary replica this is the number of bytes sent to the primary replica | counter | `instance`, `replica` +`windows_mssql_availreplica_sent_to_transport_bytes` | Actual number of bytes sent per second over the network to the remote availability replica. On the primary replica this is the number of bytes sent to the secondary replica. On the secondary replica this is the number of bytes sent to the primary replica | counter | `instance`, `replica` +`windows_mssql_availreplica_initiated_flow_controls` | Time in milliseconds that log stream messages waited for send flow control, in the last second | counter | `instance`, `replica` +`windows_mssql_availreplica_flow_control_wait_seconds` | Number of times flow-control initiated in the last second. Flow Control Time (ms/sec) divided by Flow Control/sec is the average time per wait | counter | `instance`, `replica` +`windows_mssql_availreplica_receives_from_replica` | Number of Always On messages received from thereplica per second | counter | `instance`, `replica` +`windows_mssql_availreplica_resent_messages` | Number of Always On messages resent in the last second | counter | `instance`, `replica` +`windows_mssql_availreplica_sends_to_replica` | Number of Always On messages sent to this availability replica per second | counter | `instance`, `replica` +`windows_mssql_availreplica_sends_to_transport` | Actual number of Always On messages sent per second over the network to the remote availability replica | counter | `instance`, `replica` +`windows_mssql_bufman_background_writer_pages` | Number of pages flushed to enforce the recovery interval settings | counter | `instance` +`windows_mssql_bufman_buffer_cache_hit_ratio` | Indicates the percentage of pages found in the buffer cache without having to read from disk. The ratio is the total number of cache hits divided by the total number of cache lookups over the last few thousand page accesses | counter | `instance` +`windows_mssql_bufman_checkpoint_pages` | Indicates the number of pages flushed to disk per second by a checkpoint or other operation that require all dirty pages to be flushed | counter | `instance` +`windows_mssql_bufman_database_pages` | Indicates the number of pages in the buffer pool with database content | counter | `instance` +`windows_mssql_bufman_extension_allocated_pages` | Total number of non-free cache pages in the buffer pool extension file | counter | `instance` +`windows_mssql_bufman_extension_free_pages` | Total number of free cache pages in the buffer pool extension file | counter | `instance` +`windows_mssql_bufman_extension_in_use_as_percentage` | _Not yet documented_ | counter | `instance` +`windows_mssql_bufman_extension_outstanding_io` | Percentage of the buffer pool extension paging file occupied by buffer manager pages | counter | `instance` +`windows_mssql_bufman_extension_page_evictions` | Number of pages evicted from the buffer pool extension file per second | counter | `instance` +`windows_mssql_bufman_extension_page_reads` | Number of pages read from the buffer pool extension file per second | counter | `instance` +`windows_mssql_bufman_extension_page_unreferenced_seconds` | Average seconds a page will stay in the buffer pool extension without references to it | counter | `instance` +`windows_mssql_bufman_extension_page_writes` | Number of pages written to the buffer pool extension file per second | counter | `instance` +`windows_mssql_bufman_free_list_stalls` | Indicates the number of requests per second that had to wait for a free page | counter | `instance` +`windows_mssql_bufman_integral_controller_slope` | The slope that integral controller for the buffer pool last used, times -10 billion | counter | `instance` +`windows_mssql_bufman_lazywrites` | Indicates the number of buffers written per second by the buffer manager's lazy writer | counter | `instance` +`windows_mssql_bufman_page_life_expectancy_seconds` | Indicates the number of seconds a page will stay in the buffer pool without references | counter | `instance` +`windows_mssql_bufman_page_lookups` | Indicates the number of requests per second to find a page in the buffer pool | counter | `instance` +`windows_mssql_bufman_page_reads` | Indicates the number of physical database page reads that are issued per second | counter | `instance` +`windows_mssql_bufman_page_writes` | Indicates the number of physical database page writes that are issued per second | counter | `instance` +`windows_mssql_bufman_read_ahead_pages` | Indicates the number of pages read per second in anticipation of use | counter | `instance` +`windows_mssql_bufman_read_ahead_issuing_seconds` | Time (microseconds) spent issuing readahead | counter | `instance` +`windows_mssql_bufman_target_pages` | Ideal number of pages in the buffer pool | counter | `instance` +`windows_mssql_dbreplica_database_flow_control_wait_seconds` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_database_initiated_flow_controls` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_received_file_bytes` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_group_commits` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_group_commit_stall_seconds` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_apply_pending_queue` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_apply_ready_queue` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_compressed_bytes` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_decompressed_bytes` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_received_bytes` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_compression_cachehits` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_compression_cachemisses` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_compressions` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_decompressions` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_remaining_for_undo` | The amount of log, in bytes, remaining to complete the undo phase | counter | `instance`, `replica` +`windows_mssql_dbreplica_log_send_queue` | Amount of log records in the log files of the primary database, in kilobytes, that haven't been sent to the secondary replica | counter | `instance`, `replica` +`windows_mssql_dbreplica_mirrored_write_transactions` | Number of transactions that were written to the primary database and then waited to commit until the log was sent to the secondary database, in the last second | counter | `instance`, `replica` +`windows_mssql_dbreplica_recovery_queue_records` | Amount of log records in the log files of the secondary replica that have not been redone | counter | `instance`, `replica` +`windows_mssql_dbreplica_redo_blocks` | Number of times the redo thread was blocked on locks held by readers of the database | counter | `instance`, `replica` +`windows_mssql_dbreplica_redo_remaining_bytes` | The amount of log, in kilobytes, remaining to be redone to finish the reverting phase | counter | `instance`, `replica` +`windows_mssql_dbreplica_redone_bytes` | Amount of log records redone on the secondary database in the last second | counter | `instance`, `replica` +`windows_mssql_dbreplica_redones` | _Not yet documented_ | counter | `instance`, `replica` +`windows_mssql_dbreplica_total_log_requiring_undo` | Total kilobytes of log that must be undone | counter | `instance`, `replica` +`windows_mssql_dbreplica_transaction_delay_seconds` | Delay in waiting for unterminated commit acknowledgment for all the current transactions | counter | `instance`, `replica` +`windows_mssql_databases_active_transactions` | Number of active transactions for the database | counter | `instance`, `database` +`windows_mssql_databases_backup_restore_operations` | Read/write throughput for backup and restore operations of a database per second | counter | `instance`, `database` +`windows_mssql_databases_bulk_copy_rows` | Number of rows bulk copied per second | counter | `instance`, `database` +`windows_mssql_databases_bulk_copy_bytes` | Amount of data bulk copied (in kilobytes) per second | counter | `instance`, `database` +`windows_mssql_databases_commit_table_entries` | he size (row count) of the in-memory portion of the commit table for the database | counter | `instance`, `database` +`windows_mssql_databases_data_files_size_bytes` | Cumulative size (in kilobytes) of all the data files in the database including any automatic growth. Monitoring this counter is useful, for example, for determining the correct size of tempdb | counter | `instance`, `database` +`windows_mssql_databases_dbcc_logical_scan_bytes` | Number of logical read scan bytes per second for database console commands (DBCC) | counter | `instance`, `database` +`windows_mssql_databases_group_commit_stall_seconds` | Group stall time (microseconds) per second | counter | `instance`, `database` +`windows_mssql_databases_log_flushed_bytes` | Total number of log bytes flushed | counter | `instance`, `database` +`windows_mssql_databases_log_cache_hit_ratio` | Percentage of log cache reads satisfied from the log cache | counter | `instance`, `database` +`windows_mssql_databases_log_cache_reads` | Reads performed per second through the log manager cache | counter | `instance`, `database` +`windows_mssql_databases_log_files_size_bytes` | Cumulative size (in kilobytes) of all the transaction log files in the database | counter | `instance`, `database` +`windows_mssql_databases_log_files_used_size_bytes` | The cumulative used size of all the log files in the database | counter | `instance`, `database` +`windows_mssql_databases_log_flushes` | Total wait time (in milliseconds) to flush the log. On an Always On secondary database, this value indicates the wait time for log records to be hardened to disk | counter | `instance`, `database` +`windows_mssql_databases_log_flush_waits` | Number of commits per second waiting for the log flush | counter | `instance`, `database` +`windows_mssql_databases_log_flush_wait_seconds` | Number of commits per second waiting for the log flush | counter | `instance`, `database` +`windows_mssql_databases_log_flush_write_seconds` | Time in milliseconds for performing writes of log flushes that were completed in the last second | counter | `instance`, `database` +`windows_mssql_databases_log_growths` | Total number of times the transaction log for the database has been expanded | counter | `instance`, `database` +`windows_mssql_databases_log_pool_cache_misses` | Number of requests for which the log block was not available in the log pool | counter | `instance`, `database` +`windows_mssql_databases_log_pool_disk_reads` | Number of disk reads that the log pool issued to fetch log blocks | counter | `instance`, `database` +`windows_mssql_databases_log_pool_hash_deletes` | Rate of raw hash entry deletes from the Log Pool | counter | `instance`, `database` +`windows_mssql_databases_log_pool_hash_inserts` | Rate of raw hash entry inserts into the Log Pool | counter | `instance`, `database` +`windows_mssql_databases_log_pool_invalid_hash_entries` | Rate of hash lookups failing due to being invalid | counter | `instance`, `database` +`windows_mssql_databases_log_pool_log_scan_pushes` | Rate of Log block pushes by log scans, which may come from disk or memory | counter | `instance`, `database` +`windows_mssql_databases_log_pool_log_writer_pushes` | Rate of Log block pushes by log writer thread | counter | `instance`, `database` +`windows_mssql_databases_log_pool_empty_free_pool_pushes` | Rate of Log block push fails due to empty free pool | counter | `instance`, `database` +`windows_mssql_databases_log_pool_low_memory_pushes` | Rate of Log block push fails due to being low on memory | counter | `instance`, `database` +`windows_mssql_databases_log_pool_no_free_buffer_pushes` | Rate of Log block push fails due to free buffer unavailable | counter | `instance`, `database` +`windows_mssql_databases_log_pool_req_behind_trunc` | Log pool cache misses due to block requested being behind truncation LSN | counter | `instance`, `database` +`windows_mssql_databases_log_pool_requests_old_vlf` | Log Pool requests that were not in the last VLF of the log | counter | `instance`, `database` +`windows_mssql_databases_log_pool_requests` | The number of log-block requests processed by the log pool | counter | `instance`, `database` +`windows_mssql_databases_log_pool_total_active_log_bytes` | Current total active log stored in the shared cache buffer manager in bytes | counter | `instance`, `database` +`windows_mssql_databases_log_pool_total_shared_pool_bytes` | Current total memory usage of the shared cache buffer manager in bytes | counter | `instance`, `database` +`windows_mssql_databases_log_shrinks` | Total number of log shrinks for this database | counter | `instance`, `database` +`windows_mssql_databases_log_truncations` | The number of times the transaction log has been truncated (in Simple Recovery Model) | counter | `instance`, `database` +`windows_mssql_databases_log_used_percent` | Percentage of space in the log that is in use | counter | `instance`, `database` +`windows_mssql_databases_pending_repl_transactions` | Number of transactions in the transaction log of the publication database marked for replication, but not yet delivered to the distribution database | counter | `instance`, `database` +`windows_mssql_databases_repl_transactions` | Number of transactions per second read out of the transaction log of the publication database and delivered to the distribution database | counter | `instance`, `database` +`windows_mssql_databases_shrink_data_movement_bytes` | Amount of data being moved per second by autoshrink operations, or DBCC SHRINKDATABASE or DBCC SHRINKFILE statements | counter | `instance`, `database` +`windows_mssql_databases_tracked_transactions` | Number of committed transactions recorded in the commit table for the database | counter | `instance`, `database` +`windows_mssql_databases_transactions` | Number of transactions started for the database per second | counter | `instance`, `database` +`windows_mssql_databases_write_transactions` | Number of transactions that wrote to the database and committed, in the last second | counter | `instance`, `database` +`windows_mssql_databases_xtp_controller_dlc_fetch_latency_seconds` | Average latency in microseconds between log blocks entering the Direct Log Consumer and being retrieved by the XTP controller, per second | counter | `instance`, `database` +`windows_mssql_databases_xtp_controller_dlc_peak_latency_seconds` | The largest recorded latency, in microseconds, of a fetch from the Direct Log Consumer by the XTP controller | counter | `instance`, `database` +`windows_mssql_databases_xtp_controller_log_processed_bytes` | The amount of log bytes processed by the XTP controller thread, per second | counter | `instance`, `database` +`windows_mssql_databases_xtp_memory_used_bytes` | The amount of memory used by XTP in the database | counter | `instance`, `database` +`windows_mssql_genstats_active_temp_tables` | Number of temporary tables/table variables in use | counter | `instance` +`windows_mssql_genstats_connection_resets` | Total number of logins started from the connection pool | counter | `instance` +`windows_mssql_genstats_event_notifications_delayed_drop` | Number of event notifications waiting to be dropped by a system thread | counter | `instance` +`windows_mssql_genstats_http_authenticated_requests` | Number of authenticated HTTP requests started per second | counter | `instance` +`windows_mssql_genstats_logical_connections` | Number of logical connections to the system | counter | `instance` +`windows_mssql_genstats_logins` | Total number of logins started per second. This does not include pooled connections | counter | `instance` +`windows_mssql_genstats_logouts` | Total number of logout operations started per second | counter | `instance` +`windows_mssql_genstats_mars_deadlocks` | Number of MARS deadlocks detected | counter | `instance` +`windows_mssql_genstats_non_atomic_yields` | Number of non-atomic yields per second | counter | `instance` +`windows_mssql_genstats_blocked_processes` | Number of currently blocked processes | counter | `instance` +`windows_mssql_genstats_soap_empty_requests` | Number of empty SOAP requests started per second | counter | `instance` +`windows_mssql_genstats_soap_method_invocations` | Number of SOAP method invocations started per second | counter | `instance` +`windows_mssql_genstats_soap_session_initiate_requests` | Number of SOAP Session initiate requests started per second | counter | `instance` +`windows_mssql_genstats_soap_session_terminate_requests` | Number of SOAP Session terminate requests started per second | counter | `instance` +`windows_mssql_genstats_soapsql_requests` | Number of SOAP SQL requests started per second | counter | `instance` +`windows_mssql_genstats_soapwsdl_requests` | Number of SOAP Web Service Description Language requests started per second | counter | `instance` +`windows_mssql_genstats_sql_trace_io_provider_lock_waits` | Number of waits for the File IO Provider lock per second | counter | `instance` +`windows_mssql_genstats_tempdb_recovery_unit_ids_generated` | Number of duplicate tempdb recovery unit id generated | counter | `instance` +`windows_mssql_genstats_tempdb_rowset_ids_generated` | Number of duplicate tempdb rowset id generated | counter | `instance` +`windows_mssql_genstats_temp_tables_creations` | Number of temporary tables/table variables created per second | counter | `instance` +`windows_mssql_genstats_temp_tables_awaiting_destruction` | Number of temporary tables/table variables waiting to be destroyed by the cleanup system thread | counter | `instance` +`windows_mssql_genstats_trace_event_notification_queue_size` | Number of trace event notification instances waiting in the internal queue to be sent through Service Broker | counter | `instance` +`windows_mssql_genstats_transactions` | Number of transaction enlistments (local, DTC, bound all combined) | counter | `instance` +`windows_mssql_genstats_user_connections` | Counts the number of users currently connected to SQL Server | counter | `instance` +`windows_mssql_locks_average_wait_seconds` | Average amount of wait time (in milliseconds) for each lock request that resulted in a wait | counter | `instance`, `resource` +`windows_mssql_locks_lock_requests` | Number of new locks and lock conversions per second requested from the lock manager | counter | `instance`, `resource` +`windows_mssql_locks_lock_timeouts` | Number of lock requests per second that timed out, but excluding requests for NOWAIT locks | counter | `instance`, `resource` +`windows_mssql_locks_lock_timeouts_excluding_NOWAIT` | Number of lock requests per second that timed out, including requests for NOWAIT locks | counter | `instance`, `resource` +`windows_mssql_locks_lock_waits` | Total wait time (in milliseconds) for locks in the last second | counter | `instance`, `resource` +`windows_mssql_locks_lock_wait_seconds` | Number of lock requests per second that required the caller to wait | counter | `instance`, `resource` +`windows_mssql_locks_deadlocks` | Number of lock requests per second that resulted in a deadlock | counter | `instance`, `resource` +`windows_mssql_memmgr_connection_memory_bytes` | Specifies the total amount of dynamic memory the server is using for maintaining connections | counter | `instance` +`windows_mssql_memmgr_database_cache_memory_bytes` | Specifies the amount of memory the server is currently using for the database pages cache | counter | `instance` +`windows_mssql_memmgr_external_benefit_of_memory` | An internal estimation of the performance benefit from adding memory to a specific cache | counter | `instance` +`windows_mssql_memmgr_free_memory_bytes` | Specifies the amount of committed memory currently not used by the server | counter | `instance` +`windows_mssql_memmgr_granted_workspace_memory_bytes` | Specifies the total amount of memory currently granted to executing processes, such as hash, sort, bulk copy, and index creation operations | counter | `instance` +`windows_mssql_memmgr_lock_blocks` | Specifies the current number of lock blocks in use on the server (refreshed periodically). A lock block represents an individual locked resource, such as a table, page, or row | counter | `instance` +`windows_mssql_memmgr_allocated_lock_blocks` | Specifies the current number of allocated lock blocks. At server startup, the number of allocated lock blocks plus the number of allocated lock owner blocks depends on the SQL Server Locks configuration option. If more lock blocks are needed, the value increases | counter | `instance` +`windows_mssql_memmgr_lock_memory_bytes` | Specifies the total amount of dynamic memory the server is using for locks | counter | `instance` +`windows_mssql_memmgr_lock_owner_blocks` | Specifies the current number of allocated lock owner blocks. At server startup, the number of allocated lock owner blocks and the number of allocated lock blocks depend on the SQL Server Locks configuration option. If more lock owner blocks are needed, the value increases dynamically | counter | `instance` +`windows_mssql_memmgr_allocated_lock_owner_blocks` | _Not yet documented_ | counter | `instance` +`windows_mssql_memmgr_log_pool_memory_bytes` | Total amount of dynamic memory the server is using for Log Pool | counter | `instance` +`windows_mssql_memmgr_maximum_workspace_memory_bytes` | Indicates the maximum amount of memory available for executing processes, such as hash, sort, bulk copy, and index creation operations | counter | `instance` +`windows_mssql_memmgr_outstanding_memory_grants` | Specifies the total number of processes that have successfully acquired a workspace memory grant | counter | `instance` +`windows_mssql_memmgr_pending_memory_grants` | Specifies the total number of processes waiting for a workspace memory grant | counter | `instance` +`windows_mssql_memmgr_optimizer_memory_bytes` | Specifies the total amount of dynamic memory the server is using for query optimization | counter | `instance` +`windows_mssql_memmgr_reserved_server_memory_bytes` | ndicates the amount of memory the server has reserved for future usage. This counter shows the current unused amount of memory initially granted that is shown in Granted Workspace Memory | counter | `instance` +`windows_mssql_memmgr_sql_cache_memory_bytes` | Specifies the total amount of dynamic memory the server is using for the dynamic SQL cache | counter | `instance` +`windows_mssql_memmgr_stolen_server_memory_bytes` | Specifies the amount of memory the server is using for purposes other than database pages | counter | `instance` +`windows_mssql_memmgr_target_server_memory_bytes` | Indicates the ideal amount of memory the server can consume | counter | `instance` +`windows_mssql_memmgr_total_server_memory_bytes` | Specifies the amount of memory the server has committed using the memory manager | counter | `instance` +`windows_mssql_sqlstats_auto_parameterization_attempts` | Number of failed auto-parameterization attempts per second. This should be small. Note that auto-parameterizations are also known as simple parameterizations in later versions of SQL Server | counter | `instance` +`windows_mssql_sqlstats_batch_requests` | _Not yet documented_ | counter | `instance` +`windows_mssql_sqlstats_failed_auto_parameterization_attempts` | _Not yet documented_ | counter | `instance` +`windows_mssql_sqlstats_forced_parameterizations` | Number of successful forced parameterizations per second | counter | `instance` +`windows_mssql_sqlstats_guided_plan_executions` | Number of plan executions per second in which the query plan has been generated by using a plan guide | counter | `instance` +`windows_mssql_sqlstats_misguided_plan_executions` | Number of plan executions per second in which a plan guide could not be honored during plan generation | counter | `instance` +`windows_mssql_sqlstats_safe_auto_parameterization_attempts` | Number of safe auto-parameterization attempts per second | counter | `instance` +`windows_mssql_sqlstats_sql_attentions` | Number of attentions per second | counter | `instance` +`windows_mssql_sqlstats_sql_compilations` | Number of SQL compilations per second | counter | `instance` +`windows_mssql_sqlstats_sql_recompilations` | Number of statement recompiles per second | counter | `instance` +`windows_mssql_sqlstats_unsafe_auto_parameterization_attempts` | Number of unsafe auto-parameterization attempts per second. | counter | `instance` +`windows_mssql_sql_errors_total` | Information for all errors | counter | `instance`, `resource` +`windows_mssql_transactions_tempdb_free_space_bytes` | The amount of space (in kilobytes) available in tempdb | gauge | `instance` +`windows_mssql_transactions_longest_transaction_running_seconds` | The length of time (in seconds) since the start of the transaction that has been active longer than any other current transaction | gauge | `instance` +`windows_mssql_transactions_nonsnapshot_version_active_total` | The number of currently active transactions that are not using snapshot isolation level and have made data modifications that have generated row versions in the tempdb version store | counter | `instance` +`windows_mssql_transactions_snapshot_active_total` | The number of currently active transactions using the snapshot isolation level | counter | `instance` +`windows_mssql_transactions_active_total` | The number of currently active transactions of all types | counter | `instance` +`windows_mssql_transactions_update_conflicts_total` | The percentage of those transactions using the snapshot isolation level that have encountered update conflicts within the last second | counter | `instance` +`windows_mssql_transactions_update_snapshot_active_total` | The number of currently active transactions using the snapshot isolation level and have modified data | counter | `instance` +`windows_mssql_transactions_version_cleanup_rate_bytes` | The rate (in kilobytes per second) at which row versions are removed from the snapshot isolation version store in tempdb | gauge | `instance` +`windows_mssql_transactions_version_generation_rate_bytes` | The rate (in kilobytes per second) at which new row versions are added to the snapshot isolation version store in tempdb | gauge | `instance` +`windows_mssql_transactions_version_store_size_bytes` | he amount of space (in kilobytes) in tempdb being used to store snapshot isolation level row versions | gauge | `instance` +`windows_mssql_transactions_version_store_units` | The number of active allocation units in the snapshot isolation version store in tempdb | counter | `instance` +`windows_mssql_transactions_version_store_creation_units` | The number of allocation units that have been created in the snapshot isolation store since the instance of the Database Engine was started | counter | `instance` +`windows_mssql_transactions_version_store_truncation_units` | The number of allocation units that have been removed from the snapshot isolation store since the instance of the Database Engine was started | counter | `instance` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries + +### Buffer Cache Hit Ratio + +When you read the counter in perfmon you will get the the percentage pages found in the buffer cache. This percentage is calculated internally based on the total number of cache hits divided by the total number of cache lookups over the last few thousand page accesses. +This collector retrieves the two internal values separately. In order to calculate the Buffer Cache Hit Ratio in PromQL. + +``` +windows_mssql_bufman_buffer_cache_hits{instance="host:9182", exported_instance="MSSQLSERVER"} / +windows_mssql_bufman_buffer_cache_lookups{instance="host:9182", exported_instance="MSSQLSERVER"} +``` + +This principal can be used for following metrics too: +- AccessMethodsWorktablesFromCacheHitRatio + - accessmethods_worktables_from_cache_hits + - accessmethods_worktables_from_cache_lookups +- LogCacheHitRatio + - databases_log_cache_hits + - databases_log_cache_lookups +- AverageLockWaitTime + - locks_wait_time_seconds + - locks_count + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.net.md b/docs/collector.net.md index e8cdab40..18393342 100644 --- a/docs/collector.net.md +++ b/docs/collector.net.md @@ -1,62 +1,62 @@ -# net collector - -The net collector exposes metrics about network interfaces - -||| --|- -Metric name prefix | `net` -Data source | Perflib -Classes | [`Win32_PerfRawData_Tcpip_NetworkInterface`](https://technet.microsoft.com/en-us/security/aa394340(v=vs.80)) -Enabled by default? | Yes - -## Flags - -### `--collector.net.nic-whitelist` - -If given, an interface name needs to match the whitelist regexp in order for the corresponding metrics to be reported - -### `--collector.net.nic-blacklist` - -If given, an interface name needs to *not* match the blacklist regexp in order for the corresponding metrics to be reported - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_net_bytes_received_total` | Total bytes received by interface | counter | `nic` -`wmi_net_bytes_sent_total` | Total bytes transmitted by interface | counter | `nic` -`wmi_net_bytes_total` | Total bytes received and transmitted by interface | counter | `nic` -`wmi_net_packets_outbound_discarded` | Total outbound packets that were chosen to be discarded even though no errors had been detected to prevent transmission | counter | `nic` -`wmi_net_packets_outbound_errors` | Total packets that could not be transmitted due to errors | counter | `nic` -`wmi_net_packets_received_discarded` | Total inbound packets that were chosen to be discarded even though no errors had been detected to prevent delivery | counter | `nic` -`wmi_net_packets_received_errors` | Total packets that could not be received due to errors | counter | `nic` -`wmi_net_packets_received_total` | Total packets received by interface | counter | `nic` -`wmi_net_packets_received_unknown` | Total packets received by interface that were discarded because of an unknown or unsupported protocol | counter | `nic` -`wmi_net_packets_total` | Total packets received and transmitted by interface | counter | `nic` -`wmi_net_packets_sent_total` | Total packets transmitted by interface | counter | `nic` -`wmi_net_current_bandwidth` | Estimate of the interface's current bandwidth in bits per second (bps) | gauge | `nic` - -### Example metric -Query the rate of transmitted network traffic -``` -rate(wmi_net_bytes_sent_total{instance="localhost"}[2m]) -``` - -## Useful queries -Get total utilisation of network interface as a percentage -``` -rate(wmi_net_bytes_total{instance="localhost", nic="Microsoft_Hyper_V_Network_Adapter__1"}[2m]) * 8 / wmi_net_current_bandwidth{instance="locahost", nic="Microsoft_Hyper_V_Network_Adapter__1"} * 100 -``` - -## Alerting examples -**prometheus.rules** -```yaml -- alert: NetInterfaceUsage - expr: rate(wmi_net_bytes_total[2m]) * 8 / wmi_net_current_bandwidth * 100 > 95 - for: 10m - labels: - severity: high - annotations: - summary: "Network Interface Usage (instance {{ $labels.instance }})" - description: "Network traffic usage is greater than 95% for interface {{ $labels.nic }}\n VALUE = {{ $value }}\n LABELS: {{ $labels }}" -``` +# net collector + +The net collector exposes metrics about network interfaces + +||| +-|- +Metric name prefix | `net` +Data source | Perflib +Classes | [`Win32_PerfRawData_Tcpip_NetworkInterface`](https://technet.microsoft.com/en-us/security/aa394340(v=vs.80)) +Enabled by default? | Yes + +## Flags + +### `--collector.net.nic-whitelist` + +If given, an interface name needs to match the whitelist regexp in order for the corresponding metrics to be reported + +### `--collector.net.nic-blacklist` + +If given, an interface name needs to *not* match the blacklist regexp in order for the corresponding metrics to be reported + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_net_bytes_received_total` | Total bytes received by interface | counter | `nic` +`windows_net_bytes_sent_total` | Total bytes transmitted by interface | counter | `nic` +`windows_net_bytes_total` | Total bytes received and transmitted by interface | counter | `nic` +`windows_net_packets_outbound_discarded` | Total outbound packets that were chosen to be discarded even though no errors had been detected to prevent transmission | counter | `nic` +`windows_net_packets_outbound_errors` | Total packets that could not be transmitted due to errors | counter | `nic` +`windows_net_packets_received_discarded` | Total inbound packets that were chosen to be discarded even though no errors had been detected to prevent delivery | counter | `nic` +`windows_net_packets_received_errors` | Total packets that could not be received due to errors | counter | `nic` +`windows_net_packets_received_total` | Total packets received by interface | counter | `nic` +`windows_net_packets_received_unknown` | Total packets received by interface that were discarded because of an unknown or unsupported protocol | counter | `nic` +`windows_net_packets_total` | Total packets received and transmitted by interface | counter | `nic` +`windows_net_packets_sent_total` | Total packets transmitted by interface | counter | `nic` +`windows_net_current_bandwidth` | Estimate of the interface's current bandwidth in bits per second (bps) | gauge | `nic` + +### Example metric +Query the rate of transmitted network traffic +``` +rate(windows_net_bytes_sent_total{instance="localhost"}[2m]) +``` + +## Useful queries +Get total utilisation of network interface as a percentage +``` +rate(windows_net_bytes_total{instance="localhost", nic="Microsoft_Hyper_V_Network_Adapter__1"}[2m]) * 8 / windows_net_current_bandwidth{instance="locahost", nic="Microsoft_Hyper_V_Network_Adapter__1"} * 100 +``` + +## Alerting examples +**prometheus.rules** +```yaml +- alert: NetInterfaceUsage + expr: rate(windows_net_bytes_total[2m]) * 8 / windows_net_current_bandwidth * 100 > 95 + for: 10m + labels: + severity: high + annotations: + summary: "Network Interface Usage (instance {{ $labels.instance }})" + description: "Network traffic usage is greater than 95% for interface {{ $labels.nic }}\n VALUE = {{ $value }}\n LABELS: {{ $labels }}" +``` diff --git a/docs/collector.netframework_clrexceptions.md b/docs/collector.netframework_clrexceptions.md index e35a44ad..8696cc7a 100644 --- a/docs/collector.netframework_clrexceptions.md +++ b/docs/collector.netframework_clrexceptions.md @@ -1,32 +1,31 @@ -# netframework_clrexceptions collector - -The netframework_clrexceptions collector exposes metrics about CLR exceptions in the dotnet framework. - -||| --|- -Metric name prefix | `netframework_clrexceptions` -Classes | `Win32_PerfRawData_NETFramework_NETCLRExceptions` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_...` | ... | counter/gauge/histogram/summary | ... -`wmi_netframework_clrexceptions_exceptions_thrown_total` | Displays the total number of exceptions thrown since the application started. This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions. | counter | `process` -`wmi_netframework_clrexceptions_exceptions_filters_total` | Displays the total number of .NET exception filters executed. An exception filter evaluates regardless of whether an exception is handled. | counter | `process` -`wmi_netframework_clrexceptions_exceptions_finallys_total` | Displays the total number of finally blocks executed. Only the finally blocks executed for an exception are counted; finally blocks on normal code paths are not counted by this counter. | counter | `process` -`wmi_netframework_clrexceptions_throw_to_catch_depth_total` | Displays the total number of stack frames traversed, from the frame that threw the exception to the frame that handled the exception. | counter | `process` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# netframework_clrexceptions collector + +The netframework_clrexceptions collector exposes metrics about CLR exceptions in the dotnet framework. + +||| +-|- +Metric name prefix | `netframework_clrexceptions` +Classes | `Win32_PerfRawData_NETFramework_NETCLRExceptions` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_netframework_clrexceptions_exceptions_thrown_total` | Displays the total number of exceptions thrown since the application started. This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions. | counter | `process` +`windows_netframework_clrexceptions_exceptions_filters_total` | Displays the total number of .NET exception filters executed. An exception filter evaluates regardless of whether an exception is handled. | counter | `process` +`windows_netframework_clrexceptions_exceptions_finallys_total` | Displays the total number of finally blocks executed. Only the finally blocks executed for an exception are counted; finally blocks on normal code paths are not counted by this counter. | counter | `process` +`windows_netframework_clrexceptions_throw_to_catch_depth_total` | Displays the total number of stack frames traversed, from the frame that threw the exception to the frame that handled the exception. | counter | `process` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.netframework_clrinterop.md b/docs/collector.netframework_clrinterop.md index 2d8651cb..0e54bcc2 100644 --- a/docs/collector.netframework_clrinterop.md +++ b/docs/collector.netframework_clrinterop.md @@ -1,31 +1,30 @@ -# netframework_clrinterop collector - -The netframework_clrinterop collector exposes metrics about interop between the dotnet framework and outside components. - -||| --|- -Metric name prefix | `netframework_clrinterop` -Classes | `Win32_PerfRawData_NETFramework_NETCLRInterop` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_...` | ... | counter/gauge/histogram/summary | ... -`wmi_netframework_clrinterop_com_callable_wrappers_total` | Displays the current number of COM callable wrappers (CCWs). A CCW is a proxy for a managed object being referenced from an unmanaged COM client. | counter | `process` -`wmi_netframework_clrinterop_interop_marshalling_total` | Displays the total number of times arguments and return values have been marshaled from managed to unmanaged code, and vice versa, since the application started. | counter | `process` -`wmi_netframework_clrinterop_interop_stubs_created_total` | Displays the current number of stubs created by the common language runtime. Stubs are responsible for marshaling arguments and return values from managed to unmanaged code, and vice versa, during a COM interop call or a platform invoke call. | counter | `process` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# netframework_clrinterop collector + +The netframework_clrinterop collector exposes metrics about interop between the dotnet framework and outside components. + +||| +-|- +Metric name prefix | `netframework_clrinterop` +Classes | `Win32_PerfRawData_NETFramework_NETCLRInterop` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_netframework_clrinterop_com_callable_wrappers_total` | Displays the current number of COM callable wrappers (CCWs). A CCW is a proxy for a managed object being referenced from an unmanaged COM client. | counter | `process` +`windows_netframework_clrinterop_interop_marshalling_total` | Displays the total number of times arguments and return values have been marshaled from managed to unmanaged code, and vice versa, since the application started. | counter | `process` +`windows_netframework_clrinterop_interop_stubs_created_total` | Displays the current number of stubs created by the common language runtime. Stubs are responsible for marshaling arguments and return values from managed to unmanaged code, and vice versa, during a COM interop call or a platform invoke call. | counter | `process` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.netframework_clrjit.md b/docs/collector.netframework_clrjit.md index b1ce57fd..eeb06acb 100644 --- a/docs/collector.netframework_clrjit.md +++ b/docs/collector.netframework_clrjit.md @@ -1,32 +1,31 @@ -# netframework_clrjit collector - -The netframework_clrjit collector exposes metrics about the dotnet Just-in-Time compiler. - -||| --|- -Metric name prefix | `netframework_clrjit` -Classes | `Win32_PerfRawData_NETFramework_NETCLRJit` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_...` | ... | counter/gauge/histogram/summary | ... -`wmi_netframework_clrjit_jit_methods_total` | Displays the total number of methods JIT-compiled since the application started. This counter does not include pre-JIT-compiled methods. | counter | `process` -`wmi_netframework_clrjit_jit_time_percent` | Displays the percentage of time spent in JIT compilation. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase occurs when a method and its dependencies are compiled. | gauge | `process` -`wmi_netframework_clrjit_jit_standard_failures_total` | Displays the peak number of methods the JIT compiler has failed to compile since the application started. This failure can occur if the MSIL cannot be verified or if there is an internal error in the JIT compiler. | counter | `process` -`wmi_netframework_clrjit_jit_il_bytes_total` | Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started | counter | `process` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# netframework_clrjit collector + +The netframework_clrjit collector exposes metrics about the dotnet Just-in-Time compiler. + +||| +-|- +Metric name prefix | `netframework_clrjit` +Classes | `Win32_PerfRawData_NETFramework_NETCLRJit` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_netframework_clrjit_jit_methods_total` | Displays the total number of methods JIT-compiled since the application started. This counter does not include pre-JIT-compiled methods. | counter | `process` +`windows_netframework_clrjit_jit_time_percent` | Displays the percentage of time spent in JIT compilation. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase occurs when a method and its dependencies are compiled. | gauge | `process` +`windows_netframework_clrjit_jit_standard_failures_total` | Displays the peak number of methods the JIT compiler has failed to compile since the application started. This failure can occur if the MSIL cannot be verified or if there is an internal error in the JIT compiler. | counter | `process` +`windows_netframework_clrjit_jit_il_bytes_total` | Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started | counter | `process` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.netframework_clrloading.md b/docs/collector.netframework_clrloading.md index 1231c994..412e0f71 100644 --- a/docs/collector.netframework_clrloading.md +++ b/docs/collector.netframework_clrloading.md @@ -1,37 +1,36 @@ -# netframework_clrloading collector - -The netframework_clrloading collector exposes metrics about the dotnet loader. - -||| --|- -Metric name prefix | `netframework_clrloading` -Classes | `Win32_PerfRawData_NETFramework_NETCLRLoading` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_...` | ... | counter/gauge/histogram/summary | ... -`wmi_netframework_clrloading_loader_heap_size_bytes` | Displays the current size, in bytes, of the memory committed by the class loader across all application domains. Committed memory is the physical space reserved in the disk paging file. | gauge | `process` -`wmi_netframework_clrloading_appdomains_loaded_current` | Displays the current number of application domains loaded in this application. | gauge | `process` -`wmi_netframework_clrloading_assemblies_loaded_current` | Displays the current number of assemblies loaded across all application domains in the currently running application. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once. | gauge | `process` -`wmi_netframework_clrloading_classes_loaded_current` | Displays the current number of classes loaded in all assemblies. | gauge | `process` -`wmi_netframework_clrloading_appdomains_loaded_total` | Displays the peak number of application domains loaded since the application started. | counter | `process` -`wmi_netframework_clrloading_appdomains_unloaded_total` | Displays the total number of application domains unloaded since the application started. If an application domain is loaded and unloaded multiple times, this counter increments each time the application domain is unloaded. | counter | `process` -`wmi_netframework_clrloading_assemblies_loaded_total` | Displays the total number of assemblies loaded since the application started. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once. | counter | `process` -`wmi_netframework_clrloading_classes_loaded_total` | Displays the cumulative number of classes loaded in all assemblies since the application started. | counter | `process` -`wmi_netframework_clrloading_class_load_failures_total` | Displays the peak number of classes that have failed to load since the application started. | counter | `process` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# netframework_clrloading collector + +The netframework_clrloading collector exposes metrics about the dotnet loader. + +||| +-|- +Metric name prefix | `netframework_clrloading` +Classes | `Win32_PerfRawData_NETFramework_NETCLRLoading` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_netframework_clrloading_loader_heap_size_bytes` | Displays the current size, in bytes, of the memory committed by the class loader across all application domains. Committed memory is the physical space reserved in the disk paging file. | gauge | `process` +`windows_netframework_clrloading_appdomains_loaded_current` | Displays the current number of application domains loaded in this application. | gauge | `process` +`windows_netframework_clrloading_assemblies_loaded_current` | Displays the current number of assemblies loaded across all application domains in the currently running application. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once. | gauge | `process` +`windows_netframework_clrloading_classes_loaded_current` | Displays the current number of classes loaded in all assemblies. | gauge | `process` +`windows_netframework_clrloading_appdomains_loaded_total` | Displays the peak number of application domains loaded since the application started. | counter | `process` +`windows_netframework_clrloading_appdomains_unloaded_total` | Displays the total number of application domains unloaded since the application started. If an application domain is loaded and unloaded multiple times, this counter increments each time the application domain is unloaded. | counter | `process` +`windows_netframework_clrloading_assemblies_loaded_total` | Displays the total number of assemblies loaded since the application started. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once. | counter | `process` +`windows_netframework_clrloading_classes_loaded_total` | Displays the cumulative number of classes loaded in all assemblies since the application started. | counter | `process` +`windows_netframework_clrloading_class_load_failures_total` | Displays the peak number of classes that have failed to load since the application started. | counter | `process` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.netframework_clrlocksandthreads.md b/docs/collector.netframework_clrlocksandthreads.md index e0d09c6d..8a6ec553 100644 --- a/docs/collector.netframework_clrlocksandthreads.md +++ b/docs/collector.netframework_clrlocksandthreads.md @@ -1,35 +1,34 @@ -# netframework_clrlocksandthreads collector - -The netframework_clrlocksandthreads collector exposes metrics about locks and threads in dotnet applications. - -||| --|- -Metric name prefix | `netframework_clrlocksandthreads` -Classes | `Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_...` | ... | counter/gauge/histogram/summary | ... -`wmi_netframework_clrlocksandthreads_current_queue_length` | Displays the total number of threads that are currently waiting to acquire a managed lock in the application. | gauge | `process` -`wmi_netframework_clrlocksandthreads_current_logical_threads` | Displays the number of current managed thread objects in the application. This counter maintains the count of both running and stopped threads. | gauge | `process` -`wmi_netframework_clrlocksandthreads_physical_threads_current` | Displays the number of native operating system threads created and owned by the common language runtime to act as underlying threads for managed thread objects. This counter's value does not include the threads used by the runtime in its internal operations; it is a subset of the threads in the operating system process. | gauge | `process` -`wmi_netframework_clrlocksandthreads_recognized_threads_current` | Displays the number of threads that are currently recognized by the runtime. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once. | gauge | `process` -`wmi_netframework_clrlocksandthreads_recognized_threads_total` | Displays the total number of threads that have been recognized by the runtime since the application started. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once. | counter | `process` -`wmi_netframework_clrlocksandthreads_queue_length_total` | Displays the total number of threads that waited to acquire a managed lock since the application started. | counter | `process` -`wmi_netframework_clrlocksandthreads_contentions_total` | Displays the total number of times that threads in the runtime have attempted to acquire a managed lock unsuccessfully. | counter | `process` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# netframework_clrlocksandthreads collector + +The netframework_clrlocksandthreads collector exposes metrics about locks and threads in dotnet applications. + +||| +-|- +Metric name prefix | `netframework_clrlocksandthreads` +Classes | `Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_netframework_clrlocksandthreads_current_queue_length` | Displays the total number of threads that are currently waiting to acquire a managed lock in the application. | gauge | `process` +`windows_netframework_clrlocksandthreads_current_logical_threads` | Displays the number of current managed thread objects in the application. This counter maintains the count of both running and stopped threads. | gauge | `process` +`windows_netframework_clrlocksandthreads_physical_threads_current` | Displays the number of native operating system threads created and owned by the common language runtime to act as underlying threads for managed thread objects. This counter's value does not include the threads used by the runtime in its internal operations; it is a subset of the threads in the operating system process. | gauge | `process` +`windows_netframework_clrlocksandthreads_recognized_threads_current` | Displays the number of threads that are currently recognized by the runtime. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once. | gauge | `process` +`windows_netframework_clrlocksandthreads_recognized_threads_total` | Displays the total number of threads that have been recognized by the runtime since the application started. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once. | counter | `process` +`windows_netframework_clrlocksandthreads_queue_length_total` | Displays the total number of threads that waited to acquire a managed lock since the application started. | counter | `process` +`windows_netframework_clrlocksandthreads_contentions_total` | Displays the total number of times that threads in the runtime have attempted to acquire a managed lock unsuccessfully. | counter | `process` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.netframework_clrmemory.md b/docs/collector.netframework_clrmemory.md index c0a3f7fa..daf85db0 100644 --- a/docs/collector.netframework_clrmemory.md +++ b/docs/collector.netframework_clrmemory.md @@ -1,40 +1,39 @@ -# netframework_clrmemory collector - -The netframework_clrmemory collector exposes metrics about memory in dotnet applications. - -||| --|- -Metric name prefix | `netframework_clrmemory` -Classes | `Win32_PerfRawData_NETFramework_NETCLRMemory` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_...` | ... | counter/gauge/histogram/summary | ... -`wmi_netframework_clrmemory_allocated_bytes_total` | Displays the total number of bytes allocated on the garbage collection heap. | counter | `process` -`wmi_netframework_clrmemory_finalization_survivors` | Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized. | gauge | `process` -`wmi_netframework_clrmemory_heap_size_bytes` | Displays the maximum bytes that can be allocated; it does not indicate the current number of bytes allocated. | gauge | `process` -`wmi_netframework_clrmemory_promoted_bytes` | Displays the bytes that were promoted from the generation to the next one during the last GC. Memory is promoted when it survives a garbage collection. | gauge | `process` -`wmi_netframework_clrmemory_number_gc_handles` | Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment. | gauge | `process` -`wmi_netframework_clrmemory_collections_total` | Displays the number of times the generation objects are garbage collected since the application started. | counter | `process` -`wmi_netframework_clrmemory_induced_gc_total` | Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect. | counter | `process` -`wmi_netframework_clrmemory_number_pinned_objects` | Displays the number of pinned objects encountered in the last garbage collection. | gauge | `process` -`wmi_netframework_clrmemory_number_sink_blocksinuse` | Displays the current number of synchronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. They hold weak references to managed objects and must be scanned by the garbage collector. | gauge | `process` -`wmi_netframework_clrmemory_committed_bytes` | Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file. | gauge | `process` -`wmi_netframework_clrmemory_reserved_bytes` | Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used. | gauge | `process` -`wmi_netframework_clrmemory_gc_time_percent` | Displays the percentage of time that was spent performing a garbage collection in the last sample. | gauge | `process` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# netframework_clrmemory collector + +The netframework_clrmemory collector exposes metrics about memory in dotnet applications. + +||| +-|- +Metric name prefix | `netframework_clrmemory` +Classes | `Win32_PerfRawData_NETFramework_NETCLRMemory` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_netframework_clrmemory_allocated_bytes_total` | Displays the total number of bytes allocated on the garbage collection heap. | counter | `process` +`windows_netframework_clrmemory_finalization_survivors` | Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized. | gauge | `process` +`windows_netframework_clrmemory_heap_size_bytes` | Displays the maximum bytes that can be allocated; it does not indicate the current number of bytes allocated. | gauge | `process` +`windows_netframework_clrmemory_promoted_bytes` | Displays the bytes that were promoted from the generation to the next one during the last GC. Memory is promoted when it survives a garbage collection. | gauge | `process` +`windows_netframework_clrmemory_number_gc_handles` | Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment. | gauge | `process` +`windows_netframework_clrmemory_collections_total` | Displays the number of times the generation objects are garbage collected since the application started. | counter | `process` +`windows_netframework_clrmemory_induced_gc_total` | Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect. | counter | `process` +`windows_netframework_clrmemory_number_pinned_objects` | Displays the number of pinned objects encountered in the last garbage collection. | gauge | `process` +`windows_netframework_clrmemory_number_sink_blocksinuse` | Displays the current number of synchronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. They hold weak references to managed objects and must be scanned by the garbage collector. | gauge | `process` +`windows_netframework_clrmemory_committed_bytes` | Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file. | gauge | `process` +`windows_netframework_clrmemory_reserved_bytes` | Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used. | gauge | `process` +`windows_netframework_clrmemory_gc_time_percent` | Displays the percentage of time that was spent performing a garbage collection in the last sample. | gauge | `process` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.netframework_clrremoting.md b/docs/collector.netframework_clrremoting.md index 502b830e..0051deb5 100644 --- a/docs/collector.netframework_clrremoting.md +++ b/docs/collector.netframework_clrremoting.md @@ -1,33 +1,33 @@ -# netframework_clrremoting collector - -The netframework_clrremoting collector exposes metrics about dotnet remoting. - -||| --|- -Metric name prefix | `netframework_clrremoting` -Classes | `Win32_PerfRawData_NETFramework_NETCLRRemoting` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_netframework_clrremoting_channels_total` | Displays the total number of remoting channels registered across all application domains since application started. | counter | `process` -`wmi_netframework_clrremoting_context_bound_classes_loaded` | Displays the current number of context-bound classes that are loaded. | gauge | `process` -`wmi_netframework_clrremoting_context_bound_objects_total` | Displays the total number of context-bound objects allocated. | counter | `process` -`wmi_netframework_clrremoting_context_proxies_total` | Displays the total number of remoting proxy objects in this process since it started. | counter | `process` -`wmi_netframework_clrremoting_contexts` | Displays the current number of remoting contexts in the application. | gauge | `process` -`wmi_netframework_clrremoting_remote_calls_total` | Displays the total number of remote procedure calls invoked since the application started. | counter | `process` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# netframework_clrremoting collector + +The netframework_clrremoting collector exposes metrics about dotnet remoting. + +||| +-|- +Metric name prefix | `netframework_clrremoting` +Classes | `Win32_PerfRawData_NETFramework_NETCLRRemoting` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_netframework_clrremoting_channels_total` | Displays the total number of remoting channels registered across all application domains since application started. | counter | `process` +`windows_netframework_clrremoting_context_bound_classes_loaded` | Displays the current number of context-bound classes that are loaded. | gauge | `process` +`windows_netframework_clrremoting_context_bound_objects_total` | Displays the total number of context-bound objects allocated. | counter | `process` +`windows_netframework_clrremoting_context_proxies_total` | Displays the total number of remoting proxy objects in this process since it started. | counter | `process` +`windows_netframework_clrremoting_contexts` | Displays the current number of remoting contexts in the application. | gauge | `process` +`windows_netframework_clrremoting_remote_calls_total` | Displays the total number of remote procedure calls invoked since the application started. | counter | `process` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.netframework_clrsecurity.md b/docs/collector.netframework_clrsecurity.md index 5b293e32..44741652 100644 --- a/docs/collector.netframework_clrsecurity.md +++ b/docs/collector.netframework_clrsecurity.md @@ -1,31 +1,31 @@ -# netframework_clrsecurity collector - -The netframework_clrsecurity collector exposes metrics about security checks in dotnet applications - -||| --|- -Metric name prefix | `netframework_clrsecurity` -Classes | `Win32_PerfRawData_NETFramework_NETCLRSecurity` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_netframework_clrsecurity_link_time_checks_total` | Displays the total number of link-time code access security checks since the application started. | counter | `process` -`wmi_netframework_clrsecurity_rt_checks_time_percent` | Displays the percentage of time spent performing runtime code access security checks in the last sample. | gauge | `process` -`wmi_netframework_clrsecurity_stack_walk_depth` | Displays the depth of the stack during that last runtime code access security check. | gauge | `process` -`wmi_netframework_clrsecurity_runtime_checks_total` | Displays the total number of runtime code access security checks performed since the application started. | counter | `process` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# netframework_clrsecurity collector + +The netframework_clrsecurity collector exposes metrics about security checks in dotnet applications + +||| +-|- +Metric name prefix | `netframework_clrsecurity` +Classes | `Win32_PerfRawData_NETFramework_NETCLRSecurity` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_netframework_clrsecurity_link_time_checks_total` | Displays the total number of link-time code access security checks since the application started. | counter | `process` +`windows_netframework_clrsecurity_rt_checks_time_percent` | Displays the percentage of time spent performing runtime code access security checks in the last sample. | gauge | `process` +`windows_netframework_clrsecurity_stack_walk_depth` | Displays the depth of the stack during that last runtime code access security check. | gauge | `process` +`windows_netframework_clrsecurity_runtime_checks_total` | Displays the total number of runtime code access security checks performed since the application started. | counter | `process` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.os.md b/docs/collector.os.md index be209775..3993e103 100644 --- a/docs/collector.os.md +++ b/docs/collector.os.md @@ -1,66 +1,66 @@ -# os collector - -The os collector exposes metrics about the operating system - -||| --|- -Metric name prefix | `os` -Classes | [`Win32_OperatingSystem`](https://msdn.microsoft.com/en-us/library/aa394239) -Enabled by default? | Yes - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_os_info` | Contains full product name & version in labels | gauge | `product`, `version` -`wmi_os_paging_limit_bytes` | Total number of bytes that can be sotred in the operating system paging files. 0 (zero) indicates that there are no paging files | gauge | None -`wmi_os_paging_free_bytes` | Number of bytes that can be mapped into the operating system paging files without causing any other pages to be swapped out | gauge | None -`wmi_os_physical_memory_free_bytes` | Bytes of physical memory currently unused and available | gauge | None -`wmi_os_time` | Current time as reported by the operating system, in [Unix time](https://en.wikipedia.org/wiki/Unix_time). See [time.Unix()](https://golang.org/pkg/time/#Unix) for details | gauge | None -`wmi_os_timezone` | Current timezone as reported by the operating system. See [time.Zone()](https://golang.org/pkg/time/#Time.Zone) for details | gauge | `timezone` -`wmi_os_processes` | Number of process contexts currently loaded or running on the operating system | gauge | None -`wmi_os_processes_limit` | Maximum number of process contexts the operating system can support. The default value set by the provider is 4294967295 (0xFFFFFFFF) | gauge | None -`wmi_os_process_memory_limit_bytes` | Maximum number of bytes of memory that can be allocated to a process | gauge | None -`wmi_os_users` | Number of user sessions for which the operating system is storing state information currently. For a list of current active logon sessions, see [`logon`](collector.logon.md) | gauge | None -`wmi_os_virtual_memory_bytes` | Bytes of virtual memory | gauge | None -`wmi_os_visible_memory_bytes` | Total bytes of physical memory available to the operating system. This value does not necessarily indicate the true amount of physical memory, but what is reported to the operating system as available to it | gauge | None -`wmi_os_virtual_memory_free_bytes` | Bytes of virtual memory currently unused and available | gauge | None - -### Example metric -Show current number of processes -``` -wmi_os_processes{instance="localhost"} -``` - -## Useful queries -Find all devices not set to UTC timezone -``` -wmi_os_timezone{timezone != "UTC"} -``` - -## Alerting examples -**prometheus.rules** -```yaml -# Alert on hosts that have exhausted all available physical memory -- alert: MemoryExhausted - expr: wmi_os_physical_memory_free_bytes == 0 - for: 10m - labels: - severity: high - annotations: - summary: "Host {{ $labels.instance }} is out of memory" - description: "{{ $labels.instance }} has exhausted all available physical memory" - -# Alert on hosts with greater than 90% memory usage -- alert: MemoryLow - expr: 100 - 100 * wmi_os_physical_memory_free_bytes / wmi_cs_physical_memory_bytes > 90 - for: 10m - labels: - severity: warning - annotations: - summary: "Memory usage for host {{ $labels.instance }} is greater than 90%" -``` +# os collector + +The os collector exposes metrics about the operating system + +||| +-|- +Metric name prefix | `os` +Classes | [`Win32_OperatingSystem`](https://msdn.microsoft.com/en-us/library/aa394239) +Enabled by default? | Yes + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_os_info` | Contains full product name & version in labels | gauge | `product`, `version` +`windows_os_paging_limit_bytes` | Total number of bytes that can be sotred in the operating system paging files. 0 (zero) indicates that there are no paging files | gauge | None +`windows_os_paging_free_bytes` | Number of bytes that can be mapped into the operating system paging files without causing any other pages to be swapped out | gauge | None +`windows_os_physical_memory_free_bytes` | Bytes of physical memory currently unused and available | gauge | None +`windows_os_time` | Current time as reported by the operating system, in [Unix time](https://en.wikipedia.org/wiki/Unix_time). See [time.Unix()](https://golang.org/pkg/time/#Unix) for details | gauge | None +`windows_os_timezone` | Current timezone as reported by the operating system. See [time.Zone()](https://golang.org/pkg/time/#Time.Zone) for details | gauge | `timezone` +`windows_os_processes` | Number of process contexts currently loaded or running on the operating system | gauge | None +`windows_os_processes_limit` | Maximum number of process contexts the operating system can support. The default value set by the provider is 4294967295 (0xFFFFFFFF) | gauge | None +`windows_os_process_memory_limit_bytes` | Maximum number of bytes of memory that can be allocated to a process | gauge | None +`windows_os_users` | Number of user sessions for which the operating system is storing state information currently. For a list of current active logon sessions, see [`logon`](collector.logon.md) | gauge | None +`windows_os_virtual_memory_bytes` | Bytes of virtual memory | gauge | None +`windows_os_visible_memory_bytes` | Total bytes of physical memory available to the operating system. This value does not necessarily indicate the true amount of physical memory, but what is reported to the operating system as available to it | gauge | None +`windows_os_virtual_memory_free_bytes` | Bytes of virtual memory currently unused and available | gauge | None + +### Example metric +Show current number of processes +``` +windows_os_processes{instance="localhost"} +``` + +## Useful queries +Find all devices not set to UTC timezone +``` +windows_os_timezone{timezone != "UTC"} +``` + +## Alerting examples +**prometheus.rules** +```yaml +# Alert on hosts that have exhausted all available physical memory +- alert: MemoryExhausted + expr: windows_os_physical_memory_free_bytes == 0 + for: 10m + labels: + severity: high + annotations: + summary: "Host {{ $labels.instance }} is out of memory" + description: "{{ $labels.instance }} has exhausted all available physical memory" + +# Alert on hosts with greater than 90% memory usage +- alert: MemoryLow + expr: 100 - 100 * windows_os_physical_memory_free_bytes / windows_cs_physical_memory_bytes > 90 + for: 10m + labels: + severity: warning + annotations: + summary: "Memory usage for host {{ $labels.instance }} is greater than 90%" +``` diff --git a/docs/collector.process.md b/docs/collector.process.md index 3a25738c..70638555 100644 --- a/docs/collector.process.md +++ b/docs/collector.process.md @@ -1,65 +1,65 @@ -# process collector - -The process collector exposes metrics about processes - -||| --|- -Metric name prefix | `process` -Data source | Perflib -Counters | `Process` -Enabled by default? | No - -## Flags - -### `--collector.process.whitelist` - -Regexp of processes to include. Process name must both match whitelist and not -match blacklist to be included. Recommended to keep down number of returned -metrics. - -### `--collector.process.blacklist` - -Regexp of processes to exclude. Process name must both match whitelist and not -match blacklist to be included. Recommended to keep down number of returned -metrics. - -### Example -To match all firefox processes: `--collector.process.whitelist="firefox.+"`. -Note that multiple processes with the same name will be disambiguated by -Windows by adding a number suffix, such as `firefox#2`. Your [regexp](https://en.wikipedia.org/wiki/Regular_expression) must take -these suffixes into consideration. - -:warning: The regexp is case-sensitive, so `--collector.process.whitelist="FIREFOX.+"` will **NOT** match a process named `firefox` . - -To specify multiple names, use the pipe `|` character: -``` ---collector.process.whitelist="firefox.+|FIREFOX.+|chrome.+" -``` -This will match all processes named `firefox`, `FIREFOX` or `chrome` . - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_process_start_time` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` -`wmi_process_cpu_time_total` | _Not yet documented_ | counter | `process`, `process_id`, `creating_process_id` -`wmi_process_handle_count` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` -`wmi_process_io_bytes_total` | _Not yet documented_ | counter | `process`, `process_id`, `creating_process_id` -`wmi_process_io_operations_total` | _Not yet documented_ | counter | `process`, `process_id`, `creating_process_id` -`wmi_process_page_faults_total` | _Not yet documented_ | counter | `process`, `process_id`, `creating_process_id` -`wmi_process_page_file_bytes` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` -`wmi_process_pool_bytes` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` -`wmi_process_priority_base` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` -`wmi_process_private_bytes` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` -`wmi_process_thread_count` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` -`wmi_process_virtual_bytes` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` -`wmi_process_working_set` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# process collector + +The process collector exposes metrics about processes + +||| +-|- +Metric name prefix | `process` +Data source | Perflib +Counters | `Process` +Enabled by default? | No + +## Flags + +### `--collector.process.whitelist` + +Regexp of processes to include. Process name must both match whitelist and not +match blacklist to be included. Recommended to keep down number of returned +metrics. + +### `--collector.process.blacklist` + +Regexp of processes to exclude. Process name must both match whitelist and not +match blacklist to be included. Recommended to keep down number of returned +metrics. + +### Example +To match all firefox processes: `--collector.process.whitelist="firefox.+"`. +Note that multiple processes with the same name will be disambiguated by +Windows by adding a number suffix, such as `firefox#2`. Your [regexp](https://en.wikipedia.org/wiki/Regular_expression) must take +these suffixes into consideration. + +:warning: The regexp is case-sensitive, so `--collector.process.whitelist="FIREFOX.+"` will **NOT** match a process named `firefox` . + +To specify multiple names, use the pipe `|` character: +``` +--collector.process.whitelist="firefox.+|FIREFOX.+|chrome.+" +``` +This will match all processes named `firefox`, `FIREFOX` or `chrome` . + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_process_start_time` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_cpu_time_total` | _Not yet documented_ | counter | `process`, `process_id`, `creating_process_id` +`windows_process_handle_count` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_io_bytes_total` | _Not yet documented_ | counter | `process`, `process_id`, `creating_process_id` +`windows_process_io_operations_total` | _Not yet documented_ | counter | `process`, `process_id`, `creating_process_id` +`windows_process_page_faults_total` | _Not yet documented_ | counter | `process`, `process_id`, `creating_process_id` +`windows_process_page_file_bytes` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_pool_bytes` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_priority_base` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_private_bytes` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_thread_count` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_virtual_bytes` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` +`windows_process_working_set` | _Not yet documented_ | gauge | `process`, `process_id`, `creating_process_id` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.remote_fx.md b/docs/collector.remote_fx.md index 6b16f2ec..98db465b 100644 --- a/docs/collector.remote_fx.md +++ b/docs/collector.remote_fx.md @@ -1,51 +1,51 @@ -# remote_fx collector - -The remote_fx collector exposes Performance Counters regarding the RemoteFX protocol (RDP). It exposes both network and graphics related performance counters. - -||| --|- -Metric name prefix | `remote_fx` -Data source | Perflib -Classes | [`Win32_PerfRawData_Counters_RemoteFXNetwork`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_remotefxnetwork/), [`Win32_PerfRawData_Counters_RemoteFXGraphics`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_remotefxgraphics), [more info...](https://docs.microsoft.com/en-us/azure/virtual-desktop/remotefx-graphics-performance-counters) -Enabled by default? | No - - -## Flags - -None - -## Metrics (Network) - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_remote_fx_net_base_udp_rtt_seconds` | Base UDP round-trip time (RTT) detected in seconds. | gauge | `session_name` -`wmi_remote_fx_net_base_tcp_rtt_seconds` | Base TCP round-trip time (RTT) detected in seconds. | gauge | `session_name` -`wmi_remote_fx_net_current_tcp_bandwidth` | TCP Bandwidth detected in bytes per second. | gauge | `session_name` -`wmi_remote_fx_net_current_tcp_rtt_seconds` | Average TCP round-trip time (RTT) detected in seconds. | gauge | `session_name` -`wmi_remote_fx_net_current_udp_bandwidth` | UDP Bandwidth detected in bytes per second. | gauge | `session_name` -`wmi_remote_fx_net_current_udp_rtt_seconds` | Average UDP round-trip time (RTT) detected in seconds. | gauge | `session_name` -`wmi_remote_fx_net_received_bytes_total` | _Not yet documented_ | counter | `session_name` -`wmi_remote_fx_net_sent_bytes_total` | _Not yet documented_ | counter | `session_name` -`wmi_remote_fx_net_udp_packets_received_total` | Rate in packets per second at which packets are received over UDP. | counter | `session_name` -`wmi_remote_fx_net_udp_packets_sent_total` | Rate in packets per second at which packets are sent over UDP. | counter | `session_name` - -## Metrics (Graphics) - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_remote_fx_gfx_average_encoding_time_seconds` | Average frame encoding time. | gauge | `session_name` -`wmi_remote_fx_gfx_frame_quality` | Quality of the output frame expressed as a percentage of the quality of the source frame. | gauge | `session_name` -`wmi_remote_fx_gfx_frames_skipped_insufficient_resource_total` | Number of frames skipped per second due to insufficient resources. resources are client, server or network. | counter | `session_name`, `resource` -`wmi_remote_fx_gfx_graphics_compression_ratio` | Ratio of the number of bytes encoded to the number of bytes input. | gauge | `session_name` -`wmi_remote_fx_gfx_input_frames_total` | Number of sources frames provided as input to RemoteFX graphics per second. | counter | `session_name` -`wmi_remote_fx_gfx_output_frames_total` | Number of frames sent to the client per second. | counter | `session_name` -`wmi_remote_fx_gfx_source_frames_total` | Number of frames composed by the source (DWM) per second. | counter | `session_name` - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# remote_fx collector + +The remote_fx collector exposes Performance Counters regarding the RemoteFX protocol (RDP). It exposes both network and graphics related performance counters. + +||| +-|- +Metric name prefix | `remote_fx` +Data source | Perflib +Classes | [`Win32_PerfRawData_Counters_RemoteFXNetwork`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_remotefxnetwork/), [`Win32_PerfRawData_Counters_RemoteFXGraphics`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_counters_remotefxgraphics), [more info...](https://docs.microsoft.com/en-us/azure/virtual-desktop/remotefx-graphics-performance-counters) +Enabled by default? | No + + +## Flags + +None + +## Metrics (Network) + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_remote_fx_net_base_udp_rtt_seconds` | Base UDP round-trip time (RTT) detected in seconds. | gauge | `session_name` +`windows_remote_fx_net_base_tcp_rtt_seconds` | Base TCP round-trip time (RTT) detected in seconds. | gauge | `session_name` +`windows_remote_fx_net_current_tcp_bandwidth` | TCP Bandwidth detected in bytes per second. | gauge | `session_name` +`windows_remote_fx_net_current_tcp_rtt_seconds` | Average TCP round-trip time (RTT) detected in seconds. | gauge | `session_name` +`windows_remote_fx_net_current_udp_bandwidth` | UDP Bandwidth detected in bytes per second. | gauge | `session_name` +`windows_remote_fx_net_current_udp_rtt_seconds` | Average UDP round-trip time (RTT) detected in seconds. | gauge | `session_name` +`windows_remote_fx_net_received_bytes_total` | _Not yet documented_ | counter | `session_name` +`windows_remote_fx_net_sent_bytes_total` | _Not yet documented_ | counter | `session_name` +`windows_remote_fx_net_udp_packets_received_total` | Rate in packets per second at which packets are received over UDP. | counter | `session_name` +`windows_remote_fx_net_udp_packets_sent_total` | Rate in packets per second at which packets are sent over UDP. | counter | `session_name` + +## Metrics (Graphics) + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_remote_fx_gfx_average_encoding_time_seconds` | Average frame encoding time. | gauge | `session_name` +`windows_remote_fx_gfx_frame_quality` | Quality of the output frame expressed as a percentage of the quality of the source frame. | gauge | `session_name` +`windows_remote_fx_gfx_frames_skipped_insufficient_resource_total` | Number of frames skipped per second due to insufficient resources. resources are client, server or network. | counter | `session_name`, `resource` +`windows_remote_fx_gfx_graphics_compression_ratio` | Ratio of the number of bytes encoded to the number of bytes input. | gauge | `session_name` +`windows_remote_fx_gfx_input_frames_total` | Number of sources frames provided as input to RemoteFX graphics per second. | counter | `session_name` +`windows_remote_fx_gfx_output_frames_total` | Number of frames sent to the client per second. | counter | `session_name` +`windows_remote_fx_gfx_source_frames_total` | Number of frames composed by the source (DWM) per second. | counter | `session_name` + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.service.md b/docs/collector.service.md index a3b76463..4b501b89 100644 --- a/docs/collector.service.md +++ b/docs/collector.service.md @@ -1,108 +1,108 @@ -# service collector - -The service collector exposes metrics about Windows Services - -||| --|- -Metric name prefix | `service` -Classes | [`Win32_Service`](https://msdn.microsoft.com/en-us/library/aa394418(v=vs.85).aspx) -Enabled by default? | Yes - -## Flags - -### `--collector.service.services-where` - -A WMI filter on which services to include. Recommended to keep down number of returned metrics. - -Example: `--collector.service.services-where="Name='wmi_exporter'"` - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_service_info` | Contains service information in labels, constant 1 | gauge | name, display_name, process_id -`wmi_service_state` | The state of the service, 1 if the current state, 0 otherwise | gauge | name, state -`wmi_service_start_mode` | The start mode of the service, 1 if the current start mode, 0 otherwise | gauge | name, start_mode -`wmi_service_status` | The status of the service, 1 if the current status, 0 otherwise | gauge | name, status - -For the values of the `state`, `start_mode` and `status` labels, see below. - -### States - -A service can be in the following states: -- `stopped` -- `start pending` -- `stop pending` -- `running` -- `continue pending` -- `pause pending` -- `paused` -- `unknown` - -### Start modes - -A service can have the following start modes: -- `boot` -- `system` -- `auto` -- `manual` -- `disabled` - -### Status - -A service can have any of the following statuses: -- `ok` -- `error` -- `degraded` -- `unknown` -- `pred fail` -- `starting` -- `stopping` -- `service` -- `stressed` -- `nonrecover` -- `no contact` -- `lost comm` - -Note that there is some overlap with service state. - -### Example metric -Lists the services that have a 'disabled' start mode. -``` -wmi_service_start_mode{exported_name=~"(mssqlserver|sqlserveragent)",start_mode="disabled"} -``` - -## Useful queries -Counts the number of Microsoft SQL Server/Agent Processes -``` -count(wmi_service_state{exported_name=~"(sqlserveragent|mssqlserver)",state="running"}) -``` - -## Alerting examples -**prometheus.rules** -```yaml -groups: -- name: Microsoft SQL Server Alerts - rules: - - # Sends an alert when the 'sqlserveragent' service is not in the running state for 3 minutes. - - alert: SQL Server Agent DOWN - expr: wmi_service_state{instance="SQL",exported_name="sqlserveragent",state="running"} == 0 - for: 3m - labels: - severity: high - annotations: - summary: "Service {{ $labels.exported_name }} down" - description: "Service {{ $labels.exported_name }} on instance {{ $labels.instance }} has been down for more than 3 minutes." - - # Sends an alert when the 'mssqlserver' service is not in the running state for 3 minutes. - - alert: SQL Server DOWN - expr: wmi_service_state{instance="SQL",exported_name="mssqlserver",state="running"} == 0 - for: 3m - labels: - severity: high - annotations: - summary: "Service {{ $labels.exported_name }} down" - description: "Service {{ $labels.exported_name }} on instance {{ $labels.instance }} has been down for more than 3 minutes." -``` -In this example, `instance` is the target label of the host. So each alert will be processed per host, which is then used in the alert description. +# service collector + +The service collector exposes metrics about Windows Services + +||| +-|- +Metric name prefix | `service` +Classes | [`Win32_Service`](https://msdn.microsoft.com/en-us/library/aa394418(v=vs.85).aspx) +Enabled by default? | Yes + +## Flags + +### `--collector.service.services-where` + +A WMI filter on which services to include. Recommended to keep down number of returned metrics. + +Example: `--collector.service.services-where="Name='windows_exporter'"` + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_service_info` | Contains service information in labels, constant 1 | gauge | name, display_name, process_id +`windows_service_state` | The state of the service, 1 if the current state, 0 otherwise | gauge | name, state +`windows_service_start_mode` | The start mode of the service, 1 if the current start mode, 0 otherwise | gauge | name, start_mode +`windows_service_status` | The status of the service, 1 if the current status, 0 otherwise | gauge | name, status + +For the values of the `state`, `start_mode` and `status` labels, see below. + +### States + +A service can be in the following states: +- `stopped` +- `start pending` +- `stop pending` +- `running` +- `continue pending` +- `pause pending` +- `paused` +- `unknown` + +### Start modes + +A service can have the following start modes: +- `boot` +- `system` +- `auto` +- `manual` +- `disabled` + +### Status + +A service can have any of the following statuses: +- `ok` +- `error` +- `degraded` +- `unknown` +- `pred fail` +- `starting` +- `stopping` +- `service` +- `stressed` +- `nonrecover` +- `no contact` +- `lost comm` + +Note that there is some overlap with service state. + +### Example metric +Lists the services that have a 'disabled' start mode. +``` +windows_service_start_mode{exported_name=~"(mssqlserver|sqlserveragent)",start_mode="disabled"} +``` + +## Useful queries +Counts the number of Microsoft SQL Server/Agent Processes +``` +count(windows_service_state{exported_name=~"(sqlserveragent|mssqlserver)",state="running"}) +``` + +## Alerting examples +**prometheus.rules** +```yaml +groups: +- name: Microsoft SQL Server Alerts + rules: + + # Sends an alert when the 'sqlserveragent' service is not in the running state for 3 minutes. + - alert: SQL Server Agent DOWN + expr: windows_service_state{instance="SQL",exported_name="sqlserveragent",state="running"} == 0 + for: 3m + labels: + severity: high + annotations: + summary: "Service {{ $labels.exported_name }} down" + description: "Service {{ $labels.exported_name }} on instance {{ $labels.instance }} has been down for more than 3 minutes." + + # Sends an alert when the 'mssqlserver' service is not in the running state for 3 minutes. + - alert: SQL Server DOWN + expr: windows_service_state{instance="SQL",exported_name="mssqlserver",state="running"} == 0 + for: 3m + labels: + severity: high + annotations: + summary: "Service {{ $labels.exported_name }} down" + description: "Service {{ $labels.exported_name }} on instance {{ $labels.instance }} has been down for more than 3 minutes." +``` +In this example, `instance` is the target label of the host. So each alert will be processed per host, which is then used in the alert description. diff --git a/docs/collector.system.md b/docs/collector.system.md index d7fb9cd1..61d9b88b 100644 --- a/docs/collector.system.md +++ b/docs/collector.system.md @@ -1,40 +1,40 @@ -# system collector - -The system collector exposes metrics about ... - -||| --|- -Metric name prefix | `system` -Data source | Perflib -Classes | [`Win32_PerfRawData_PerfOS_System`](https://web.archive.org/web/20050830140516/http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_perfrawdata_perfos_system.asp) -Enabled by default? | Yes - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_system_context_switches_total` | Total number of [context switches](https://en.wikipedia.org/wiki/Context_switch) | counter | None -`wmi_system_exception_dispatches_total` | Total exceptions dispatched by the system | counter | None -`wmi_system_processor_queue_length` | Number of threads in the processor queue. There is a single queue for processor time even on computers with multiple processors. | gauge | None -`wmi_system_system_calls_total` | Total combined calls to Windows NT system service routines by all processes running on the computer | counter | None -`wmi_system_system_up_time` | Time of last boot of system | gauge | None -`wmi_system_threads` | Number of Windows system [threads](https://en.wikipedia.org/wiki/Thread_(computing)) | gauge | None - -### Example metric -Show current number of system threads -``` -wmi_system_threads{instance="localhost"} -``` - -## Useful queries -Find hosts that have rebooted in the last 24 hours -``` -time() - wmi_system_system_up_time < 86400 -``` - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# system collector + +The system collector exposes metrics about ... + +||| +-|- +Metric name prefix | `system` +Data source | Perflib +Classes | [`Win32_PerfRawData_PerfOS_System`](https://web.archive.org/web/20050830140516/http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_perfrawdata_perfos_system.asp) +Enabled by default? | Yes + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_system_context_switches_total` | Total number of [context switches](https://en.wikipedia.org/wiki/Context_switch) | counter | None +`windows_system_exception_dispatches_total` | Total exceptions dispatched by the system | counter | None +`windows_system_processor_queue_length` | Number of threads in the processor queue. There is a single queue for processor time even on computers with multiple processors. | gauge | None +`windows_system_system_calls_total` | Total combined calls to Windows NT system service routines by all processes running on the computer | counter | None +`windows_system_system_up_time` | Time of last boot of system | gauge | None +`windows_system_threads` | Number of Windows system [threads](https://en.wikipedia.org/wiki/Thread_(computing)) | gauge | None + +### Example metric +Show current number of system threads +``` +windows_system_threads{instance="localhost"} +``` + +## Useful queries +Find hosts that have rebooted in the last 24 hours +``` +time() - windows_system_system_up_time < 86400 +``` + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.tcp.md b/docs/collector.tcp.md index e3bb0ad3..081be618 100644 --- a/docs/collector.tcp.md +++ b/docs/collector.tcp.md @@ -1,36 +1,36 @@ -# tcp collector - -The tcp collector exposes metrics about the TCP/IPv4 network stack. - -||| --|- -Metric name prefix | `tcp` -Classes | [`Win32_PerfRawData_Tcpip_TCPv4`](https://msdn.microsoft.com/en-us/library/aa394341(v=vs.85).aspx) -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_tcp_connection_failures` | Number of times TCP connections have made a direct transition to the CLOSED state from the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition from the SYN-RCVD state to the LISTEN state | counter | None -`wmi_tcp_connections_active` | Number of times TCP connections have made a direct transition from the CLOSED state to the SYN-SENT state.| counter | None -`wmi_tcp_connections_established` | Number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT. | counter | None -`wmi_tcp_connections_passive` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | None -`wmi_tcp_connections_reset` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | None -`wmi_tcp_segments_total` | Total segments sent or received using the TCP protocol | counter | None -`wmi_tcp_segments_received_total` | Total segments received, including those received in error. This count includes segments received on currently established connections | counter | None -`wmi_tcp_segments_retransmitted_total` | Total segments retransmitted. That is, segments transmitted that contain one or more previously transmitted bytes | counter | None -`wmi_tcp_segments_sent_total` | Total segments sent, including those on current connections, but excluding those containing *only* retransmitted bytes | counter | None - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# tcp collector + +The tcp collector exposes metrics about the TCP/IPv4 network stack. + +||| +-|- +Metric name prefix | `tcp` +Classes | [`Win32_PerfRawData_Tcpip_TCPv4`](https://msdn.microsoft.com/en-us/library/aa394341(v=vs.85).aspx) +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_tcp_connection_failures` | Number of times TCP connections have made a direct transition to the CLOSED state from the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition from the SYN-RCVD state to the LISTEN state | counter | None +`windows_tcp_connections_active` | Number of times TCP connections have made a direct transition from the CLOSED state to the SYN-SENT state.| counter | None +`windows_tcp_connections_established` | Number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT. | counter | None +`windows_tcp_connections_passive` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | None +`windows_tcp_connections_reset` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | None +`windows_tcp_segments_total` | Total segments sent or received using the TCP protocol | counter | None +`windows_tcp_segments_received_total` | Total segments received, including those received in error. This count includes segments received on currently established connections | counter | None +`windows_tcp_segments_retransmitted_total` | Total segments retransmitted. That is, segments transmitted that contain one or more previously transmitted bytes | counter | None +`windows_tcp_segments_sent_total` | Total segments sent, including those on current connections, but excluding those containing *only* retransmitted bytes | counter | None + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.terminal_services.md b/docs/collector.terminal_services.md index ca197c51..11f1073e 100644 --- a/docs/collector.terminal_services.md +++ b/docs/collector.terminal_services.md @@ -1,48 +1,48 @@ -# terminal_services collector - -The terminal_services collector exposes terminal services (Remote Desktop Services) performance metrics. - -||| --|- -Metric name prefix | `terminal_services` -Data source | Perflib/WMI -Classes | [`Win32_PerfRawData_LocalSessionManager_TerminalServices`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_localsessionmanager_terminalservices/), [`Win32_PerfRawData_TermService_TerminalServicesSession`](https://docs.microsoft.com/en-us/previous-versions/aa394344(v%3Dvs.85)), [`Win32_PerfRawData_RemoteDesktopConnectionBrokerPerformanceCounterProvider_RemoteDesktopConnectionBrokerCounterset`](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/mt729067(v%3Dws.11)) -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_terminal_services_local_session_count` | Number of local Terminal Services sessions. | gauge | `session` -`wmi_terminal_services_connection_broker_performance_total`* | The total number of connections handled by the Connection Brokers since the service started. | counter | `connection` -`wmi_terminal_services_handle_count` | Total number of handles currently opened by this process. This number is the sum of the handles currently opened by each thread in this process. | gauge | `session_name` -`wmi_terminal_services_page_fault_total` | Rate at which page faults occur in the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. The page may not be retrieved from disk if it is on the standby list and therefore already in main memory. The page also may not be retrieved if it is in use by another process which shares the page. | counter | `session_name` -`wmi_terminal_services_page_file_bytes` | Current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory. | gauge | `session_name` -`wmi_terminal_services_page_file_bytes_peak` | Maximum number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory. | gauge | `session_name` -`wmi_terminal_services_privileged_time_seconds_total` | total elapsed time that the threads of the process have spent executing code in privileged mode. | Counter | `session_name` -`wmi_terminal_services_processor_time_seconds_total` | total elapsed time that all of the threads of this process used the processor to execute instructions. | Counter | `session_name` -`wmi_terminal_services_user_time_seconds_total` | total elapsed time that this process's threads have spent executing code in user mode. Applications, environment subsystems, and integral subsystems execute in user mode. | Counter | `session_name` -`wmi_terminal_services_pool_non_paged_bytes` | Number of bytes in the non-paged pool, an area of system memory (physical memory used by the operating system) for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated. This property displays the last observed value only; it is not an average. | gauge | `session_name` -`wmi_terminal_services_pool_paged_bytes` | Number of bytes in the paged pool, an area of system memory (physical memory used by the operating system) for objects that can be written to disk when they are not being used. This property displays the last observed value only; it is not an average. | gauge | `session_name` -`wmi_terminal_services_private_bytes` | Current number of bytes this process has allocated that cannot be shared with other processes. | gauge | `session_name` -`wmi_terminal_services_thread_count` | Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread. | gauge | `session_name` -`wmi_terminal_services_virtual_bytes` | Current size, in bytes, of the virtual address space the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries. | gauge | `session_name` -`wmi_terminal_services_virtual_bytes_peak` | Maximum number of bytes of virtual address space the process has used at any one time. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process might limit its ability to load libraries. | gauge | `session_name` -`wmi_terminal_services_working_set_bytes` | Current number of bytes in the working set of this process. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `session_name` -`wmi_terminal_services_working_set_bytes_peak` | Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `session_name` - -`* wmi_terminal_services_connection_broker_performance_total` only collected if server has `Remote Desktop Connection Broker` role. - - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# terminal_services collector + +The terminal_services collector exposes terminal services (Remote Desktop Services) performance metrics. + +||| +-|- +Metric name prefix | `terminal_services` +Data source | Perflib/WMI +Classes | [`Win32_PerfRawData_LocalSessionManager_TerminalServices`](https://wutils.com/wmi/root/cimv2/win32_perfrawdata_localsessionmanager_terminalservices/), [`Win32_PerfRawData_TermService_TerminalServicesSession`](https://docs.microsoft.com/en-us/previous-versions/aa394344(v%3Dvs.85)), [`Win32_PerfRawData_RemoteDesktopConnectionBrokerPerformanceCounterProvider_RemoteDesktopConnectionBrokerCounterset`](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/mt729067(v%3Dws.11)) +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_terminal_services_local_session_count` | Number of local Terminal Services sessions. | gauge | `session` +`windows_terminal_services_connection_broker_performance_total`* | The total number of connections handled by the Connection Brokers since the service started. | counter | `connection` +`windows_terminal_services_handle_count` | Total number of handles currently opened by this process. This number is the sum of the handles currently opened by each thread in this process. | gauge | `session_name` +`windows_terminal_services_page_fault_total` | Rate at which page faults occur in the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. The page may not be retrieved from disk if it is on the standby list and therefore already in main memory. The page also may not be retrieved if it is in use by another process which shares the page. | counter | `session_name` +`windows_terminal_services_page_file_bytes` | Current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory. | gauge | `session_name` +`windows_terminal_services_page_file_bytes_peak` | Maximum number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory. | gauge | `session_name` +`windows_terminal_services_privileged_time_seconds_total` | total elapsed time that the threads of the process have spent executing code in privileged mode. | Counter | `session_name` +`windows_terminal_services_processor_time_seconds_total` | total elapsed time that all of the threads of this process used the processor to execute instructions. | Counter | `session_name` +`windows_terminal_services_user_time_seconds_total` | total elapsed time that this process's threads have spent executing code in user mode. Applications, environment subsystems, and integral subsystems execute in user mode. | Counter | `session_name` +`windows_terminal_services_pool_non_paged_bytes` | Number of bytes in the non-paged pool, an area of system memory (physical memory used by the operating system) for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated. This property displays the last observed value only; it is not an average. | gauge | `session_name` +`windows_terminal_services_pool_paged_bytes` | Number of bytes in the paged pool, an area of system memory (physical memory used by the operating system) for objects that can be written to disk when they are not being used. This property displays the last observed value only; it is not an average. | gauge | `session_name` +`windows_terminal_services_private_bytes` | Current number of bytes this process has allocated that cannot be shared with other processes. | gauge | `session_name` +`windows_terminal_services_thread_count` | Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread. | gauge | `session_name` +`windows_terminal_services_virtual_bytes` | Current size, in bytes, of the virtual address space the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries. | gauge | `session_name` +`windows_terminal_services_virtual_bytes_peak` | Maximum number of bytes of virtual address space the process has used at any one time. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process might limit its ability to load libraries. | gauge | `session_name` +`windows_terminal_services_working_set_bytes` | Current number of bytes in the working set of this process. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `session_name` +`windows_terminal_services_working_set_bytes_peak` | Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory. | gauge | `session_name` + +`* windows_terminal_services_connection_broker_performance_total` only collected if server has `Remote Desktop Connection Broker` role. + + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.textfile.md b/docs/collector.textfile.md index fad447f9..6bb02a20 100644 --- a/docs/collector.textfile.md +++ b/docs/collector.textfile.md @@ -1,56 +1,56 @@ -# textfile collector - -The textfile collector exposes metrics from files written by other processes. - -||| --|- -Metric name prefix | `textfile` -Classes | None -Enabled by default? | Yes - -## Flags - -### `--collector.textfile.directory` - -The directory containing the files to be ingested. Only files with the extension `.prom` are read. The `.prom` file must end with an empty line feed to work properly. - -Default value: `C:\Program Files\windows_exporter\textfile_inputs` - -Required: No - -## Metrics - -Metrics will primarily come from the files on disk. The below listed metrics -are collected to give information about the reading of the metrics themselves. - -Name | Description | Type | Labels ------|-------------|------|------- -`windows_textfile_scrape_error` | 1 if there was an error opening or reading a file, 0 otherwise | gauge | None -`windows_textfile_mtime_seconds` | Unix epoch-formatted mtime (modified time) of textfiles successfully read | gauge | file - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ - -# Example use -This Powershell script, when run in the `collector.textfile.directory` (default `C:\Program Files\windows_exporter\textfile_inputs`), generates a valid `.prom` file that should successfully ingested by windows_exporter. - -```Powershell -$alpha = 42 -$beta = @{ left=3.1415; right=2.718281828; } - -Set-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "" -Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "# HELP test_alpha_total Some random metric.`n" -Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "# TYPE test_alpha_total counter`n" -Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "test_alpha_total ${alpha}`n" -Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "# HELP test_beta_bytes Some other metric.`n" -Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "# TYPE test_beta_bytes gauge`n" -foreach ($k in $beta.Keys) { - Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "test_beta_bytes{spin=""${k}""} $( $beta[$k] )`n" -} -``` +# textfile collector + +The textfile collector exposes metrics from files written by other processes. + +||| +-|- +Metric name prefix | `textfile` +Classes | None +Enabled by default? | Yes + +## Flags + +### `--collector.textfile.directory` + +The directory containing the files to be ingested. Only files with the extension `.prom` are read. The `.prom` file must end with an empty line feed to work properly. + +Default value: `C:\Program Files\windows_exporter\textfile_inputs` + +Required: No + +## Metrics + +Metrics will primarily come from the files on disk. The below listed metrics +are collected to give information about the reading of the metrics themselves. + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_textfile_scrape_error` | 1 if there was an error opening or reading a file, 0 otherwise | gauge | None +`windows_textfile_mtime_seconds` | Unix epoch-formatted mtime (modified time) of textfiles successfully read | gauge | file + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ + +# Example use +This Powershell script, when run in the `collector.textfile.directory` (default `C:\Program Files\windows_exporter\textfile_inputs`), generates a valid `.prom` file that should successfully ingested by windows_exporter. + +```Powershell +$alpha = 42 +$beta = @{ left=3.1415; right=2.718281828; } + +Set-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "" +Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "# HELP test_alpha_total Some random metric.`n" +Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "# TYPE test_alpha_total counter`n" +Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "test_alpha_total ${alpha}`n" +Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "# HELP test_beta_bytes Some other metric.`n" +Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "# TYPE test_beta_bytes gauge`n" +foreach ($k in $beta.Keys) { + Add-Content -Path test1.prom -Encoding Ascii -NoNewline -Value "test_beta_bytes{spin=""${k}""} $( $beta[$k] )`n" +} +``` diff --git a/docs/collector.thermalzone.md b/docs/collector.thermalzone.md index 71f36c75..6de0e534 100644 --- a/docs/collector.thermalzone.md +++ b/docs/collector.thermalzone.md @@ -16,9 +16,9 @@ None Name | Description | Type | Labels -----|-------------|------|------- -`wmi_thermalzone_percent_passive_limit` | % Passive Limit is the current limit this thermal zone is placing on the devices it controls. A limit of 100% indicates the devices are unconstrained. A limit of 0% indicates the devices are fully constrained. | gauge | None -`wmi_thermalzone_temperature_celsius ` | Temperature of the thermal zone, in degrees Celsius. | gauge | None -`wmi_thermalzone_throttle_reasons ` | Throttle Reasons indicate reasons why the thermal zone is limiting performance of the devices it controls. 0x0 – The zone is not throttled. 0x1 – The zone is throttled for thermal reasons. 0x2 – The zone is throttled to limit electrical current. | gauge | None +`windows_thermalzone_percent_passive_limit` | % Passive Limit is the current limit this thermal zone is placing on the devices it controls. A limit of 100% indicates the devices are unconstrained. A limit of 0% indicates the devices are fully constrained. | gauge | None +`windows_thermalzone_temperature_celsius ` | Temperature of the thermal zone, in degrees Celsius. | gauge | None +`windows_thermalzone_throttle_reasons ` | Throttle Reasons indicate reasons why the thermal zone is limiting performance of the devices it controls. 0x0 - The zone is not throttled. 0x1 - The zone is throttled for thermal reasons. 0x2 - The zone is throttled to limit electrical current. | gauge | None [`Throttle reasons` source](https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/examples--requirements-and-diagnostics) diff --git a/docs/collector.vmware.md b/docs/collector.vmware.md index fa088664..a6e51d27 100644 --- a/docs/collector.vmware.md +++ b/docs/collector.vmware.md @@ -1,46 +1,46 @@ -# vmware collector - -The vmware collector exposes metrics about a VMware guest VM - -||| --|- -Metric name prefix | `vmware` -Classes | `Win32_PerfRawData_vmGuestLib_VMem`, `Win32_PerfRawData_vmGuestLib_VCPU` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`wmi_vmware_mem_active_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_ballooned_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_limit_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_mapped_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_overhead_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_reservation_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_shared_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_shared_saved_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_shares` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_swapped_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_target_size_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_mem_used_bytes` | _Not yet documented_ | gauge | None -`wmi_vmware_cpu_limit_mhz` | _Not yet documented_ | gauge | None -`wmi_vmware_cpu_reservation_mhz` | _Not yet documented_ | gauge | None -`wmi_vmware_cpu_shares` | _Not yet documented_ | gauge | None -`wmi_vmware_cpu_stolen_seconds_total` | _Not yet documented_ | counter | None -`wmi_vmware_cpu_time_seconds_total` | _Not yet documented_ | counter | None -`wmi_vmware_effective_vm_speed_mhz` | _Not yet documented_ | gauge | None -`wmi_vmware_host_processor_speed_mhz` | _Not yet documented_ | gauge | None - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +# vmware collector + +The vmware collector exposes metrics about a VMware guest VM + +||| +-|- +Metric name prefix | `vmware` +Classes | `Win32_PerfRawData_vmGuestLib_VMem`, `Win32_PerfRawData_vmGuestLib_VCPU` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- +`windows_vmware_mem_active_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_ballooned_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_limit_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_mapped_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_overhead_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_reservation_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_shared_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_shared_saved_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_shares` | _Not yet documented_ | gauge | None +`windows_vmware_mem_swapped_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_target_size_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_mem_used_bytes` | _Not yet documented_ | gauge | None +`windows_vmware_cpu_limit_mhz` | _Not yet documented_ | gauge | None +`windows_vmware_cpu_reservation_mhz` | _Not yet documented_ | gauge | None +`windows_vmware_cpu_shares` | _Not yet documented_ | gauge | None +`windows_vmware_cpu_stolen_seconds_total` | _Not yet documented_ | counter | None +`windows_vmware_cpu_time_seconds_total` | _Not yet documented_ | counter | None +`windows_vmware_effective_vm_speed_mhz` | _Not yet documented_ | gauge | None +`windows_vmware_host_processor_speed_mhz` | _Not yet documented_ | gauge | None + +### Example metric +_This collector does not yet have explained examples, we would appreciate your help adding them!_ + +## Useful queries +_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ + +## Alerting examples +_This collector does not yet have alerting examples, we would appreciate your help adding them!_ From cd8d676443d2e091d4053f05cbb40fd0be5d8a1e Mon Sep 17 00:00:00 2001 From: Ben Reedy Date: Mon, 1 Jun 2020 18:17:25 +1000 Subject: [PATCH 15/41] Fix DHCP helptext --- collector/dhcp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/dhcp.go b/collector/dhcp.go index 3820a07b..0848df0d 100644 --- a/collector/dhcp.go +++ b/collector/dhcp.go @@ -134,7 +134,7 @@ func NewDhcpCollector() (Collector, error) { nil, ), DeniedDueToNonMatch: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, subsystem, "denied_due_to_match_total"), + prometheus.BuildFQName(Namespace, subsystem, "denied_due_to_nonmatch_total"), "Total number of DHCP requests denied, based on non-matches from the Allow list (DeniedDueToNonMatch)", nil, nil, From 44d419e8fa45c40ccc20c4a41ca7b95a1f95c638 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Mon, 1 Jun 2020 11:35:49 +0200 Subject: [PATCH 16/41] Update maintainers * Update filename. * Add Brian Brazil as community steward. Signed-off-by: Ben Kochie --- AUTHORS.md => MAINTAINERS.md | 1 + 1 file changed, 1 insertion(+) rename AUTHORS.md => MAINTAINERS.md (71%) diff --git a/AUTHORS.md b/MAINTAINERS.md similarity index 71% rename from AUTHORS.md rename to MAINTAINERS.md index 9bb420da..bbe14b61 100644 --- a/AUTHORS.md +++ b/MAINTAINERS.md @@ -1,4 +1,5 @@ Contributors in alphabetical order +* [Brian Brazil](https://github.com/brian-brazil) * [Martin Lindhe](https://github.com/martinlindhe) * [Calle Pettersson](https://github.com/carlpett) From a4f815b5fd11d3b68e232b723922be08894c613d Mon Sep 17 00:00:00 2001 From: paologallinaharbur Date: Fri, 22 May 2020 13:46:17 +0200 Subject: [PATCH 17/41] feat (service): added support for service StartName Signed-off-by: paologallinaharbur --- collector/service.go | 10 ++++++++-- docs/collector.service.md | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/collector/service.go b/collector/service.go index d053729f..76d77c85 100644 --- a/collector/service.go +++ b/collector/service.go @@ -45,7 +45,7 @@ func NewserviceCollector() (Collector, error) { Information: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "info"), "A metric with a constant '1' value labeled with service information", - []string{"name", "display_name", "process_id"}, + []string{"name", "display_name", "process_id", "start_name"}, nil, ), State: prometheus.NewDesc( @@ -89,6 +89,7 @@ type Win32_Service struct { State string Status string StartMode string + StartName *string } var ( @@ -131,9 +132,13 @@ func (c *serviceCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des if err := wmi.Query(q, &dst); err != nil { return nil, err } - for _, service := range dst { pid := strconv.FormatUint(uint64(service.ProcessId), 10) + + startName := "" + if service.StartName != nil { + startName = *service.StartName + } ch <- prometheus.MustNewConstMetric( c.Information, prometheus.GaugeValue, @@ -141,6 +146,7 @@ func (c *serviceCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des strings.ToLower(service.Name), service.DisplayName, pid, + startName, ) for _, state := range allStates { diff --git a/docs/collector.service.md b/docs/collector.service.md index 4b501b89..c97df869 100644 --- a/docs/collector.service.md +++ b/docs/collector.service.md @@ -20,12 +20,12 @@ Example: `--collector.service.services-where="Name='windows_exporter'"` Name | Description | Type | Labels -----|-------------|------|------- -`windows_service_info` | Contains service information in labels, constant 1 | gauge | name, display_name, process_id +`windows_service_info` | Contains service information in labels, constant 1 | gauge | name, display_name, process_id, run_as `windows_service_state` | The state of the service, 1 if the current state, 0 otherwise | gauge | name, state `windows_service_start_mode` | The start mode of the service, 1 if the current start mode, 0 otherwise | gauge | name, start_mode `windows_service_status` | The status of the service, 1 if the current status, 0 otherwise | gauge | name, status -For the values of the `state`, `start_mode` and `status` labels, see below. +For the values of the `state`, `start_mode`, `status` and `run_as` labels, see below. ### States @@ -66,6 +66,13 @@ A service can have any of the following statuses: Note that there is some overlap with service state. +### Run As + +Account name under which a service runs. Depending on the service type, the account name may be in the form of "DomainName\Username" or UPN format ("Username@DomainName"). + +It corresponds to the `StartName` attribute of the `Win32_Service` class. +`StartName` attribute can be NULL and in such case the label is reported as an empty string. Notice that if the attribute is NULL the service is logged on as the `LocalSystem` account or, for kernel or system-level drive, it runs with a default object name created by the I/O system based on the service name, for example, DWDOM\Admin. + ### Example metric Lists the services that have a 'disabled' start mode. ``` From dd6bfbe96329fed47bcd79647297f46de9a342ee Mon Sep 17 00:00:00 2001 From: paologallinaharbur Date: Fri, 29 May 2020 11:14:23 +0200 Subject: [PATCH 18/41] fix: changed label name, added documentation Signed-off-by: paologallinaharbur --- collector/service.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/collector/service.go b/collector/service.go index 76d77c85..a5b50c65 100644 --- a/collector/service.go +++ b/collector/service.go @@ -45,7 +45,7 @@ func NewserviceCollector() (Collector, error) { Information: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "info"), "A metric with a constant '1' value labeled with service information", - []string{"name", "display_name", "process_id", "start_name"}, + []string{"name", "display_name", "process_id", "run_as"}, nil, ), State: prometheus.NewDesc( @@ -135,9 +135,9 @@ func (c *serviceCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des for _, service := range dst { pid := strconv.FormatUint(uint64(service.ProcessId), 10) - startName := "" + runAs := "" if service.StartName != nil { - startName = *service.StartName + runAs = *service.StartName } ch <- prometheus.MustNewConstMetric( c.Information, @@ -146,7 +146,7 @@ func (c *serviceCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des strings.ToLower(service.Name), service.DisplayName, pid, - startName, + runAs, ) for _, state := range allStates { From e24f2d2d0623d9a69a13d821f9049bd7a52f46ab Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Mon, 1 Jun 2020 20:11:53 +0200 Subject: [PATCH 19/41] Fix README AppVeyor links Signed-off-by: Calle Pettersson --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c30b6486..2d80409e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # windows_exporter -[![Build status](https://ci.appveyor.com/api/projects/status/ljwan71as6pf2joe/branch/master?svg=true)](https://ci.appveyor.com/project/prometheus-community/windows_exporter) +[![Build status](https://ci.appveyor.com/api/projects/status/tm36s13gba8wx4dp/branch/master?svg=true)](https://ci.appveyor.com/project/prometheus-community/windows-exporter) A Prometheus exporter for Windows machines. From c62fe4477fb5072e569abb44144b77f1c6154016 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Tue, 2 Jun 2020 15:17:56 +0200 Subject: [PATCH 20/41] Update AppVeyor configuration --- README.md | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d80409e..67d75675 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # windows_exporter -[![Build status](https://ci.appveyor.com/api/projects/status/tm36s13gba8wx4dp/branch/master?svg=true)](https://ci.appveyor.com/project/prometheus-community/windows-exporter) +[![Build status](https://ci.appveyor.com/api/projects/status/xoym3fftr7giasiw/branch/master?svg=true)](https://ci.appveyor.com/project/prometheus-community/windows-exporter) A Prometheus exporter for Windows machines. diff --git a/appveyor.yml b/appveyor.yml index 02d6bee5..794bb14c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -71,7 +71,7 @@ deploy: description: windows_exporter version $(appveyor_build_version) artifact: Artifacts auth_token: - secure: 'CrXWeTf7qONUOEki5olFfGEUPMLDeHj61koDXV3OVEaLgtACmnVHsKUub9POflda' + secure: 'hFR7Ymxt/Rb25p4BweFvMNhX03lHD9kXJXrRlC/KbThazHuLD5NTx2ibMI6LYRsr' draft: false prerelease: false on: From 418b5b3ca99cbe7ec01cebb298051ab81eb14421 Mon Sep 17 00:00:00 2001 From: nwies Date: Sun, 7 Jun 2020 17:40:55 +0200 Subject: [PATCH 21/41] Add Collector for Microsoft FileSystem Resource Manager Quotas (#437) Add Collector for Microsoft FileSystem Resource Manager Signed-off-by: nwies --- README.md | 1 + collector/collector.go | 6 ++ collector/fsrmquota.go | 174 ++++++++++++++++++++++++++++++++++++ docs/collector.fsrmquota.md | 52 +++++++++++ 4 files changed, 233 insertions(+) create mode 100644 collector/fsrmquota.go create mode 100644 docs/collector.fsrmquota.md diff --git a/README.md b/README.md index 67d75675..2763559c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Name | Description | Enabled by default [container](docs/collector.container.md) | Container metrics | [dns](docs/collector.dns.md) | DNS Server | [exchange](docs/collector.exchange.md) | Exchange metrics | +[fsrmquota](docs/collector.fsrmquota.md) | Microsoft File Server Resource Manager (FSRM) Quotas collector | [hyperv](docs/collector.hyperv.md) | Hyper-V hosts | [iis](docs/collector.iis.md) | IIS sites and applications | [logical_disk](docs/collector.logical_disk.md) | Logical disks, disk I/O | ✓ diff --git a/collector/collector.go b/collector/collector.go index 41708e3a..f6c1e3a0 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -109,3 +109,9 @@ func PrepareScrapeContext(collectors []string) (*ScrapeContext, error) { return &ScrapeContext{objs}, nil } +func boolToFloat(b bool) float64 { + if b { + return 1.0 + } + return 0.0 +} diff --git a/collector/fsrmquota.go b/collector/fsrmquota.go new file mode 100644 index 00000000..00b8b8d4 --- /dev/null +++ b/collector/fsrmquota.go @@ -0,0 +1,174 @@ +package collector + +import ( + "github.com/StackExchange/wmi" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" +) + +func init() { + registerCollector("fsrmquota",newFSRMQuotaCollector) +} + +// NewSRMQuotaCollector ... +func newFSRMQuotaCollector() (Collector, error) { + const subsystem = "fsrmquota" + return &FSRMQuotaCollector{ + QuotasCount: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "count"), + "Number of Quotas", + nil, + nil, + ), + PeakUsage: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "peak_usage_bytes"), + "The highest amount of disk space usage charged to this quota. (PeakUsage)", + []string{"path", "template"}, + nil, + ), + Size: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "size_bytes"), + "The size of the quota. (Size)", + []string{"path", "template"}, + nil, + ), + Usage: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "usage_bytes"), + "The current amount of disk space usage charged to this quota. (Usage)", + []string{"path", "template"}, + nil, + ), + Description: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "description"), + "Description of the quota (Description)", + []string{"path", "template", "description"}, + nil, + ), + Disabled: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "disabled"), + "If 1, the quota is disabled. The default value is 0. (Disabled)", + []string{"path", "template"}, + nil, + ), + SoftLimit: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "softlimit"), + "If 1, the quota is a soft limit. If 0, the quota is a hard limit. The default value is 0. Optional (SoftLimit)", + []string{"path", "template"}, + nil, + ), + Template: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "template"), + "Quota template name. (Template)", + []string{"path", "template"}, + nil, + ), + MatchesTemplate: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "matchestemplate"), + "If 1, the property values of this quota match those values of the template from which it was derived. (MatchesTemplate)", + []string{"path", "template"}, + nil, + ), + }, nil +} + +// Collect sends the metric values for each metric +// to the provided prometheus Metric channel. +func (c *FSRMQuotaCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { + if desc, err := c.collect(ch); err != nil { + log.Error("failed collecting fsrmquota metrics:", desc, err) + return err + } + return nil +} + +// MSFT_FSRMQuota docs: +// https://docs.microsoft.com/en-us/previous-versions/windows/desktop/fsrm/msft-fsrmquota +type MSFT_FSRMQuota struct { + Name string + + Path string + PeakUsage uint64 + Size uint64 + Usage uint64 + Description string + Template string + //Threshold string + Disabled bool + MatchesTemplate bool + SoftLimit bool +} + +func (c *FSRMQuotaCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + var dst []MSFT_FSRMQuota + q := queryAll(&dst) + + var count int + + if err := wmi.QueryNamespace(q, &dst, "root/microsoft/windows/fsrm"); err != nil { + return nil, err + } + + for _, quota := range dst { + + count++ + path := quota.Path + template := quota.Template + Description := quota.Description + + ch <- prometheus.MustNewConstMetric( + c.PeakUsage, + prometheus.GaugeValue, + float64(quota.PeakUsage), + path, + template, + ) + ch <- prometheus.MustNewConstMetric( + c.Size, + prometheus.GaugeValue, + float64(quota.Size), + path, + template, + ) + ch <- prometheus.MustNewConstMetric( + c.Usage, + prometheus.GaugeValue, + float64(quota.Usage), + path, + template, + ) + ch <- prometheus.MustNewConstMetric( + c.Description, + prometheus.GaugeValue, + 1.0, + path, template, Description, + ) + ch <- prometheus.MustNewConstMetric( + c.Disabled, + prometheus.GaugeValue, + boolToFloat(quota.Disabled), + path, + template, + ) + ch <- prometheus.MustNewConstMetric( + c.MatchesTemplate, + prometheus.GaugeValue, + boolToFloat(quota.MatchesTemplate), + path, + template, + ) + ch <- prometheus.MustNewConstMetric( + c.SoftLimit, + prometheus.GaugeValue, + boolToFloat(quota.SoftLimit), + path, + template, + ) + } + + ch <- prometheus.MustNewConstMetric( + c.QuotasCount, + prometheus.GaugeValue, + float64(count), + ) + return nil, nil +} diff --git a/docs/collector.fsrmquota.md b/docs/collector.fsrmquota.md new file mode 100644 index 00000000..5d6c60e0 --- /dev/null +++ b/docs/collector.fsrmquota.md @@ -0,0 +1,52 @@ +# Microsoft File Server Resource Manager (FSRM) Quotas collector + +The fsrmquota collector exposes metrics about File Server Ressource Manager Quotas. Note that this collector has only been tested against Windows server 2012R2. +Other FSRM versions may work but are not tested. + +||| +-|- +Metric name prefix | `fsrmquota` +Data source | wmi +Counters | `FSRMQUOTA` +Enabled by default? | No + +## Flags + +None + +## Metrics + +Name | Description | Type | Labels +-----|-------------|------|------- + +`windows_fsrmquota_count` | Number of Quotas | counter |None +`windows_fsrmquota_description` | A string up to 1KB in size. Optional. The default value is an empty string. (Description) | counter |`path`, `template`,`description` +`windows_fsrmquota_disabled` | If 1, the quota is disabled. The default value is 0. (Disabled) | counter |`path`, `template` +`windows_fsrmquota_matchestemplate` | If 1, the property values of this quota match those values of the template from which it was derived. (MatchesTemplate) | counter |`path`, `template` +`windows_fsrmquota_peak_usage_bytes ` | The highest amount of disk space usage charged to this quota. (PeakUsage) | counter |`path`, `template` +`windows_fsrmquota_size_bytes` | The size of the quota. If the Template property is not provided then the Size property must be provided (Size) | counter |`path`, `template` +`windows_fsrmquota_softlimit` | If 1, the quota is a soft limit. If 0, the quota is a hard limit. The default value is 0. Optional (SoftLimit) | counter |`path`, `template` +`windows_fsrmquota_template` | A valid quota template name. Up to 1KB in size. Optional (Template) | counter |`path`, `template` +`windows_fsrmquota_usage_bytes` | The current amount of disk space usage charged to this quota. (Usage) | counter |`path`, `template` + + +### Example metric +Show rate of Quotas usage: +``` +rate(windows_fsrmquota_usage_bytes)[1d] +``` + +## Useful queries + +## Alerting examples +**prometheus.rules** +```yaml + - alert: "HighQuotasUsage" + expr: "windows_fsrmquota_usage_bytes{instance="SERVER1.COM:9182"} / windows_fsrmquota_size{instance="SERVER1.COM:9182"} >0.85" + for: "10m" + labels: + severity: "high" + annotations: + summary: "High Quotas Usage" + description: "High use of File Ressource.\n Quotas: {{ $labels.path }}\n Current use : {{ $value }}" +``` From 86dc495aeb7c764b8df471dc70c046d107bdd8c1 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 7 Jun 2020 17:55:52 +0200 Subject: [PATCH 22/41] Revert fsrm struct removal Signed-off-by: Calle Pettersson --- collector/fsrmquota.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/collector/fsrmquota.go b/collector/fsrmquota.go index 00b8b8d4..29edec20 100644 --- a/collector/fsrmquota.go +++ b/collector/fsrmquota.go @@ -7,10 +7,23 @@ import ( ) func init() { - registerCollector("fsrmquota",newFSRMQuotaCollector) + registerCollector("fsrmquota", newFSRMQuotaCollector) +} + +type FSRMQuotaCollector struct { + QuotasCount *prometheus.Desc + Path *prometheus.Desc + PeakUsage *prometheus.Desc + Size *prometheus.Desc + Usage *prometheus.Desc + + Description *prometheus.Desc + Disabled *prometheus.Desc + MatchesTemplate *prometheus.Desc + SoftLimit *prometheus.Desc + Template *prometheus.Desc } -// NewSRMQuotaCollector ... func newFSRMQuotaCollector() (Collector, error) { const subsystem = "fsrmquota" return &FSRMQuotaCollector{ From 3316dc502d46349739b2be5452521ff5d1168f47 Mon Sep 17 00:00:00 2001 From: prombot Date: Tue, 23 Jun 2020 00:12:11 +0000 Subject: [PATCH 23/41] Update common Prometheus files Signed-off-by: prombot --- CODE_OF_CONDUCT.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..9a1aff41 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +## Prometheus Community Code of Conduct + +Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). From f1384759cb04f8a66cd0954e2eff4bca81b2caa4 Mon Sep 17 00:00:00 2001 From: Rasmus Hansen Date: Tue, 23 Jun 2020 12:48:19 +0200 Subject: [PATCH 24/41] Add endpoint for getting the version of the binary (#555) * Add endpoint for getting the version of the binary Fixes #553 Signed-off-by: Zlepper --- exporter.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/exporter.go b/exporter.go index 3b8b6562..9ecdb2da 100644 --- a/exporter.go +++ b/exporter.go @@ -3,6 +3,7 @@ package main import ( + "encoding/json" "fmt" "net/http" _ "net/http/pprof" @@ -28,6 +29,17 @@ type windowsCollector struct { collectors map[string]collector.Collector } +// Same struct prometheus uses for their /version endpoint. +// Separate copy to avoid pulling all of prometheus as a dependency +type prometheusVersion struct { + Version string `json:"version"` + Revision string `json:"revision"` + Branch string `json:"branch"` + BuildUser string `json:"buildUser"` + BuildDate string `json:"buildDate"` + GoVersion string `json:"goVersion"` +} + const ( defaultCollectors = "cpu,cs,logical_disk,net,os,service,system,textfile" defaultCollectorsPlaceholder = "[defaults]" @@ -337,6 +349,21 @@ func main() { http.HandleFunc(*metricsPath, withConcurrencyLimit(*maxRequests, h.ServeHTTP)) http.HandleFunc("/health", healthCheck) + http.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) { + // we can't use "version" directly as it is a package, and not an object that + // can be serialized. + err := json.NewEncoder(w).Encode(prometheusVersion{ + Version: version.Version, + Revision: version.Revision, + Branch: version.Branch, + BuildUser: version.BuildUser, + BuildDate: version.BuildDate, + GoVersion: version.GoVersion, + }) + if err != nil { + http.Error(w, fmt.Sprintf("error encoding JSON: %s", err), http.StatusInternalServerError) + } + }) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte(` windows_exporter From 51f1f884e710bd7c054b62f486cfbce48d969ea1 Mon Sep 17 00:00:00 2001 From: Rasmus Hansen Date: Tue, 23 Jun 2020 12:48:19 +0200 Subject: [PATCH 25/41] Add hyperv queries example Signed-off-by: D'ALMEIDA Jorge <67072186+JDA88@users.noreply.github.com> --- docs/collector.hyperv.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/collector.hyperv.md b/docs/collector.hyperv.md index 135321ee..29258a06 100644 --- a/docs/collector.hyperv.md +++ b/docs/collector.hyperv.md @@ -96,7 +96,18 @@ Name | Description | Type | Labels _This collector does not yet have explained examples, we would appreciate your help adding them!_ ## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ +Percent of physical CPU ressources used per VM (on instance "localhost") +``` +(sum (rate(windows_hyperv_vm_cpu_hypervisor_run_time{instance="localhost"}[1m]))) / ignoring(vm) group_left max (windows_cs_logical_processors{instance="localhost"}) / 100000 +``` +Percent of physical CPU ressources used by all VMs (on all monitored hosts) +``` +(sum by (instance)(rate(windows_hyperv_vm_cpu_total_run_time{}[1m]))) / max by (instance)(windows_cs_logical_processors{}) / 100000 +``` +Percent of physical CPU ressources by the Hosts himself (on all monitored hosts) +``` +(sum by (instance)(rate(windows_hyperv_host_cpu_total_run_time{}[1m]))) / sum by (instance)(windows_cs_logical_processors{}) / 100000 +``` ## Alerting examples _This collector does not yet have alerting examples, we would appreciate your help adding them!_ From 5c7c0aaa69aa31c2f7264e8b07896ec036f02bfd Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 28 Jun 2020 12:19:43 +0200 Subject: [PATCH 26/41] Apply suggestions from code review Signed-off-by: Calle Pettersson --- docs/collector.hyperv.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/collector.hyperv.md b/docs/collector.hyperv.md index 29258a06..919a0070 100644 --- a/docs/collector.hyperv.md +++ b/docs/collector.hyperv.md @@ -96,15 +96,15 @@ Name | Description | Type | Labels _This collector does not yet have explained examples, we would appreciate your help adding them!_ ## Useful queries -Percent of physical CPU ressources used per VM (on instance "localhost") +Percent of physical CPU resources used per VM (on instance "localhost") ``` (sum (rate(windows_hyperv_vm_cpu_hypervisor_run_time{instance="localhost"}[1m]))) / ignoring(vm) group_left max (windows_cs_logical_processors{instance="localhost"}) / 100000 ``` -Percent of physical CPU ressources used by all VMs (on all monitored hosts) +Percent of physical CPU resources used by all VMs (on all monitored hosts) ``` (sum by (instance)(rate(windows_hyperv_vm_cpu_total_run_time{}[1m]))) / max by (instance)(windows_cs_logical_processors{}) / 100000 ``` -Percent of physical CPU ressources by the Hosts himself (on all monitored hosts) +Percent of physical CPU resources by the hosts themselves (on all monitored hosts) ``` (sum by (instance)(rate(windows_hyperv_host_cpu_total_run_time{}[1m]))) / sum by (instance)(windows_cs_logical_processors{}) / 100000 ``` From 391335a91f29b85e1845d342ae5ce1af42ba2103 Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Fri, 3 Jul 2020 20:21:28 +0300 Subject: [PATCH 27/41] added dhcp help link Signed-off-by: Igor Kudrin --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2763559c..5c2f2978 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Name | Description | Enabled by default [cpu](docs/collector.cpu.md) | CPU usage | ✓ [cs](docs/collector.cs.md) | "Computer System" metrics (system properties, num cpus/total memory) | ✓ [container](docs/collector.container.md) | Container metrics | +[dhcp](docs/collector.dhcp.md) | DHCP Server | [dns](docs/collector.dns.md) | DNS Server | [exchange](docs/collector.exchange.md) | Exchange metrics | [fsrmquota](docs/collector.fsrmquota.md) | Microsoft File Server Resource Manager (FSRM) Quotas collector | From 3c90b96cc665f446db58c00ce7d332b03fc3011d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eivind=20Gussi=C3=A5s=20L=C3=B8kseth?= Date: Mon, 6 Jul 2020 00:17:02 +0200 Subject: [PATCH 28/41] Fix usage instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #564 `promu build -v` is the correct command to build **windows_exporter** (no . as argument for local directory) Signed-off-by: Eivind GussiÃ¥s Løkseth --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c2f2978..08e4e658 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ See [open issues](https://github.com/prometheus-community/windows_exporter/issue go get -u github.com/prometheus/promu go get -u github.com/prometheus-community/windows_exporter cd $env:GOPATH/src/github.com/prometheus-community/windows_exporter - promu build -v . + promu build -v .\windows_exporter.exe The prometheus metrics will be exposed on [localhost:9182](http://localhost:9182) From 6bcaee58853ce4700b820058237501e6727530be Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Fri, 10 Jul 2020 13:52:24 +0200 Subject: [PATCH 29/41] Add flags to README --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 08e4e658..17e9399f 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,19 @@ Name | Description | Enabled by default See the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples. +## Flags + +windows_exporter accepts flags to configure certain behaviours. The ones configuring the global behaviour of the exporter are listed below, while collector-specific ones are documented in the respective collector documentation above. + +Flag | Description | Default value +---------|-------------|-------------------- +`--telemetry.addr` | host:port for exporter. | `:9182` +`--telemetry.path` | URL path for surfacing collected metrics. | `/metrics` +`--telemetry.max-requests` | Maximum number of concurrent requests. 0 to disable. | `5` +`--collectors.enabled` | Comma-separated list of collectors to use. Use `[defaults]` as a placeholder for all the collectors enabled by default." | `[defaults]` +`--collectors.print` | If true, print available collectors and exit. | +`--scrape.timeout-margin` | Seconds to subtract from the timeout allowed by the client. Tune to allow for overhead or high loads. | `0.5` + ## Installation The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases). From 24470eb17e84c4ecc2847e5adb39538cabf7f70a Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Mon, 31 Aug 2020 21:45:46 -0700 Subject: [PATCH 30/41] Use perflib to gather metrics in the mssql collector The perflib-based access code replaces WMI and is substantially more efficient and stable, leading to fewer collection timeouts in the mssql collector. Signed-off-by: Michael Allen --- collector/collector.go | 4 + collector/mssql.go | 2713 ++++++++++++++++++++-------------------- 2 files changed, 1367 insertions(+), 1350 deletions(-) diff --git a/collector/collector.go b/collector/collector.go index f6c1e3a0..caed5dc9 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -58,6 +58,10 @@ var ( func registerCollector(name string, builder collectorBuilder, perfCounterNames ...string) { builders[name] = builder + addPerfCounterDependencies(name, perfCounterNames) +} + +func addPerfCounterDependencies(name string, perfCounterNames []string) { perfIndicies := make([]string, 0, len(perfCounterNames)) for _, cn := range perfCounterNames { perfIndicies = append(perfIndicies, MapCounterToIndex(cn)) diff --git a/collector/mssql.go b/collector/mssql.go index ab980d8e..9c15e01d 100644 --- a/collector/mssql.go +++ b/collector/mssql.go @@ -10,7 +10,6 @@ import ( "sync" "time" - "github.com/StackExchange/wmi" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/log" "golang.org/x/sys/windows/registry" @@ -68,26 +67,6 @@ func getMSSQLInstances() mssqlInstancesType { return sqlInstances } -// mssqlBuildWMIInstanceClass - a helper function to build the correct WMI class name -// if default instance, class looks like `Win32_PerfRawData_MSSQLSERVER_SQLServerGeneralStatistics` -// if instance is 'SQLA` class looks like `Win32_PerfRawData_MSSQLSQLA_MSSQLSQLAGeneralStatistics` -func mssqlBuildWMIInstanceClass(suffix string, instance string) string { - instancePart := "MSSQLSERVER_SQLServer" - if instance != "MSSQLSERVER" { - // Instance names can contain some special characters, which are not supported in the WMI class name. - // We strip those out. - cleanedName := strings.Map(func(r rune) rune { - if r == '_' || r == '$' || r == '#' { - return -1 - } - return r - }, instance) - instancePart = fmt.Sprintf("MSSQL%s_MSSQL%s", cleanedName, cleanedName) - } - - return fmt.Sprintf("Win32_PerfRawData_%s%s", instancePart, suffix) -} - type mssqlCollectorsMap map[string]mssqlCollectorFunc func mssqlAvailableClassCollectors() string { @@ -126,6 +105,41 @@ func mssqlExpandEnabledCollectors(enabled string) []string { return result } +// mssqlGetPerfObjectName - Returns the name of the Windows Performance +// Counter object for the given SQL instance and collector. +func mssqlGetPerfObjectName(sqlInstance string, collector string) string { + prefix := "SQLServer:" + if sqlInstance != "MSSQLSERVER" { + prefix = "MSSQL$" + sqlInstance + ":" + } + suffix := "" + switch collector { + case "accessmethods": + suffix = "Access Methods" + case "availreplica": + suffix = "Availability Replica" + case "bufman": + suffix = "Buffer Manager" + case "databases": + suffix = "Databases" + case "dbreplica": + suffix = "Database Replica" + case "genstats": + suffix = "General Statistics" + case "locks": + suffix = "Locks" + case "memmgr": + suffix = "Memory Manager" + case "sqlerrors": + suffix = "SQL Errors" + case "sqlstats": + suffix = "SQL Statistics" + case "transactions": + suffix = "Transactions" + } + return (prefix + suffix) +} + func init() { registerCollector("mssql", NewMSSQLCollector) } @@ -245,6 +259,7 @@ type MSSQLCollector struct { DBReplicaTransactionDelay *prometheus.Desc // Win32_PerfRawData_{instance}_SQLServerDatabases + DatabasesActiveParallelredothreads *prometheus.Desc DatabasesActiveTransactions *prometheus.Desc DatabasesBackupPerRestoreThroughput *prometheus.Desc DatabasesBulkCopyRows *prometheus.Desc @@ -392,6 +407,16 @@ func NewMSSQLCollector() (Collector, error) { const subsystem = "mssql" + enabled := mssqlExpandEnabledCollectors(*mssqlEnabledCollectors) + mssqlInstances := getMSSQLInstances() + perfCounters := make([]string, 0, len(mssqlInstances)*len(enabled)) + for instance := range mssqlInstances { + for _, c := range enabled { + perfCounters = append(perfCounters, mssqlGetPerfObjectName(instance, c)) + } + } + addPerfCounterDependencies(subsystem, perfCounters) + mssqlCollector := MSSQLCollector{ // meta mssqlScrapeDurationDesc: prometheus.NewDesc( @@ -1016,6 +1041,12 @@ func NewMSSQLCollector() (Collector, error) { ), // Win32_PerfRawData_{instance}_SQLServerDatabases + DatabasesActiveParallelredothreads: prometheus.NewDesc( + prometheus.BuildFQName(Namespace, subsystem, "databases_active_parallel_redo_threads"), + "(Databases.ActiveParallelredothreads)", + []string{"instance", "database"}, + nil, + ), DatabasesActiveTransactions: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "databases_active_transactions"), "(Databases.ActiveTransactions)", @@ -1773,7 +1804,7 @@ func NewMSSQLCollector() (Collector, error) { nil, ), - mssqlInstances: getMSSQLInstances(), + mssqlInstances: mssqlInstances, } mssqlCollector.mssqlCollectors = mssqlCollector.getMSSQLCollectors() @@ -1789,13 +1820,13 @@ func NewMSSQLCollector() (Collector, error) { return &mssqlCollector, nil } -type mssqlCollectorFunc func(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) +type mssqlCollectorFunc func(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) -func (c *MSSQLCollector) execute(name string, fn mssqlCollectorFunc, ch chan<- prometheus.Metric, sqlInstance string, wg *sync.WaitGroup) { +func (c *MSSQLCollector) execute(ctx *ScrapeContext, name string, fn mssqlCollectorFunc, ch chan<- prometheus.Metric, sqlInstance string, wg *sync.WaitGroup) { defer wg.Done() begin := time.Now() - _, err := fn(ch, sqlInstance) + _, err := fn(ctx, ch, sqlInstance) duration := time.Since(begin) var success float64 @@ -1832,7 +1863,7 @@ func (c *MSSQLCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric function := c.mssqlCollectors[name] wg.Add(1) - go c.execute(name, function, ch, sqlInstance, &wg) + go c.execute(ctx, name, function, ch, sqlInstance, &wg) } } wg.Wait() @@ -1848,374 +1879,369 @@ func (c *MSSQLCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric // - Win32_PerfRawData_MSSQLSERVER_SQLServerAccessMethods // https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object type win32PerfRawDataSQLServerAccessMethods struct { - AUcleanupbatchesPersec uint64 - AUcleanupsPersec uint64 - ByreferenceLobCreateCount uint64 - ByreferenceLobUseCount uint64 - CountLobReadahead uint64 - CountPullInRow uint64 - CountPushOffRow uint64 - DeferreddroppedAUs uint64 - DeferredDroppedrowsets uint64 - DroppedrowsetcleanupsPersec uint64 - DroppedrowsetsskippedPersec uint64 - ExtentDeallocationsPersec uint64 - ExtentsAllocatedPersec uint64 - FailedAUcleanupbatchesPersec uint64 - Failedleafpagecookie uint64 - Failedtreepagecookie uint64 - ForwardedRecordsPersec uint64 - FreeSpacePageFetchesPersec uint64 - FreeSpaceScansPersec uint64 - FullScansPersec uint64 - IndexSearchesPersec uint64 - InSysXactwaitsPersec uint64 - LobHandleCreateCount uint64 - LobHandleDestroyCount uint64 - LobSSProviderCreateCount uint64 - LobSSProviderDestroyCount uint64 - LobSSProviderTruncationCount uint64 - MixedpageallocationsPersec uint64 - PagecompressionattemptsPersec uint64 - PageDeallocationsPersec uint64 - PagesAllocatedPersec uint64 - PagescompressedPersec uint64 - PageSplitsPersec uint64 - ProbeScansPersec uint64 - RangeScansPersec uint64 - ScanPointRevalidationsPersec uint64 - SkippedGhostedRecordsPersec uint64 - TableLockEscalationsPersec uint64 - Usedleafpagecookie uint64 - Usedtreepagecookie uint64 - WorkfilesCreatedPersec uint64 - WorktablesCreatedPersec uint64 - WorktablesFromCacheRatio uint64 - WorktablesFromCacheRatio_Base uint64 + AUcleanupbatchesPersec float64 `perflib:"AU cleanup batches/sec"` + AUcleanupsPersec float64 `perflib:"AU cleanups/sec"` + ByreferenceLobCreateCount float64 `perflib:"By-reference Lob Create Count"` + ByreferenceLobUseCount float64 `perflib:"By-reference Lob Use Count"` + CountLobReadahead float64 `perflib:"Count Lob Readahead"` + CountPullInRow float64 `perflib:"Count Pull In Row"` + CountPushOffRow float64 `perflib:"Count Push Off Row"` + DeferreddroppedAUs float64 `perflib:"Deferred dropped AUs"` + DeferredDroppedrowsets float64 `perflib:"Deferred Dropped rowsets"` + DroppedrowsetcleanupsPersec float64 `perflib:"Dropped rowset cleanups/sec"` + DroppedrowsetsskippedPersec float64 `perflib:"Dropped rowsets skipped/sec"` + ExtentDeallocationsPersec float64 `perflib:"Extent Deallocations/sec"` + ExtentsAllocatedPersec float64 `perflib:"Extents Allocated/sec"` + FailedAUcleanupbatchesPersec float64 `perflib:"Failed AU cleanup batches/sec"` + Failedleafpagecookie float64 `perflib:"Failed leaf page cookie"` + Failedtreepagecookie float64 `perflib:"Failed tree page cookie"` + ForwardedRecordsPersec float64 `perflib:"Forwarded Records/sec"` + FreeSpacePageFetchesPersec float64 `perflib:"FreeSpace Page Fetches/sec"` + FreeSpaceScansPersec float64 `perflib:"FreeSpace Scans/sec"` + FullScansPersec float64 `perflib:"Full Scans/sec"` + IndexSearchesPersec float64 `perflib:"Index Searches/sec"` + InSysXactwaitsPersec float64 `perflib:"InSysXact waits/sec"` + LobHandleCreateCount float64 `perflib:"LobHandle Create Count"` + LobHandleDestroyCount float64 `perflib:"LobHandle Destroy Count"` + LobSSProviderCreateCount float64 `perflib:"LobSS Provider Create Count"` + LobSSProviderDestroyCount float64 `perflib:"LobSS Provider Destroy Count"` + LobSSProviderTruncationCount float64 `perflib:"LobSS Provider Truncation Count"` + MixedpageallocationsPersec float64 `perflib:"Mixed page allocations/sec"` + PagecompressionattemptsPersec float64 `perflib:"Page compression attempts/sec"` + PageDeallocationsPersec float64 `perflib:"Page Deallocations/sec"` + PagesAllocatedPersec float64 `perflib:"Pages Allocated/sec"` + PagescompressedPersec float64 `perflib:"Pages compressed/sec"` + PageSplitsPersec float64 `perflib:"Page Splits/sec"` + ProbeScansPersec float64 `perflib:"Probe Scans/sec"` + RangeScansPersec float64 `perflib:"Range Scans/sec"` + ScanPointRevalidationsPersec float64 `perflib:"Scan Point Revalidations/sec"` + SkippedGhostedRecordsPersec float64 `perflib:"Skipped Ghosted Records/sec"` + TableLockEscalationsPersec float64 `perflib:"Table Lock Escalations/sec"` + Usedleafpagecookie float64 `perflib:"Used leaf page cookie"` + Usedtreepagecookie float64 `perflib:"Used tree page cookie"` + WorkfilesCreatedPersec float64 `perflib:"Workfiles Created/sec"` + WorktablesCreatedPersec float64 `perflib:"Worktables Created/sec"` + WorktablesFromCacheRatio float64 `perflib:"Worktables From Cache Ratio"` + WorktablesFromCacheRatio_Base float64 `perflib:"Worktables From Cache Base_Base"` } -func (c *MSSQLCollector) collectAccessMethods(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectAccessMethods(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerAccessMethods log.Debugf("mssql_accessmethods collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("AccessMethods", sqlInstance) - q := queryAllForClass(&dst, class) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "accessmethods")], &dst); err != nil { return nil, err } - if len(dst) == 0 { - return nil, errors.New("WMI query returned empty result set") + for _, v := range dst { + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsAUcleanupbatches, + prometheus.CounterValue, + v.AUcleanupbatchesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsAUcleanups, + prometheus.CounterValue, + v.AUcleanupsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsByreferenceLobCreateCount, + prometheus.CounterValue, + v.ByreferenceLobCreateCount, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsByreferenceLobUseCount, + prometheus.CounterValue, + v.ByreferenceLobUseCount, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsCountLobReadahead, + prometheus.CounterValue, + v.CountLobReadahead, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsCountPullInRow, + prometheus.CounterValue, + v.CountPullInRow, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsCountPushOffRow, + prometheus.CounterValue, + v.CountPushOffRow, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsDeferreddroppedAUs, + prometheus.GaugeValue, + v.DeferreddroppedAUs, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsDeferredDroppedrowsets, + prometheus.GaugeValue, + v.DeferredDroppedrowsets, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsDroppedrowsetcleanups, + prometheus.CounterValue, + v.DroppedrowsetcleanupsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsDroppedrowsetsskipped, + prometheus.CounterValue, + v.DroppedrowsetsskippedPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsExtentDeallocations, + prometheus.CounterValue, + v.ExtentDeallocationsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsExtentsAllocated, + prometheus.CounterValue, + v.ExtentsAllocatedPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsFailedAUcleanupbatches, + prometheus.CounterValue, + v.FailedAUcleanupbatchesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsFailedleafpagecookie, + prometheus.CounterValue, + v.Failedleafpagecookie, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsFailedtreepagecookie, + prometheus.CounterValue, + v.Failedtreepagecookie, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsForwardedRecords, + prometheus.CounterValue, + v.ForwardedRecordsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsFreeSpacePageFetches, + prometheus.CounterValue, + v.FreeSpacePageFetchesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsFreeSpaceScans, + prometheus.CounterValue, + v.FreeSpaceScansPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsFullScans, + prometheus.CounterValue, + v.FullScansPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsIndexSearches, + prometheus.CounterValue, + v.IndexSearchesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsInSysXactwaits, + prometheus.CounterValue, + v.InSysXactwaitsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsLobHandleCreateCount, + prometheus.CounterValue, + v.LobHandleCreateCount, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsLobHandleDestroyCount, + prometheus.CounterValue, + v.LobHandleDestroyCount, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsLobSSProviderCreateCount, + prometheus.CounterValue, + v.LobSSProviderCreateCount, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsLobSSProviderDestroyCount, + prometheus.CounterValue, + v.LobSSProviderDestroyCount, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsLobSSProviderTruncationCount, + prometheus.CounterValue, + v.LobSSProviderTruncationCount, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsMixedpageallocations, + prometheus.CounterValue, + v.MixedpageallocationsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsPagecompressionattempts, + prometheus.CounterValue, + v.PagecompressionattemptsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsPageDeallocations, + prometheus.CounterValue, + v.PageDeallocationsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsPagesAllocated, + prometheus.CounterValue, + v.PagesAllocatedPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsPagescompressed, + prometheus.CounterValue, + v.PagescompressedPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsPageSplits, + prometheus.CounterValue, + v.PageSplitsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsProbeScans, + prometheus.CounterValue, + v.ProbeScansPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsRangeScans, + prometheus.CounterValue, + v.RangeScansPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsScanPointRevalidations, + prometheus.CounterValue, + v.ScanPointRevalidationsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsSkippedGhostedRecords, + prometheus.CounterValue, + v.SkippedGhostedRecordsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsTableLockEscalations, + prometheus.CounterValue, + v.TableLockEscalationsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsUsedleafpagecookie, + prometheus.CounterValue, + v.Usedleafpagecookie, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsUsedtreepagecookie, + prometheus.CounterValue, + v.Usedtreepagecookie, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsWorkfilesCreated, + prometheus.CounterValue, + v.WorkfilesCreatedPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsWorktablesCreated, + prometheus.CounterValue, + v.WorktablesCreatedPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsWorktablesFromCacheHits, + prometheus.CounterValue, + v.WorktablesFromCacheRatio, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.AccessMethodsWorktablesFromCacheLookups, + prometheus.CounterValue, + v.WorktablesFromCacheRatio_Base, + sqlInstance, + ) } - - v := dst[0] - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsAUcleanupbatches, - prometheus.CounterValue, - float64(v.AUcleanupbatchesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsAUcleanups, - prometheus.CounterValue, - float64(v.AUcleanupsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsByreferenceLobCreateCount, - prometheus.CounterValue, - float64(v.ByreferenceLobCreateCount), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsByreferenceLobUseCount, - prometheus.CounterValue, - float64(v.ByreferenceLobUseCount), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsCountLobReadahead, - prometheus.CounterValue, - float64(v.CountLobReadahead), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsCountPullInRow, - prometheus.CounterValue, - float64(v.CountPullInRow), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsCountPushOffRow, - prometheus.CounterValue, - float64(v.CountPushOffRow), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsDeferreddroppedAUs, - prometheus.GaugeValue, - float64(v.DeferreddroppedAUs), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsDeferredDroppedrowsets, - prometheus.GaugeValue, - float64(v.DeferredDroppedrowsets), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsDroppedrowsetcleanups, - prometheus.CounterValue, - float64(v.DroppedrowsetcleanupsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsDroppedrowsetsskipped, - prometheus.CounterValue, - float64(v.DroppedrowsetsskippedPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsExtentDeallocations, - prometheus.CounterValue, - float64(v.ExtentDeallocationsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsExtentsAllocated, - prometheus.CounterValue, - float64(v.ExtentsAllocatedPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsFailedAUcleanupbatches, - prometheus.CounterValue, - float64(v.FailedAUcleanupbatchesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsFailedleafpagecookie, - prometheus.CounterValue, - float64(v.Failedleafpagecookie), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsFailedtreepagecookie, - prometheus.CounterValue, - float64(v.Failedtreepagecookie), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsForwardedRecords, - prometheus.CounterValue, - float64(v.ForwardedRecordsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsFreeSpacePageFetches, - prometheus.CounterValue, - float64(v.FreeSpacePageFetchesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsFreeSpaceScans, - prometheus.CounterValue, - float64(v.FreeSpaceScansPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsFullScans, - prometheus.CounterValue, - float64(v.FullScansPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsIndexSearches, - prometheus.CounterValue, - float64(v.IndexSearchesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsInSysXactwaits, - prometheus.CounterValue, - float64(v.InSysXactwaitsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsLobHandleCreateCount, - prometheus.CounterValue, - float64(v.LobHandleCreateCount), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsLobHandleDestroyCount, - prometheus.CounterValue, - float64(v.LobHandleDestroyCount), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsLobSSProviderCreateCount, - prometheus.CounterValue, - float64(v.LobSSProviderCreateCount), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsLobSSProviderDestroyCount, - prometheus.CounterValue, - float64(v.LobSSProviderDestroyCount), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsLobSSProviderTruncationCount, - prometheus.CounterValue, - float64(v.LobSSProviderTruncationCount), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsMixedpageallocations, - prometheus.CounterValue, - float64(v.MixedpageallocationsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsPagecompressionattempts, - prometheus.CounterValue, - float64(v.PagecompressionattemptsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsPageDeallocations, - prometheus.CounterValue, - float64(v.PageDeallocationsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsPagesAllocated, - prometheus.CounterValue, - float64(v.PagesAllocatedPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsPagescompressed, - prometheus.CounterValue, - float64(v.PagescompressedPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsPageSplits, - prometheus.CounterValue, - float64(v.PageSplitsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsProbeScans, - prometheus.CounterValue, - float64(v.ProbeScansPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsRangeScans, - prometheus.CounterValue, - float64(v.RangeScansPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsScanPointRevalidations, - prometheus.CounterValue, - float64(v.ScanPointRevalidationsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsSkippedGhostedRecords, - prometheus.CounterValue, - float64(v.SkippedGhostedRecordsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsTableLockEscalations, - prometheus.CounterValue, - float64(v.TableLockEscalationsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsUsedleafpagecookie, - prometheus.CounterValue, - float64(v.Usedleafpagecookie), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsUsedtreepagecookie, - prometheus.CounterValue, - float64(v.Usedtreepagecookie), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsWorkfilesCreated, - prometheus.CounterValue, - float64(v.WorkfilesCreatedPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsWorktablesCreated, - prometheus.CounterValue, - float64(v.WorktablesCreatedPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsWorktablesFromCacheHits, - prometheus.CounterValue, - float64(v.WorktablesFromCacheRatio), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.AccessMethodsWorktablesFromCacheLookups, - prometheus.CounterValue, - float64(v.WorktablesFromCacheRatio_Base), - sqlInstance, - ) return nil, nil } @@ -2223,90 +2249,91 @@ func (c *MSSQLCollector) collectAccessMethods(ch chan<- prometheus.Metric, sqlIn // https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-availability-replica type win32PerfRawDataSQLServerAvailabilityReplica struct { Name string - BytesReceivedfromReplicaPersec uint64 - BytesSenttoReplicaPersec uint64 - BytesSenttoTransportPersec uint64 - FlowControlPersec uint64 - FlowControlTimemsPersec uint64 - ReceivesfromReplicaPersec uint64 - ResentMessagesPersec uint64 - SendstoReplicaPersec uint64 - SendstoTransportPersec uint64 + BytesReceivedfromReplicaPersec float64 `perflib:"Bytes Received from Replica/sec"` + BytesSenttoReplicaPersec float64 `perflib:"Bytes Sent to Replica/sec"` + BytesSenttoTransportPersec float64 `perflib:"Bytes Sent to Transport/sec"` + FlowControlPersec float64 `perflib:"Flow Control/sec"` + FlowControlTimemsPersec float64 `perflib:"Flow Control Time (ms/sec)"` + ReceivesfromReplicaPersec float64 `perflib:"Receives from Replica/sec"` + ResentMessagesPersec float64 `perflib:"Resent Messages/sec"` + SendstoReplicaPersec float64 `perflib:"Sends to Replica/sec"` + SendstoTransportPersec float64 `perflib:"Sends to Transport/sec"` } -func (c *MSSQLCollector) collectAvailabilityReplica(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectAvailabilityReplica(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerAvailabilityReplica log.Debugf("mssql_availreplica collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("AvailabilityReplica", sqlInstance) - q := queryAllForClassWhere(&dst, class, `Name <> '_Total'`) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "availreplica")], &dst); err != nil { return nil, err } for _, v := range dst { + if strings.ToLower(v.Name) == "_total" { + continue + } replicaName := v.Name ch <- prometheus.MustNewConstMetric( c.AvailReplicaBytesReceivedfromReplica, prometheus.CounterValue, - float64(v.BytesReceivedfromReplicaPersec), + v.BytesReceivedfromReplicaPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.AvailReplicaBytesSenttoReplica, prometheus.CounterValue, - float64(v.BytesSenttoReplicaPersec), + v.BytesSenttoReplicaPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.AvailReplicaBytesSenttoTransport, prometheus.CounterValue, - float64(v.BytesSenttoTransportPersec), + v.BytesSenttoTransportPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.AvailReplicaFlowControl, prometheus.CounterValue, - float64(v.FlowControlPersec), + v.FlowControlPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.AvailReplicaFlowControlTimems, prometheus.CounterValue, - float64(v.FlowControlTimemsPersec)/1000.0, + v.FlowControlTimemsPersec/1000.0, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.AvailReplicaReceivesfromReplica, prometheus.CounterValue, - float64(v.ReceivesfromReplicaPersec), + v.ReceivesfromReplicaPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.AvailReplicaResentMessages, prometheus.CounterValue, - float64(v.ResentMessagesPersec), + v.ResentMessagesPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.AvailReplicaSendstoReplica, prometheus.CounterValue, - float64(v.SendstoReplicaPersec), + v.SendstoReplicaPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.AvailReplicaSendstoTransport, prometheus.CounterValue, - float64(v.SendstoTransportPersec), + v.SendstoTransportPersec, sqlInstance, replicaName, ) } @@ -2316,207 +2343,202 @@ func (c *MSSQLCollector) collectAvailabilityReplica(ch chan<- prometheus.Metric, // Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager docs: // https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object type win32PerfRawDataSQLServerBufferManager struct { - BackgroundwriterpagesPersec uint64 - Buffercachehitratio uint64 - Buffercachehitratio_Base uint64 - CheckpointpagesPersec uint64 - Databasepages uint64 - Extensionallocatedpages uint64 - Extensionfreepages uint64 - Extensioninuseaspercentage uint64 - ExtensionoutstandingIOcounter uint64 - ExtensionpageevictionsPersec uint64 - ExtensionpagereadsPersec uint64 - Extensionpageunreferencedtime uint64 - ExtensionpagewritesPersec uint64 - FreeliststallsPersec uint64 - IntegralControllerSlope uint64 - LazywritesPersec uint64 - Pagelifeexpectancy uint64 - PagelookupsPersec uint64 - PagereadsPersec uint64 - PagewritesPersec uint64 - ReadaheadpagesPersec uint64 - ReadaheadtimePersec uint64 - Targetpages uint64 + BackgroundwriterpagesPersec float64 `perflib:"Background writer pages/sec"` + Buffercachehitratio float64 `perflib:"Buffer cache hit ratio"` + Buffercachehitratio_Base float64 `perflib:"Buffer cache hit ratio base_Base"` + CheckpointpagesPersec float64 `perflib:"Checkpoint pages/sec"` + Databasepages float64 `perflib:"Database pages"` + Extensionallocatedpages float64 `perflib:"Extension allocated pages"` + Extensionfreepages float64 `perflib:"Extension free pages"` + Extensioninuseaspercentage float64 `perflib:"Extension in use as percentage"` + ExtensionoutstandingIOcounter float64 `perflib:"Extension outstanding IO counter"` + ExtensionpageevictionsPersec float64 `perflib:"Extension page evictions/sec"` + ExtensionpagereadsPersec float64 `perflib:"Extension page reads/sec"` + Extensionpageunreferencedtime float64 `perflib:"Extension page unreferenced time"` + ExtensionpagewritesPersec float64 `perflib:"Extension page writes/sec"` + FreeliststallsPersec float64 `perflib:"Free list stalls/sec"` + IntegralControllerSlope float64 `perflib:"Integral Controller Slope"` + LazywritesPersec float64 `perflib:"Lazy writes/sec"` + Pagelifeexpectancy float64 `perflib:"Page life expectancy"` + PagelookupsPersec float64 `perflib:"Page lookups/sec"` + PagereadsPersec float64 `perflib:"Page reads/sec"` + PagewritesPersec float64 `perflib:"Page writes/sec"` + ReadaheadpagesPersec float64 `perflib:"Readahead pages/sec"` + ReadaheadtimePersec float64 `perflib:"Readahead time/sec"` + Targetpages float64 `perflib:"Target pages"` } -func (c *MSSQLCollector) collectBufferManager(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectBufferManager(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerBufferManager log.Debugf("mssql_bufman collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("BufferManager", sqlInstance) - q := queryAllForClass(&dst, class) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "bufman")], &dst); err != nil { return nil, err } - if len(dst) == 0 { - return nil, errors.New("WMI query returned empty result set") + + for _, v := range dst { + ch <- prometheus.MustNewConstMetric( + c.BufManBackgroundwriterpages, + prometheus.CounterValue, + v.BackgroundwriterpagesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManBuffercachehits, + prometheus.GaugeValue, + v.Buffercachehitratio, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManBuffercachelookups, + prometheus.GaugeValue, + v.Buffercachehitratio_Base, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManCheckpointpages, + prometheus.CounterValue, + v.CheckpointpagesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManDatabasepages, + prometheus.GaugeValue, + v.Databasepages, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManExtensionallocatedpages, + prometheus.GaugeValue, + v.Extensionallocatedpages, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManExtensionfreepages, + prometheus.GaugeValue, + v.Extensionfreepages, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManExtensioninuseaspercentage, + prometheus.GaugeValue, + v.Extensioninuseaspercentage, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManExtensionoutstandingIOcounter, + prometheus.GaugeValue, + v.ExtensionoutstandingIOcounter, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManExtensionpageevictions, + prometheus.CounterValue, + v.ExtensionpageevictionsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManExtensionpagereads, + prometheus.CounterValue, + v.ExtensionpagereadsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManExtensionpageunreferencedtime, + prometheus.GaugeValue, + v.Extensionpageunreferencedtime, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManExtensionpagewrites, + prometheus.CounterValue, + v.ExtensionpagewritesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManFreeliststalls, + prometheus.CounterValue, + v.FreeliststallsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManIntegralControllerSlope, + prometheus.GaugeValue, + v.IntegralControllerSlope, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManLazywrites, + prometheus.CounterValue, + v.LazywritesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManPagelifeexpectancy, + prometheus.GaugeValue, + v.Pagelifeexpectancy, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManPagelookups, + prometheus.CounterValue, + v.PagelookupsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManPagereads, + prometheus.CounterValue, + v.PagereadsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManPagewrites, + prometheus.CounterValue, + v.PagewritesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManReadaheadpages, + prometheus.CounterValue, + v.ReadaheadpagesPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManReadaheadtime, + prometheus.CounterValue, + v.ReadaheadtimePersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.BufManTargetpages, + prometheus.GaugeValue, + v.Targetpages, + sqlInstance, + ) } - v := dst[0] - - ch <- prometheus.MustNewConstMetric( - c.BufManBackgroundwriterpages, - prometheus.CounterValue, - float64(v.BackgroundwriterpagesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManBuffercachehits, - prometheus.GaugeValue, - float64(v.Buffercachehitratio), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManBuffercachelookups, - prometheus.GaugeValue, - float64(v.Buffercachehitratio_Base), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManCheckpointpages, - prometheus.CounterValue, - float64(v.CheckpointpagesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManDatabasepages, - prometheus.GaugeValue, - float64(v.Databasepages), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManExtensionallocatedpages, - prometheus.GaugeValue, - float64(v.Extensionallocatedpages), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManExtensionfreepages, - prometheus.GaugeValue, - float64(v.Extensionfreepages), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManExtensioninuseaspercentage, - prometheus.GaugeValue, - float64(v.Extensioninuseaspercentage), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManExtensionoutstandingIOcounter, - prometheus.GaugeValue, - float64(v.ExtensionoutstandingIOcounter), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManExtensionpageevictions, - prometheus.CounterValue, - float64(v.ExtensionpageevictionsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManExtensionpagereads, - prometheus.CounterValue, - float64(v.ExtensionpagereadsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManExtensionpageunreferencedtime, - prometheus.GaugeValue, - float64(v.Extensionpageunreferencedtime), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManExtensionpagewrites, - prometheus.CounterValue, - float64(v.ExtensionpagewritesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManFreeliststalls, - prometheus.CounterValue, - float64(v.FreeliststallsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManIntegralControllerSlope, - prometheus.GaugeValue, - float64(v.IntegralControllerSlope), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManLazywrites, - prometheus.CounterValue, - float64(v.LazywritesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManPagelifeexpectancy, - prometheus.GaugeValue, - float64(v.Pagelifeexpectancy), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManPagelookups, - prometheus.CounterValue, - float64(v.PagelookupsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManPagereads, - prometheus.CounterValue, - float64(v.PagereadsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManPagewrites, - prometheus.CounterValue, - float64(v.PagewritesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManReadaheadpages, - prometheus.CounterValue, - float64(v.ReadaheadpagesPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManReadaheadtime, - prometheus.CounterValue, - float64(v.ReadaheadtimePersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.BufManTargetpages, - prometheus.GaugeValue, - float64(v.Targetpages), - sqlInstance, - ) - return nil, nil } @@ -2524,210 +2546,211 @@ func (c *MSSQLCollector) collectBufferManager(ch chan<- prometheus.Metric, sqlIn // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-database-replica type win32PerfRawDataSQLServerDatabaseReplica struct { Name string - DatabaseFlowControlDelay uint64 - DatabaseFlowControlsPersec uint64 - FileBytesReceivedPersec uint64 - GroupCommitsPerSec uint64 - GroupCommitTime uint64 - LogApplyPendingQueue uint64 - LogApplyReadyQueue uint64 - LogBytesCompressedPersec uint64 - LogBytesDecompressedPersec uint64 - LogBytesReceivedPersec uint64 - LogCompressionCachehitsPersec uint64 - LogCompressionCachemissesPersec uint64 - LogCompressionsPersec uint64 - LogDecompressionsPersec uint64 - Logremainingforundo uint64 - LogSendQueue uint64 - MirroredWriteTransactionsPersec uint64 - RecoveryQueue uint64 - RedoblockedPersec uint64 - RedoBytesRemaining uint64 - RedoneBytesPersec uint64 - RedonesPersec uint64 - TotalLogrequiringundo uint64 - TransactionDelay uint64 + DatabaseFlowControlDelay float64 `perflib:"Database Flow Control Delay"` + DatabaseFlowControlsPersec float64 `perflib:"Database Flow Controls/sec"` + FileBytesReceivedPersec float64 `perflib:"File Bytes Received/sec"` + GroupCommitsPerSec float64 `perflib:"Group Commits/Sec"` + GroupCommitTime float64 `perflib:"Group Commit Time"` + LogApplyPendingQueue float64 `perflib:"Log Apply Pending Queue"` + LogApplyReadyQueue float64 `perflib:"Log Apply Ready Queue"` + LogBytesCompressedPersec float64 `perflib:"Log Bytes Compressed/sec"` + LogBytesDecompressedPersec float64 `perflib:"Log Bytes Decompressed/sec"` + LogBytesReceivedPersec float64 `perflib:"Log Bytes Received/sec"` + LogCompressionCachehitsPersec float64 `perflib:"Log Compression Cache hits/sec"` + LogCompressionCachemissesPersec float64 `perflib:"Log Compression Cache misses/sec"` + LogCompressionsPersec float64 `perflib:"Log Compressions/sec"` + LogDecompressionsPersec float64 `perflib:"Log Decompressions/sec"` + Logremainingforundo float64 `perflib:"Log remaining for undo"` + LogSendQueue float64 `perflib:"Log Send Queue"` + MirroredWriteTransactionsPersec float64 `perflib:"Mirrored Write Transactions/sec"` + RecoveryQueue float64 `perflib:"Recovery Queue"` + RedoblockedPersec float64 `perflib:"Redo blocked/sec"` + RedoBytesRemaining float64 `perflib:"Redo Bytes Remaining"` + RedoneBytesPersec float64 `perflib:"Redone Bytes/sec"` + RedonesPersec float64 `perflib:"Redones/sec"` + TotalLogrequiringundo float64 `perflib:"Total Log requiring undo"` + TransactionDelay float64 `perflib:"Transaction Delay"` } -func (c *MSSQLCollector) collectDatabaseReplica(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectDatabaseReplica(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerDatabaseReplica log.Debugf("mssql_dbreplica collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("DatabaseReplica", sqlInstance) - q := queryAllForClassWhere(&dst, class, `Name <> '_Total'`) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "dbreplica")], &dst); err != nil { return nil, err } for _, v := range dst { + if strings.ToLower(v.Name) == "_total" { + continue + } replicaName := v.Name ch <- prometheus.MustNewConstMetric( c.DBReplicaDatabaseFlowControlDelay, prometheus.GaugeValue, - float64(v.DatabaseFlowControlDelay), + v.DatabaseFlowControlDelay, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaDatabaseFlowControls, prometheus.CounterValue, - float64(v.DatabaseFlowControlsPersec), + v.DatabaseFlowControlsPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaFileBytesReceived, prometheus.CounterValue, - float64(v.FileBytesReceivedPersec), + v.FileBytesReceivedPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaGroupCommits, prometheus.CounterValue, - float64(v.GroupCommitsPerSec), + v.GroupCommitsPerSec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaGroupCommitTime, prometheus.GaugeValue, - float64(v.GroupCommitTime), + v.GroupCommitTime, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogApplyPendingQueue, prometheus.GaugeValue, - float64(v.LogApplyPendingQueue), + v.LogApplyPendingQueue, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogApplyReadyQueue, prometheus.GaugeValue, - float64(v.LogApplyReadyQueue), + v.LogApplyReadyQueue, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogBytesCompressed, prometheus.CounterValue, - float64(v.LogBytesCompressedPersec), + v.LogBytesCompressedPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogBytesDecompressed, prometheus.CounterValue, - float64(v.LogBytesDecompressedPersec), + v.LogBytesDecompressedPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogBytesReceived, prometheus.CounterValue, - float64(v.LogBytesReceivedPersec), + v.LogBytesReceivedPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogCompressionCachehits, prometheus.CounterValue, - float64(v.LogCompressionCachehitsPersec), + v.LogCompressionCachehitsPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogCompressionCachemisses, prometheus.CounterValue, - float64(v.LogCompressionCachemissesPersec), + v.LogCompressionCachemissesPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogCompressions, prometheus.CounterValue, - float64(v.LogCompressionsPersec), + v.LogCompressionsPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogDecompressions, prometheus.CounterValue, - float64(v.LogDecompressionsPersec), + v.LogDecompressionsPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogremainingforundo, prometheus.GaugeValue, - float64(v.Logremainingforundo), + v.Logremainingforundo, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaLogSendQueue, prometheus.GaugeValue, - float64(v.LogSendQueue), + v.LogSendQueue, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaMirroredWriteTransactions, prometheus.CounterValue, - float64(v.MirroredWriteTransactionsPersec), + v.MirroredWriteTransactionsPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaRecoveryQueue, prometheus.GaugeValue, - float64(v.RecoveryQueue), + v.RecoveryQueue, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaRedoblocked, prometheus.CounterValue, - float64(v.RedoblockedPersec), + v.RedoblockedPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaRedoBytesRemaining, prometheus.GaugeValue, - float64(v.RedoBytesRemaining), + v.RedoBytesRemaining, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaRedoneBytes, prometheus.CounterValue, - float64(v.RedoneBytesPersec), + v.RedoneBytesPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaRedones, prometheus.CounterValue, - float64(v.RedonesPersec), + v.RedonesPersec, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaTotalLogrequiringundo, prometheus.GaugeValue, - float64(v.TotalLogrequiringundo), + v.TotalLogrequiringundo, sqlInstance, replicaName, ) ch <- prometheus.MustNewConstMetric( c.DBReplicaTransactionDelay, prometheus.GaugeValue, - float64(v.TransactionDelay)/1000.0, + v.TransactionDelay/1000.0, sqlInstance, replicaName, ) } @@ -2738,394 +2761,403 @@ func (c *MSSQLCollector) collectDatabaseReplica(ch chan<- prometheus.Metric, sql // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object?view=sql-server-2017 type win32PerfRawDataSQLServerDatabases struct { Name string - ActiveTransactions uint64 - BackupPerRestoreThroughputPersec uint64 - BulkCopyRowsPersec uint64 - BulkCopyThroughputPersec uint64 - Committableentries uint64 - DataFilesSizeKB uint64 - DBCCLogicalScanBytesPersec uint64 - GroupCommitTimePersec uint64 - LogBytesFlushedPersec uint64 - LogCacheHitRatio uint64 - LogCacheHitRatio_Base uint64 - LogCacheReadsPersec uint64 - LogFilesSizeKB uint64 - LogFilesUsedSizeKB uint64 - LogFlushesPersec uint64 - LogFlushWaitsPersec uint64 - LogFlushWaitTime uint64 - LogFlushWriteTimems uint64 - LogGrowths uint64 - LogPoolCacheMissesPersec uint64 - LogPoolDiskReadsPersec uint64 - LogPoolHashDeletesPersec uint64 - LogPoolHashInsertsPersec uint64 - LogPoolInvalidHashEntryPersec uint64 - LogPoolLogScanPushesPersec uint64 - LogPoolLogWriterPushesPersec uint64 - LogPoolPushEmptyFreePoolPersec uint64 - LogPoolPushLowMemoryPersec uint64 - LogPoolPushNoFreeBufferPersec uint64 - LogPoolReqBehindTruncPersec uint64 - LogPoolRequestsOldVLFPersec uint64 - LogPoolRequestsPersec uint64 - LogPoolTotalActiveLogSize uint64 - LogPoolTotalSharedPoolSize uint64 - LogShrinks uint64 - LogTruncations uint64 - PercentLogUsed uint64 - ReplPendingXacts uint64 - ReplTransRate uint64 - ShrinkDataMovementBytesPersec uint64 - TrackedtransactionsPersec uint64 - TransactionsPersec uint64 - WriteTransactionsPersec uint64 - XTPControllerDLCLatencyPerFetch uint64 - XTPControllerDLCPeakLatency uint64 - XTPControllerLogProcessedPersec uint64 - XTPMemoryUsedKB uint64 + Activeparallelredothreads float64 `perflib:"Active parallel redo threads"` + ActiveTransactions float64 `perflib:"Active Transactions"` + BackupPerRestoreThroughputPersec float64 `perflib:"Backup/Restore Throughput/sec"` + BulkCopyRowsPersec float64 `perflib:"Bulk Copy Rows/sec"` + BulkCopyThroughputPersec float64 `perflib:"Bulk Copy Throughput/sec"` + Committableentries float64 `perflib:"Commit table entries"` + DataFilesSizeKB float64 `perflib:"Data File(s) Size (KB)"` + DBCCLogicalScanBytesPersec float64 `perflib:"DBCC Logical Scan Bytes/sec"` + GroupCommitTimePersec float64 `perflib:"Group Commit Time/sec"` + LogBytesFlushedPersec float64 `perflib:"Log Bytes Flushed/sec"` + LogCacheHitRatio float64 `perflib:"Log Cache Hit Ratio"` + LogCacheHitRatio_Base float64 `perflib:"Log Cache Hit Ratio Base_Base"` + LogCacheReadsPersec float64 `perflib:"Log Cache Reads/sec"` + LogFilesSizeKB float64 `perflib:"Log File(s) Size (KB)"` + LogFilesUsedSizeKB float64 `perflib:"Log File(s) Used Size (KB)"` + LogFlushesPersec float64 `perflib:"Log Flushes/sec"` + LogFlushWaitsPersec float64 `perflib:"Log Flush Waits/sec"` + LogFlushWaitTime float64 `perflib:"Log Flush Wait Time"` + LogFlushWriteTimems float64 `perflib:"Log Flush Write Time (ms)"` + LogGrowths float64 `perflib:"Log Growths"` + LogPoolCacheMissesPersec float64 `perflib:"Log Pool Cache Misses/sec"` + LogPoolDiskReadsPersec float64 `perflib:"Log Pool Disk Reads/sec"` + LogPoolHashDeletesPersec float64 `perflib:"Log Pool Hash Deletes/sec"` + LogPoolHashInsertsPersec float64 `perflib:"Log Pool Hash Inserts/sec"` + LogPoolInvalidHashEntryPersec float64 `perflib:"Log Pool Invalid Hash Entry/sec"` + LogPoolLogScanPushesPersec float64 `perflib:"Log Pool Log Scan Pushes/sec"` + LogPoolLogWriterPushesPersec float64 `perflib:"Log Pool LogWriter Pushes/sec"` + LogPoolPushEmptyFreePoolPersec float64 `perflib:"Log Pool Push Empty FreePool/sec"` + LogPoolPushLowMemoryPersec float64 `perflib:"Log Pool Push Low Memory/sec"` + LogPoolPushNoFreeBufferPersec float64 `perflib:"Log Pool Push No Free Buffer/sec"` + LogPoolReqBehindTruncPersec float64 `perflib:"Log Pool Req. Behind Trunc/sec"` + LogPoolRequestsOldVLFPersec float64 `perflib:"Log Pool Requests Old VLF/sec"` + LogPoolRequestsPersec float64 `perflib:"Log Pool Requests/sec"` + LogPoolTotalActiveLogSize float64 `perflib:"Log Pool Total Active Log Size"` + LogPoolTotalSharedPoolSize float64 `perflib:"Log Pool Total Shared Pool Size"` + LogShrinks float64 `perflib:"Log Shrinks"` + LogTruncations float64 `perflib:"Log Truncations"` + PercentLogUsed float64 `perflib:"Percent Log Used"` + ReplPendingXacts float64 `perflib:"Repl. Pending Xacts"` + ReplTransRate float64 `perflib:"Repl. Trans. Rate"` + ShrinkDataMovementBytesPersec float64 `perflib:"Shrink Data Movement Bytes/sec"` + TrackedtransactionsPersec float64 `perflib:"Tracked transactions/sec"` + TransactionsPersec float64 `perflib:"Transactions/sec"` + WriteTransactionsPersec float64 `perflib:"Write Transactions/sec"` + XTPControllerDLCLatencyPerFetch float64 `perflib:"XTP Controller DLC Latency/Fetch"` + XTPControllerDLCPeakLatency float64 `perflib:"XTP Controller DLC Peak Latency"` + XTPControllerLogProcessedPersec float64 `perflib:"XTP Controller Log Processed/sec"` + XTPMemoryUsedKB float64 `perflib:"XTP Memory Used (KB)"` } -func (c *MSSQLCollector) collectDatabases(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectDatabases(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerDatabases log.Debugf("mssql_databases collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("Databases", sqlInstance) - q := queryAllForClassWhere(&dst, class, `Name <> '_Total'`) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "databases")], &dst); err != nil { return nil, err } for _, v := range dst { + if strings.ToLower(v.Name) == "_total" { + continue + } dbName := v.Name + ch <- prometheus.MustNewConstMetric( + c.DatabasesActiveParallelredothreads, + prometheus.GaugeValue, + v.Activeparallelredothreads, + sqlInstance, dbName, + ) + ch <- prometheus.MustNewConstMetric( c.DatabasesActiveTransactions, prometheus.GaugeValue, - float64(v.ActiveTransactions), + v.ActiveTransactions, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesBackupPerRestoreThroughput, prometheus.CounterValue, - float64(v.BackupPerRestoreThroughputPersec), + v.BackupPerRestoreThroughputPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesBulkCopyRows, prometheus.CounterValue, - float64(v.BulkCopyRowsPersec), + v.BulkCopyRowsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesBulkCopyThroughput, prometheus.CounterValue, - float64(v.BulkCopyThroughputPersec)*1024, + v.BulkCopyThroughputPersec*1024, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesCommittableentries, prometheus.GaugeValue, - float64(v.Committableentries), + v.Committableentries, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesDataFilesSizeKB, prometheus.GaugeValue, - float64(v.DataFilesSizeKB*1024), + v.DataFilesSizeKB*1024, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesDBCCLogicalScanBytes, prometheus.CounterValue, - float64(v.DBCCLogicalScanBytesPersec), + v.DBCCLogicalScanBytesPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesGroupCommitTime, prometheus.CounterValue, - float64(v.GroupCommitTimePersec)/1000000.0, + v.GroupCommitTimePersec/1000000.0, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogBytesFlushed, prometheus.CounterValue, - float64(v.LogBytesFlushedPersec), + v.LogBytesFlushedPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogCacheHits, prometheus.GaugeValue, - float64(v.LogCacheHitRatio), + v.LogCacheHitRatio, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogCacheLookups, prometheus.GaugeValue, - float64(v.LogCacheHitRatio_Base), + v.LogCacheHitRatio_Base, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogCacheReads, prometheus.CounterValue, - float64(v.LogCacheReadsPersec), + v.LogCacheReadsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogFilesSizeKB, prometheus.GaugeValue, - float64(v.LogFilesSizeKB*1024), + v.LogFilesSizeKB*1024, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogFilesUsedSizeKB, prometheus.GaugeValue, - float64(v.LogFilesUsedSizeKB*1024), + v.LogFilesUsedSizeKB*1024, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogFlushes, prometheus.CounterValue, - float64(v.LogFlushesPersec), + v.LogFlushesPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogFlushWaits, prometheus.CounterValue, - float64(v.LogFlushWaitsPersec), + v.LogFlushWaitsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogFlushWaitTime, prometheus.GaugeValue, - float64(v.LogFlushWaitTime)/1000.0, + v.LogFlushWaitTime/1000.0, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogFlushWriteTimems, prometheus.GaugeValue, - float64(v.LogFlushWriteTimems)/1000.0, + v.LogFlushWriteTimems/1000.0, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogGrowths, prometheus.GaugeValue, - float64(v.LogGrowths), + v.LogGrowths, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolCacheMisses, prometheus.CounterValue, - float64(v.LogPoolCacheMissesPersec), + v.LogPoolCacheMissesPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolDiskReads, prometheus.CounterValue, - float64(v.LogPoolDiskReadsPersec), + v.LogPoolDiskReadsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolHashDeletes, prometheus.CounterValue, - float64(v.LogPoolHashDeletesPersec), + v.LogPoolHashDeletesPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolHashInserts, prometheus.CounterValue, - float64(v.LogPoolHashInsertsPersec), + v.LogPoolHashInsertsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolInvalidHashEntry, prometheus.CounterValue, - float64(v.LogPoolInvalidHashEntryPersec), + v.LogPoolInvalidHashEntryPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolLogScanPushes, prometheus.CounterValue, - float64(v.LogPoolLogScanPushesPersec), + v.LogPoolLogScanPushesPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolLogWriterPushes, prometheus.CounterValue, - float64(v.LogPoolLogWriterPushesPersec), + v.LogPoolLogWriterPushesPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolPushEmptyFreePool, prometheus.CounterValue, - float64(v.LogPoolPushEmptyFreePoolPersec), + v.LogPoolPushEmptyFreePoolPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolPushLowMemory, prometheus.CounterValue, - float64(v.LogPoolPushLowMemoryPersec), + v.LogPoolPushLowMemoryPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolPushNoFreeBuffer, prometheus.CounterValue, - float64(v.LogPoolPushNoFreeBufferPersec), + v.LogPoolPushNoFreeBufferPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolReqBehindTrunc, prometheus.CounterValue, - float64(v.LogPoolReqBehindTruncPersec), + v.LogPoolReqBehindTruncPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolRequestsOldVLF, prometheus.CounterValue, - float64(v.LogPoolRequestsOldVLFPersec), + v.LogPoolRequestsOldVLFPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolRequests, prometheus.CounterValue, - float64(v.LogPoolRequestsPersec), + v.LogPoolRequestsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolTotalActiveLogSize, prometheus.GaugeValue, - float64(v.LogPoolTotalActiveLogSize), + v.LogPoolTotalActiveLogSize, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogPoolTotalSharedPoolSize, prometheus.GaugeValue, - float64(v.LogPoolTotalSharedPoolSize), + v.LogPoolTotalSharedPoolSize, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogShrinks, prometheus.GaugeValue, - float64(v.LogShrinks), + v.LogShrinks, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesLogTruncations, prometheus.GaugeValue, - float64(v.LogTruncations), + v.LogTruncations, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesPercentLogUsed, prometheus.GaugeValue, - float64(v.PercentLogUsed), + v.PercentLogUsed, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesReplPendingXacts, prometheus.GaugeValue, - float64(v.ReplPendingXacts), + v.ReplPendingXacts, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesReplTransRate, prometheus.CounterValue, - float64(v.ReplTransRate), + v.ReplTransRate, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesShrinkDataMovementBytes, prometheus.CounterValue, - float64(v.ShrinkDataMovementBytesPersec), + v.ShrinkDataMovementBytesPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesTrackedtransactions, prometheus.CounterValue, - float64(v.TrackedtransactionsPersec), + v.TrackedtransactionsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesTransactions, prometheus.CounterValue, - float64(v.TransactionsPersec), + v.TransactionsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesWriteTransactions, prometheus.CounterValue, - float64(v.WriteTransactionsPersec), + v.WriteTransactionsPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesXTPControllerDLCLatencyPerFetch, prometheus.GaugeValue, - float64(v.XTPControllerDLCLatencyPerFetch), + v.XTPControllerDLCLatencyPerFetch, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesXTPControllerDLCPeakLatency, prometheus.GaugeValue, - float64(v.XTPControllerDLCPeakLatency)*1000000.0, + v.XTPControllerDLCPeakLatency*1000000.0, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesXTPControllerLogProcessed, prometheus.CounterValue, - float64(v.XTPControllerLogProcessedPersec), + v.XTPControllerLogProcessedPersec, sqlInstance, dbName, ) ch <- prometheus.MustNewConstMetric( c.DatabasesXTPMemoryUsedKB, prometheus.GaugeValue, - float64(v.XTPMemoryUsedKB*1024), + v.XTPMemoryUsedKB*1024, sqlInstance, dbName, ) } @@ -3135,214 +3167,210 @@ func (c *MSSQLCollector) collectDatabases(ch chan<- prometheus.Metric, sqlInstan // Win32_PerfRawData_MSSQLSERVER_SQLServerGeneralStatistics docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-general-statistics-object type win32PerfRawDataSQLServerGeneralStatistics struct { - ActiveTempTables uint64 - ConnectionResetPersec uint64 - EventNotificationsDelayedDrop uint64 - HTTPAuthenticatedRequests uint64 - LogicalConnections uint64 - LoginsPersec uint64 - LogoutsPersec uint64 - MarsDeadlocks uint64 - Nonatomicyieldrate uint64 - Processesblocked uint64 - SOAPEmptyRequests uint64 - SOAPMethodInvocations uint64 - SOAPSessionInitiateRequests uint64 - SOAPSessionTerminateRequests uint64 - SOAPSQLRequests uint64 - SOAPWSDLRequests uint64 - SQLTraceIOProviderLockWaits uint64 - Tempdbrecoveryunitid uint64 - Tempdbrowsetid uint64 - TempTablesCreationRate uint64 - TempTablesForDestruction uint64 - TraceEventNotificationQueue uint64 - Transactions uint64 - UserConnections uint64 + ActiveTempTables float64 `perflib:"Active Temp Tables"` + ConnectionResetPersec float64 `perblib:"Connection Reset/sec"` + EventNotificationsDelayedDrop float64 `perflib:"Event Notifications Delayed Drop"` + HTTPAuthenticatedRequests float64 `perflib:"HTTP Authenticated Requests"` + LogicalConnections float64 `perflib:"Logical Connections"` + LoginsPersec float64 `perflib:"Logins/sec"` + LogoutsPersec float64 `perflib:"Logouts/sec"` + MarsDeadlocks float64 `perflib:"Mars Deadlocks"` + Nonatomicyieldrate float64 `perflib:"Non-atomic yield rate"` + Processesblocked float64 `perflib:"Processes blocked"` + SOAPEmptyRequests float64 `perflib:"SOAP Empty Requests"` + SOAPMethodInvocations float64 `perflib:"SOAP Method Invocations"` + SOAPSessionInitiateRequests float64 `perflib:"SOAP Session Initiate Requests"` + SOAPSessionTerminateRequests float64 `perflib:"SOAP Session Terminate Requests"` + SOAPSQLRequests float64 `perflib:"SOAP SQL Requests"` + SOAPWSDLRequests float64 `perflib:"SOAP WSDL Requests"` + SQLTraceIOProviderLockWaits float64 `perflib:"SQL Trace IO Provider Lock Waits"` + Tempdbrecoveryunitid float64 `perflib:"Tempdb recovery unit id"` + Tempdbrowsetid float64 `perflib:"Tempdb rowset id"` + TempTablesCreationRate float64 `perflib:"Temp Tables Creation Rate"` + TempTablesForDestruction float64 `perflib:"Temp Tables For Destruction"` + TraceEventNotificationQueue float64 `perflib:"Trace Event Notification Queue"` + Transactions float64 `perflib:"Transactions"` + UserConnections float64 `perflib:"User Connections"` } -func (c *MSSQLCollector) collectGeneralStatistics(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectGeneralStatistics(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerGeneralStatistics log.Debugf("mssql_genstats collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("GeneralStatistics", sqlInstance) - q := queryAllForClass(&dst, class) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "genstats")], &dst); err != nil { return nil, err } - if len(dst) == 0 { - return nil, errors.New("WMI query returned empty result set") + + for _, v := range dst { + ch <- prometheus.MustNewConstMetric( + c.GenStatsActiveTempTables, + prometheus.GaugeValue, + v.ActiveTempTables, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsConnectionReset, + prometheus.CounterValue, + v.ConnectionResetPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsEventNotificationsDelayedDrop, + prometheus.GaugeValue, + v.EventNotificationsDelayedDrop, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsHTTPAuthenticatedRequests, + prometheus.GaugeValue, + v.HTTPAuthenticatedRequests, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsLogicalConnections, + prometheus.GaugeValue, + v.LogicalConnections, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsLogins, + prometheus.CounterValue, + v.LoginsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsLogouts, + prometheus.CounterValue, + v.LogoutsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsMarsDeadlocks, + prometheus.GaugeValue, + v.MarsDeadlocks, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsNonatomicyieldrate, + prometheus.CounterValue, + v.Nonatomicyieldrate, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsProcessesblocked, + prometheus.GaugeValue, + v.Processesblocked, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsSOAPEmptyRequests, + prometheus.GaugeValue, + v.SOAPEmptyRequests, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsSOAPMethodInvocations, + prometheus.GaugeValue, + v.SOAPMethodInvocations, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsSOAPSessionInitiateRequests, + prometheus.GaugeValue, + v.SOAPSessionInitiateRequests, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsSOAPSessionTerminateRequests, + prometheus.GaugeValue, + v.SOAPSessionTerminateRequests, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsSOAPSQLRequests, + prometheus.GaugeValue, + v.SOAPSQLRequests, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsSOAPWSDLRequests, + prometheus.GaugeValue, + v.SOAPWSDLRequests, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsSQLTraceIOProviderLockWaits, + prometheus.GaugeValue, + v.SQLTraceIOProviderLockWaits, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsTempdbrecoveryunitid, + prometheus.GaugeValue, + v.Tempdbrecoveryunitid, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsTempdbrowsetid, + prometheus.GaugeValue, + v.Tempdbrowsetid, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsTempTablesCreationRate, + prometheus.CounterValue, + v.TempTablesCreationRate, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsTempTablesForDestruction, + prometheus.GaugeValue, + v.TempTablesForDestruction, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsTraceEventNotificationQueue, + prometheus.GaugeValue, + v.TraceEventNotificationQueue, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsTransactions, + prometheus.GaugeValue, + v.Transactions, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.GenStatsUserConnections, + prometheus.GaugeValue, + v.UserConnections, + sqlInstance, + ) } - v := dst[0] - ch <- prometheus.MustNewConstMetric( - c.GenStatsActiveTempTables, - prometheus.GaugeValue, - float64(v.ActiveTempTables), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsConnectionReset, - prometheus.CounterValue, - float64(v.ConnectionResetPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsEventNotificationsDelayedDrop, - prometheus.GaugeValue, - float64(v.EventNotificationsDelayedDrop), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsHTTPAuthenticatedRequests, - prometheus.GaugeValue, - float64(v.HTTPAuthenticatedRequests), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsLogicalConnections, - prometheus.GaugeValue, - float64(v.LogicalConnections), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsLogins, - prometheus.CounterValue, - float64(v.LoginsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsLogouts, - prometheus.CounterValue, - float64(v.LogoutsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsMarsDeadlocks, - prometheus.GaugeValue, - float64(v.MarsDeadlocks), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsNonatomicyieldrate, - prometheus.CounterValue, - float64(v.Nonatomicyieldrate), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsProcessesblocked, - prometheus.GaugeValue, - float64(v.Processesblocked), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsSOAPEmptyRequests, - prometheus.GaugeValue, - float64(v.SOAPEmptyRequests), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsSOAPMethodInvocations, - prometheus.GaugeValue, - float64(v.SOAPMethodInvocations), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsSOAPSessionInitiateRequests, - prometheus.GaugeValue, - float64(v.SOAPSessionInitiateRequests), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsSOAPSessionTerminateRequests, - prometheus.GaugeValue, - float64(v.SOAPSessionTerminateRequests), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsSOAPSQLRequests, - prometheus.GaugeValue, - float64(v.SOAPSQLRequests), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsSOAPWSDLRequests, - prometheus.GaugeValue, - float64(v.SOAPWSDLRequests), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsSQLTraceIOProviderLockWaits, - prometheus.GaugeValue, - float64(v.SQLTraceIOProviderLockWaits), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsTempdbrecoveryunitid, - prometheus.GaugeValue, - float64(v.Tempdbrecoveryunitid), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsTempdbrowsetid, - prometheus.GaugeValue, - float64(v.Tempdbrowsetid), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsTempTablesCreationRate, - prometheus.CounterValue, - float64(v.TempTablesCreationRate), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsTempTablesForDestruction, - prometheus.GaugeValue, - float64(v.TempTablesForDestruction), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsTraceEventNotificationQueue, - prometheus.GaugeValue, - float64(v.TraceEventNotificationQueue), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsTransactions, - prometheus.GaugeValue, - float64(v.Transactions), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.GenStatsUserConnections, - prometheus.GaugeValue, - float64(v.UserConnections), - sqlInstance, - ) - return nil, nil } @@ -3350,82 +3378,83 @@ func (c *MSSQLCollector) collectGeneralStatistics(ch chan<- prometheus.Metric, s // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-locks-object type win32PerfRawDataSQLServerLocks struct { Name string - AverageWaitTimems uint64 - AverageWaitTimems_Base uint64 - LockRequestsPersec uint64 - LockTimeoutsPersec uint64 - LockTimeoutstimeout0Persec uint64 - LockWaitsPersec uint64 - LockWaitTimems uint64 - NumberofDeadlocksPersec uint64 + AverageWaitTimems float64 `perflib:"Average Wait Time (ms)"` + AverageWaitTimems_Base float64 `perflib:"Average Wait Time Base_Base"` + LockRequestsPersec float64 `perflib:"Lock Requests/sec"` + LockTimeoutsPersec float64 `perflib:"Lock Timeouts/sec"` + LockTimeoutstimeout0Persec float64 `perflib:"Lock Timeouts (timeout > 0)/sec"` + LockWaitsPersec float64 `perflib:"Lock Waits/sec"` + LockWaitTimems float64 `perflib:"Lock Wait Time (ms)"` + NumberofDeadlocksPersec float64 `perflib:"Number of Deadlocks/sec"` } -func (c *MSSQLCollector) collectLocks(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectLocks(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerLocks log.Debugf("mssql_locks collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("Locks", sqlInstance) - q := queryAllForClassWhere(&dst, class, `Name <> '_Total'`) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "locks")], &dst); err != nil { return nil, err } for _, v := range dst { + if strings.ToLower(v.Name) == "_total" { + continue + } lockResourceName := v.Name ch <- prometheus.MustNewConstMetric( c.LocksWaitTime, prometheus.GaugeValue, - float64(v.AverageWaitTimems)/1000.0, + v.AverageWaitTimems/1000.0, sqlInstance, lockResourceName, ) ch <- prometheus.MustNewConstMetric( c.LocksCount, prometheus.GaugeValue, - float64(v.AverageWaitTimems_Base)/1000.0, + v.AverageWaitTimems_Base/1000.0, sqlInstance, lockResourceName, ) ch <- prometheus.MustNewConstMetric( c.LocksLockRequests, prometheus.CounterValue, - float64(v.LockRequestsPersec), + v.LockRequestsPersec, sqlInstance, lockResourceName, ) ch <- prometheus.MustNewConstMetric( c.LocksLockTimeouts, prometheus.CounterValue, - float64(v.LockTimeoutsPersec), + v.LockTimeoutsPersec, sqlInstance, lockResourceName, ) ch <- prometheus.MustNewConstMetric( c.LocksLockTimeoutstimeout0, prometheus.CounterValue, - float64(v.LockTimeoutstimeout0Persec), + v.LockTimeoutstimeout0Persec, sqlInstance, lockResourceName, ) ch <- prometheus.MustNewConstMetric( c.LocksLockWaits, prometheus.CounterValue, - float64(v.LockWaitsPersec), + v.LockWaitsPersec, sqlInstance, lockResourceName, ) ch <- prometheus.MustNewConstMetric( c.LocksLockWaitTimems, prometheus.GaugeValue, - float64(v.LockWaitTimems)/1000.0, + v.LockWaitTimems/1000.0, sqlInstance, lockResourceName, ) ch <- prometheus.MustNewConstMetric( c.LocksNumberofDeadlocks, prometheus.CounterValue, - float64(v.NumberofDeadlocksPersec), + v.NumberofDeadlocksPersec, sqlInstance, lockResourceName, ) } @@ -3435,322 +3464,312 @@ func (c *MSSQLCollector) collectLocks(ch chan<- prometheus.Metric, sqlInstance s // Win32_PerfRawData_MSSQLSERVER_SQLServerMemoryManager docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-memory-manager-object type win32PerfRawDataSQLServerMemoryManager struct { - ConnectionMemoryKB uint64 - DatabaseCacheMemoryKB uint64 - Externalbenefitofmemory uint64 - FreeMemoryKB uint64 - GrantedWorkspaceMemoryKB uint64 - LockBlocks uint64 - LockBlocksAllocated uint64 - LockMemoryKB uint64 - LockOwnerBlocks uint64 - LockOwnerBlocksAllocated uint64 - LogPoolMemoryKB uint64 - MaximumWorkspaceMemoryKB uint64 - MemoryGrantsOutstanding uint64 - MemoryGrantsPending uint64 - OptimizerMemoryKB uint64 - ReservedServerMemoryKB uint64 - SQLCacheMemoryKB uint64 - StolenServerMemoryKB uint64 - TargetServerMemoryKB uint64 - TotalServerMemoryKB uint64 + ConnectionMemoryKB float64 `perflib:"Connection Memory (KB)"` + DatabaseCacheMemoryKB float64 `perflib:"Database Cache Memory (KB)"` + Externalbenefitofmemory float64 `perflib:"External benefit of memory"` + FreeMemoryKB float64 `perflib:"Free Memory (KB)"` + GrantedWorkspaceMemoryKB float64 `perflib:"Granted Workspace Memory (KB)"` + LockBlocks float64 `perflib:"Lock Blocks"` + LockBlocksAllocated float64 `perflib:"Lock Blocks Allocated"` + LockMemoryKB float64 `perflib:"Lock Memory (KB)"` + LockOwnerBlocks float64 `perflib:"Lock Owner Blocks"` + LockOwnerBlocksAllocated float64 `perflib:"Lock Owner Blocks Allocated"` + LogPoolMemoryKB float64 `perflib:"Log Pool Memory (KB)"` + MaximumWorkspaceMemoryKB float64 `perflib:"Maximum Workspace Memory (KB)"` + MemoryGrantsOutstanding float64 `perflib:"Memory Grants Outstanding"` + MemoryGrantsPending float64 `perflib:"Memory Grants Pending"` + OptimizerMemoryKB float64 `perflib:"Optimizer Memory (KB)"` + ReservedServerMemoryKB float64 `perflib:"Reserved Server Memory (KB)"` + SQLCacheMemoryKB float64 `perflib:"SQL Cache Memory (KB)"` + StolenServerMemoryKB float64 `perflib:"Stolen Server Memory (KB)"` + TargetServerMemoryKB float64 `perflib:"Target Server Memory (KB)"` + TotalServerMemoryKB float64 `perflib:"Total Server Memory (KB)"` } -func (c *MSSQLCollector) collectMemoryManager(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectMemoryManager(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerMemoryManager log.Debugf("mssql_memmgr collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("MemoryManager", sqlInstance) - q := queryAllForClass(&dst, class) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "memmgr")], &dst); err != nil { return nil, err } - if len(dst) == 0 { - return nil, errors.New("WMI query returned empty result set") + + for _, v := range dst { + ch <- prometheus.MustNewConstMetric( + c.MemMgrConnectionMemoryKB, + prometheus.GaugeValue, + v.ConnectionMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrDatabaseCacheMemoryKB, + prometheus.GaugeValue, + v.DatabaseCacheMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrExternalbenefitofmemory, + prometheus.GaugeValue, + v.Externalbenefitofmemory, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrFreeMemoryKB, + prometheus.GaugeValue, + v.FreeMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrGrantedWorkspaceMemoryKB, + prometheus.GaugeValue, + v.GrantedWorkspaceMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrLockBlocks, + prometheus.GaugeValue, + v.LockBlocks, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrLockBlocksAllocated, + prometheus.GaugeValue, + v.LockBlocksAllocated, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrLockMemoryKB, + prometheus.GaugeValue, + v.LockMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrLockOwnerBlocks, + prometheus.GaugeValue, + v.LockOwnerBlocks, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrLockOwnerBlocksAllocated, + prometheus.GaugeValue, + v.LockOwnerBlocksAllocated, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrLogPoolMemoryKB, + prometheus.GaugeValue, + v.LogPoolMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrMaximumWorkspaceMemoryKB, + prometheus.GaugeValue, + v.MaximumWorkspaceMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrMemoryGrantsOutstanding, + prometheus.GaugeValue, + v.MemoryGrantsOutstanding, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrMemoryGrantsPending, + prometheus.GaugeValue, + v.MemoryGrantsPending, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrOptimizerMemoryKB, + prometheus.GaugeValue, + v.OptimizerMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrReservedServerMemoryKB, + prometheus.GaugeValue, + v.ReservedServerMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrSQLCacheMemoryKB, + prometheus.GaugeValue, + v.SQLCacheMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrStolenServerMemoryKB, + prometheus.GaugeValue, + v.StolenServerMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrTargetServerMemoryKB, + prometheus.GaugeValue, + v.TargetServerMemoryKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.MemMgrTotalServerMemoryKB, + prometheus.GaugeValue, + v.TotalServerMemoryKB*1024, + sqlInstance, + ) } - v := dst[0] - - ch <- prometheus.MustNewConstMetric( - c.MemMgrConnectionMemoryKB, - prometheus.GaugeValue, - float64(v.ConnectionMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrDatabaseCacheMemoryKB, - prometheus.GaugeValue, - float64(v.DatabaseCacheMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrExternalbenefitofmemory, - prometheus.GaugeValue, - float64(v.Externalbenefitofmemory), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrFreeMemoryKB, - prometheus.GaugeValue, - float64(v.FreeMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrGrantedWorkspaceMemoryKB, - prometheus.GaugeValue, - float64(v.GrantedWorkspaceMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrLockBlocks, - prometheus.GaugeValue, - float64(v.LockBlocks), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrLockBlocksAllocated, - prometheus.GaugeValue, - float64(v.LockBlocksAllocated), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrLockMemoryKB, - prometheus.GaugeValue, - float64(v.LockMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrLockOwnerBlocks, - prometheus.GaugeValue, - float64(v.LockOwnerBlocks), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrLockOwnerBlocksAllocated, - prometheus.GaugeValue, - float64(v.LockOwnerBlocksAllocated), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrLogPoolMemoryKB, - prometheus.GaugeValue, - float64(v.LogPoolMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrMaximumWorkspaceMemoryKB, - prometheus.GaugeValue, - float64(v.MaximumWorkspaceMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrMemoryGrantsOutstanding, - prometheus.GaugeValue, - float64(v.MemoryGrantsOutstanding), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrMemoryGrantsPending, - prometheus.GaugeValue, - float64(v.MemoryGrantsPending), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrOptimizerMemoryKB, - prometheus.GaugeValue, - float64(v.OptimizerMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrReservedServerMemoryKB, - prometheus.GaugeValue, - float64(v.ReservedServerMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrSQLCacheMemoryKB, - prometheus.GaugeValue, - float64(v.SQLCacheMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrStolenServerMemoryKB, - prometheus.GaugeValue, - float64(v.StolenServerMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrTargetServerMemoryKB, - prometheus.GaugeValue, - float64(v.TargetServerMemoryKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.MemMgrTotalServerMemoryKB, - prometheus.GaugeValue, - float64(v.TotalServerMemoryKB*1024), - sqlInstance, - ) - return nil, nil } // Win32_PerfRawData_MSSQLSERVER_SQLServerSQLStatistics docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-sql-statistics-object type win32PerfRawDataSQLServerSQLStatistics struct { - AutoParamAttemptsPersec uint64 - BatchRequestsPersec uint64 - FailedAutoParamsPersec uint64 - ForcedParameterizationsPersec uint64 - GuidedplanexecutionsPersec uint64 - MisguidedplanexecutionsPersec uint64 - SafeAutoParamsPersec uint64 - SQLAttentionrate uint64 - SQLCompilationsPersec uint64 - SQLReCompilationsPersec uint64 - UnsafeAutoParamsPersec uint64 + AutoParamAttemptsPersec float64 `perflib:"Auto-Param Attempts/sec"` + BatchRequestsPersec float64 `perflib:"Batch Requests/sec"` + FailedAutoParamsPersec float64 `perflib:"Failed Auto-Params/sec"` + ForcedParameterizationsPersec float64 `perflib:"Forced Parameterizations/sec"` + GuidedplanexecutionsPersec float64 `perflib:"Guided plan executions/sec"` + MisguidedplanexecutionsPersec float64 `perflib:"Misguided plan executions/sec"` + SafeAutoParamsPersec float64 `perflib:"Safe Auto-Params/sec"` + SQLAttentionrate float64 `perflib:"SQL Attention rate"` + SQLCompilationsPersec float64 `perflib:"SQL Compilations/sec"` + SQLReCompilationsPersec float64 `perflib:"SQL Re-Compilations/sec"` + UnsafeAutoParamsPersec float64 `perflib:"Unsafe Auto-Params/sec"` } -func (c *MSSQLCollector) collectSQLStats(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectSQLStats(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerSQLStatistics log.Debugf("mssql_sqlstats collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("SQLStatistics", sqlInstance) - q := queryAllForClass(&dst, class) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "sqlstats")], &dst); err != nil { return nil, err } - if len(dst) == 0 { - return nil, errors.New("WMI query returned empty result set") + for _, v := range dst { + ch <- prometheus.MustNewConstMetric( + c.SQLStatsAutoParamAttempts, + prometheus.CounterValue, + v.AutoParamAttemptsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsBatchRequests, + prometheus.CounterValue, + v.BatchRequestsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsFailedAutoParams, + prometheus.CounterValue, + v.FailedAutoParamsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsForcedParameterizations, + prometheus.CounterValue, + v.ForcedParameterizationsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsGuidedplanexecutions, + prometheus.CounterValue, + v.GuidedplanexecutionsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsMisguidedplanexecutions, + prometheus.CounterValue, + v.MisguidedplanexecutionsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsSafeAutoParams, + prometheus.CounterValue, + v.SafeAutoParamsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsSQLAttentionrate, + prometheus.CounterValue, + v.SQLAttentionrate, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsSQLCompilations, + prometheus.CounterValue, + v.SQLCompilationsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsSQLReCompilations, + prometheus.CounterValue, + v.SQLReCompilationsPersec, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.SQLStatsUnsafeAutoParams, + prometheus.CounterValue, + v.UnsafeAutoParamsPersec, + sqlInstance, + ) } - v := dst[0] - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsAutoParamAttempts, - prometheus.CounterValue, - float64(v.AutoParamAttemptsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsBatchRequests, - prometheus.CounterValue, - float64(v.BatchRequestsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsFailedAutoParams, - prometheus.CounterValue, - float64(v.FailedAutoParamsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsForcedParameterizations, - prometheus.CounterValue, - float64(v.ForcedParameterizationsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsGuidedplanexecutions, - prometheus.CounterValue, - float64(v.GuidedplanexecutionsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsMisguidedplanexecutions, - prometheus.CounterValue, - float64(v.MisguidedplanexecutionsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsSafeAutoParams, - prometheus.CounterValue, - float64(v.SafeAutoParamsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsSQLAttentionrate, - prometheus.CounterValue, - float64(v.SQLAttentionrate), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsSQLCompilations, - prometheus.CounterValue, - float64(v.SQLCompilationsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsSQLReCompilations, - prometheus.CounterValue, - float64(v.SQLReCompilationsPersec), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.SQLStatsUnsafeAutoParams, - prometheus.CounterValue, - float64(v.UnsafeAutoParamsPersec), - sqlInstance, - ) - return nil, nil } type win32PerfRawDataSQLServerSQLErrors struct { Name string - ErrorsPersec uint64 + ErrorsPersec float64 `perflib:"Errors/sec"` } // Win32_PerfRawData_MSSQLSERVER_SQLServerErrors docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-sql-errors-object -func (c *MSSQLCollector) collectSQLErrors(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectSQLErrors(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSQLServerSQLErrors log.Debugf("mssql_sqlerrors collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("SQLErrors", sqlInstance) - q := queryAllForClassWhere(&dst, class, `Name <> '_Total'`) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "sqlerrors")], &dst); err != nil { return nil, err } for _, v := range dst { + if strings.ToLower(v.Name) == "_total" { + continue + } resource := v.Name ch <- prometheus.MustNewConstMetric( c.SQLErrorsTotal, prometheus.CounterValue, - float64(v.ErrorsPersec), + v.ErrorsPersec, sqlInstance, resource, ) } @@ -3759,129 +3778,123 @@ func (c *MSSQLCollector) collectSQLErrors(ch chan<- prometheus.Metric, sqlInstan } type win32PerfRawDataSqlServerTransactions struct { - FreeSpaceintempdbKB uint64 - LongestTransactionRunningTime uint64 - NonSnapshotVersionTransactions uint64 - SnapshotTransactions uint64 - Transactions uint64 - Updateconflictratio uint64 - UpdateSnapshotTransactions uint64 - VersionCleanuprateKBPers uint64 - VersionGenerationrateKBPers uint64 - VersionStoreSizeKB uint64 - VersionStoreunitcount uint64 - VersionStoreunitcreation uint64 - VersionStoreunittruncation uint64 + FreeSpaceintempdbKB float64 + LongestTransactionRunningTime float64 + NonSnapshotVersionTransactions float64 + SnapshotTransactions float64 + Transactions float64 + Updateconflictratio float64 + UpdateSnapshotTransactions float64 + VersionCleanuprateKBPers float64 + VersionGenerationrateKBPers float64 + VersionStoreSizeKB float64 + VersionStoreunitcount float64 + VersionStoreunitcreation float64 + VersionStoreunittruncation float64 } // Win32_PerfRawData_MSSQLSERVER_Transactions docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-transactions-object -func (c *MSSQLCollector) collectTransactions(ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { +func (c *MSSQLCollector) collectTransactions(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { var dst []win32PerfRawDataSqlServerTransactions log.Debugf("mssql_transactions collector iterating sql instance %s.", sqlInstance) - class := mssqlBuildWMIInstanceClass("Transactions", sqlInstance) - q := queryAllForClass(&dst, class) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "transactions")], &dst); err != nil { return nil, err } - if len(dst) == 0 { - return nil, errors.New("WMI query returned empty result set") + for _, v := range dst { + ch <- prometheus.MustNewConstMetric( + c.TransactionsTempDbFreeSpaceBytes, + prometheus.GaugeValue, + v.FreeSpaceintempdbKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsLongestTransactionRunningSeconds, + prometheus.GaugeValue, + v.LongestTransactionRunningTime, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsNonSnapshotVersionActiveTotal, + prometheus.CounterValue, + v.NonSnapshotVersionTransactions, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsSnapshotActiveTotal, + prometheus.CounterValue, + v.SnapshotTransactions, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsActiveTotal, + prometheus.CounterValue, + v.Transactions, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsUpdateConflictsTotal, + prometheus.CounterValue, + v.Updateconflictratio, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsUpdateSnapshotActiveTotal, + prometheus.CounterValue, + v.UpdateSnapshotTransactions, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsVersionCleanupRateBytes, + prometheus.GaugeValue, + v.VersionCleanuprateKBPers*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsVersionGenerationRateBytes, + prometheus.GaugeValue, + v.VersionGenerationrateKBPers*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsVersionStoreSizeBytes, + prometheus.GaugeValue, + v.VersionStoreSizeKB*1024, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsVersionStoreUnits, + prometheus.CounterValue, + v.VersionStoreunitcount, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsVersionStoreCreationUnits, + prometheus.CounterValue, + v.VersionStoreunitcreation, + sqlInstance, + ) + + ch <- prometheus.MustNewConstMetric( + c.TransactionsVersionStoreTruncationUnits, + prometheus.CounterValue, + v.VersionStoreunittruncation, + sqlInstance, + ) } - v := dst[0] - - ch <- prometheus.MustNewConstMetric( - c.TransactionsTempDbFreeSpaceBytes, - prometheus.GaugeValue, - float64(v.FreeSpaceintempdbKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsLongestTransactionRunningSeconds, - prometheus.GaugeValue, - float64(v.LongestTransactionRunningTime), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsNonSnapshotVersionActiveTotal, - prometheus.CounterValue, - float64(v.NonSnapshotVersionTransactions), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsSnapshotActiveTotal, - prometheus.CounterValue, - float64(v.SnapshotTransactions), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsActiveTotal, - prometheus.CounterValue, - float64(v.Transactions), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsUpdateConflictsTotal, - prometheus.CounterValue, - float64(v.Updateconflictratio), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsUpdateSnapshotActiveTotal, - prometheus.CounterValue, - float64(v.UpdateSnapshotTransactions), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsVersionCleanupRateBytes, - prometheus.GaugeValue, - float64(v.VersionCleanuprateKBPers*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsVersionGenerationRateBytes, - prometheus.GaugeValue, - float64(v.VersionGenerationrateKBPers*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsVersionStoreSizeBytes, - prometheus.GaugeValue, - float64(v.VersionStoreSizeKB*1024), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsVersionStoreUnits, - prometheus.CounterValue, - float64(v.VersionStoreunitcount), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsVersionStoreCreationUnits, - prometheus.CounterValue, - float64(v.VersionStoreunitcreation), - sqlInstance, - ) - - ch <- prometheus.MustNewConstMetric( - c.TransactionsVersionStoreTruncationUnits, - prometheus.CounterValue, - float64(v.VersionStoreunittruncation), - sqlInstance, - ) - return nil, nil } From 8d0d7b31b1b90431980d2f01e38289ef23fdd1ab Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Mon, 31 Aug 2020 23:30:51 -0700 Subject: [PATCH 31/41] Add perflib annotations to struct win32PerfRawDataSqlServerTransactions Signed-off-by: Michael Allen --- collector/mssql.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/collector/mssql.go b/collector/mssql.go index 9c15e01d..1d1c673c 100644 --- a/collector/mssql.go +++ b/collector/mssql.go @@ -3778,19 +3778,19 @@ func (c *MSSQLCollector) collectSQLErrors(ctx *ScrapeContext, ch chan<- promethe } type win32PerfRawDataSqlServerTransactions struct { - FreeSpaceintempdbKB float64 - LongestTransactionRunningTime float64 - NonSnapshotVersionTransactions float64 - SnapshotTransactions float64 - Transactions float64 - Updateconflictratio float64 - UpdateSnapshotTransactions float64 - VersionCleanuprateKBPers float64 - VersionGenerationrateKBPers float64 - VersionStoreSizeKB float64 - VersionStoreunitcount float64 - VersionStoreunitcreation float64 - VersionStoreunittruncation float64 + FreeSpaceintempdbKB float64 `perflib:"Free Space in tempdb (KB)"` + LongestTransactionRunningTime float64 `perflib:"Longest Transaction Running Time"` + NonSnapshotVersionTransactions float64 `perflib:"NonSnapshot Version Transactions"` + SnapshotTransactions float64 `perflib:"Snapshot Transactions"` + Transactions float64 `perflib:"Transactions"` + Updateconflictratio float64 `perflib:"Update conflict ratio"` + UpdateSnapshotTransactions float64 `perflib:"Update Snapshot Transactions"` + VersionCleanuprateKBPers float64 `perflib:"Version Cleanup rate (KB/s)"` + VersionGenerationrateKBPers float64 `perflib:"Version Generation rate (KB/s)"` + VersionStoreSizeKB float64 `perflib:"Version Store Size (KB)"` + VersionStoreunitcount float64 `perflib:"Version Store unit count"` + VersionStoreunitcreation float64 `perflib:"Version Store unit creation"` + VersionStoreunittruncation float64 `perflib:"Version Store unit truncation"` } // Win32_PerfRawData_MSSQLSERVER_Transactions docs: From 3b2ef6287c1948fde1d661e6b0d8fd8843927a3d Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Thu, 3 Sep 2020 17:15:15 -0700 Subject: [PATCH 32/41] Rename MSSQL metrics data structs for clarity The old names were hard to read, but had to be named as such to work with the WMI library. Now that raw performance counter data are used instead of WMI, we are free to name the data structs freely. Signed-off-by: Michael Allen --- collector/mssql.go | 53 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/collector/mssql.go b/collector/mssql.go index 1d1c673c..c942e5d8 100644 --- a/collector/mssql.go +++ b/collector/mssql.go @@ -1875,10 +1875,9 @@ func (c *MSSQLCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric return nil } -// win32PerfRawDataSQLServerAccessMethods docs: -// - Win32_PerfRawData_MSSQLSERVER_SQLServerAccessMethods -// https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object -type win32PerfRawDataSQLServerAccessMethods struct { +// Win32_PerfRawData_MSSQLSERVER_SQLServerAccessMethods docs: +// - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object +type mssqlAccessMethods struct { AUcleanupbatchesPersec float64 `perflib:"AU cleanup batches/sec"` AUcleanupsPersec float64 `perflib:"AU cleanups/sec"` ByreferenceLobCreateCount float64 `perflib:"By-reference Lob Create Count"` @@ -1926,7 +1925,7 @@ type win32PerfRawDataSQLServerAccessMethods struct { } func (c *MSSQLCollector) collectAccessMethods(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerAccessMethods + var dst []mssqlAccessMethods log.Debugf("mssql_accessmethods collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "accessmethods")], &dst); err != nil { @@ -2246,8 +2245,8 @@ func (c *MSSQLCollector) collectAccessMethods(ctx *ScrapeContext, ch chan<- prom } // Win32_PerfRawData_MSSQLSERVER_SQLServerAvailabilityReplica docs: -// https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-availability-replica -type win32PerfRawDataSQLServerAvailabilityReplica struct { +// - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-availability-replica +type mssqlAvailabilityReplica struct { Name string BytesReceivedfromReplicaPersec float64 `perflib:"Bytes Received from Replica/sec"` BytesSenttoReplicaPersec float64 `perflib:"Bytes Sent to Replica/sec"` @@ -2261,7 +2260,7 @@ type win32PerfRawDataSQLServerAvailabilityReplica struct { } func (c *MSSQLCollector) collectAvailabilityReplica(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerAvailabilityReplica + var dst []mssqlAvailabilityReplica log.Debugf("mssql_availreplica collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "availreplica")], &dst); err != nil { @@ -2341,8 +2340,8 @@ func (c *MSSQLCollector) collectAvailabilityReplica(ctx *ScrapeContext, ch chan< } // Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager docs: -// https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object -type win32PerfRawDataSQLServerBufferManager struct { +// - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object +type mssqlBufferManager struct { BackgroundwriterpagesPersec float64 `perflib:"Background writer pages/sec"` Buffercachehitratio float64 `perflib:"Buffer cache hit ratio"` Buffercachehitratio_Base float64 `perflib:"Buffer cache hit ratio base_Base"` @@ -2369,7 +2368,7 @@ type win32PerfRawDataSQLServerBufferManager struct { } func (c *MSSQLCollector) collectBufferManager(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerBufferManager + var dst []mssqlBufferManager log.Debugf("mssql_bufman collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "bufman")], &dst); err != nil { @@ -2544,7 +2543,7 @@ func (c *MSSQLCollector) collectBufferManager(ctx *ScrapeContext, ch chan<- prom // Win32_PerfRawData_MSSQLSERVER_SQLServerDatabaseReplica docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-database-replica -type win32PerfRawDataSQLServerDatabaseReplica struct { +type mssqlDatabaseReplica struct { Name string DatabaseFlowControlDelay float64 `perflib:"Database Flow Control Delay"` DatabaseFlowControlsPersec float64 `perflib:"Database Flow Controls/sec"` @@ -2573,7 +2572,7 @@ type win32PerfRawDataSQLServerDatabaseReplica struct { } func (c *MSSQLCollector) collectDatabaseReplica(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerDatabaseReplica + var dst []mssqlDatabaseReplica log.Debugf("mssql_dbreplica collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "dbreplica")], &dst); err != nil { @@ -2759,7 +2758,7 @@ func (c *MSSQLCollector) collectDatabaseReplica(ctx *ScrapeContext, ch chan<- pr // Win32_PerfRawData_MSSQLSERVER_SQLServerDatabases docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object?view=sql-server-2017 -type win32PerfRawDataSQLServerDatabases struct { +type mssqlDatabases struct { Name string Activeparallelredothreads float64 `perflib:"Active parallel redo threads"` ActiveTransactions float64 `perflib:"Active Transactions"` @@ -2812,7 +2811,7 @@ type win32PerfRawDataSQLServerDatabases struct { } func (c *MSSQLCollector) collectDatabases(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerDatabases + var dst []mssqlDatabases log.Debugf("mssql_databases collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "databases")], &dst); err != nil { @@ -3166,7 +3165,7 @@ func (c *MSSQLCollector) collectDatabases(ctx *ScrapeContext, ch chan<- promethe // Win32_PerfRawData_MSSQLSERVER_SQLServerGeneralStatistics docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-general-statistics-object -type win32PerfRawDataSQLServerGeneralStatistics struct { +type mssqlGeneralStatistics struct { ActiveTempTables float64 `perflib:"Active Temp Tables"` ConnectionResetPersec float64 `perblib:"Connection Reset/sec"` EventNotificationsDelayedDrop float64 `perflib:"Event Notifications Delayed Drop"` @@ -3194,7 +3193,7 @@ type win32PerfRawDataSQLServerGeneralStatistics struct { } func (c *MSSQLCollector) collectGeneralStatistics(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerGeneralStatistics + var dst []mssqlGeneralStatistics log.Debugf("mssql_genstats collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "genstats")], &dst); err != nil { @@ -3376,7 +3375,7 @@ func (c *MSSQLCollector) collectGeneralStatistics(ctx *ScrapeContext, ch chan<- // Win32_PerfRawData_MSSQLSERVER_SQLServerLocks docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-locks-object -type win32PerfRawDataSQLServerLocks struct { +type mssqlLocks struct { Name string AverageWaitTimems float64 `perflib:"Average Wait Time (ms)"` AverageWaitTimems_Base float64 `perflib:"Average Wait Time Base_Base"` @@ -3389,7 +3388,7 @@ type win32PerfRawDataSQLServerLocks struct { } func (c *MSSQLCollector) collectLocks(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerLocks + var dst []mssqlLocks log.Debugf("mssql_locks collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "locks")], &dst); err != nil { @@ -3463,7 +3462,7 @@ func (c *MSSQLCollector) collectLocks(ctx *ScrapeContext, ch chan<- prometheus.M // Win32_PerfRawData_MSSQLSERVER_SQLServerMemoryManager docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-memory-manager-object -type win32PerfRawDataSQLServerMemoryManager struct { +type mssqlMemoryManager struct { ConnectionMemoryKB float64 `perflib:"Connection Memory (KB)"` DatabaseCacheMemoryKB float64 `perflib:"Database Cache Memory (KB)"` Externalbenefitofmemory float64 `perflib:"External benefit of memory"` @@ -3487,7 +3486,7 @@ type win32PerfRawDataSQLServerMemoryManager struct { } func (c *MSSQLCollector) collectMemoryManager(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerMemoryManager + var dst []mssqlMemoryManager log.Debugf("mssql_memmgr collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "memmgr")], &dst); err != nil { @@ -3641,7 +3640,7 @@ func (c *MSSQLCollector) collectMemoryManager(ctx *ScrapeContext, ch chan<- prom // Win32_PerfRawData_MSSQLSERVER_SQLServerSQLStatistics docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-sql-statistics-object -type win32PerfRawDataSQLServerSQLStatistics struct { +type mssqlSQLStatistics struct { AutoParamAttemptsPersec float64 `perflib:"Auto-Param Attempts/sec"` BatchRequestsPersec float64 `perflib:"Batch Requests/sec"` FailedAutoParamsPersec float64 `perflib:"Failed Auto-Params/sec"` @@ -3656,7 +3655,7 @@ type win32PerfRawDataSQLServerSQLStatistics struct { } func (c *MSSQLCollector) collectSQLStats(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerSQLStatistics + var dst []mssqlSQLStatistics log.Debugf("mssql_sqlstats collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "sqlstats")], &dst); err != nil { @@ -3745,7 +3744,7 @@ func (c *MSSQLCollector) collectSQLStats(ctx *ScrapeContext, ch chan<- prometheu return nil, nil } -type win32PerfRawDataSQLServerSQLErrors struct { +type mssqlSQLErrors struct { Name string ErrorsPersec float64 `perflib:"Errors/sec"` } @@ -3753,7 +3752,7 @@ type win32PerfRawDataSQLServerSQLErrors struct { // Win32_PerfRawData_MSSQLSERVER_SQLServerErrors docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-sql-errors-object func (c *MSSQLCollector) collectSQLErrors(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSQLServerSQLErrors + var dst []mssqlSQLErrors log.Debugf("mssql_sqlerrors collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "sqlerrors")], &dst); err != nil { @@ -3777,7 +3776,7 @@ func (c *MSSQLCollector) collectSQLErrors(ctx *ScrapeContext, ch chan<- promethe return nil, nil } -type win32PerfRawDataSqlServerTransactions struct { +type mssqlTransactions struct { FreeSpaceintempdbKB float64 `perflib:"Free Space in tempdb (KB)"` LongestTransactionRunningTime float64 `perflib:"Longest Transaction Running Time"` NonSnapshotVersionTransactions float64 `perflib:"NonSnapshot Version Transactions"` @@ -3796,7 +3795,7 @@ type win32PerfRawDataSqlServerTransactions struct { // Win32_PerfRawData_MSSQLSERVER_Transactions docs: // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-transactions-object func (c *MSSQLCollector) collectTransactions(ctx *ScrapeContext, ch chan<- prometheus.Metric, sqlInstance string) (*prometheus.Desc, error) { - var dst []win32PerfRawDataSqlServerTransactions + var dst []mssqlTransactions log.Debugf("mssql_transactions collector iterating sql instance %s.", sqlInstance) if err := unmarshalObject(ctx.perfObjects[mssqlGetPerfObjectName(sqlInstance, "transactions")], &dst); err != nil { From a3867b8dbf1e1bf4cc4e72f7aaa7f0f33f357f8b Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Sun, 6 Sep 2020 18:25:21 -0700 Subject: [PATCH 33/41] Correct a typo where "perflib" was misspelled in a struct field tag Signed-off-by: Michael Allen --- collector/mssql.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/mssql.go b/collector/mssql.go index c942e5d8..c0a64797 100644 --- a/collector/mssql.go +++ b/collector/mssql.go @@ -3167,7 +3167,7 @@ func (c *MSSQLCollector) collectDatabases(ctx *ScrapeContext, ch chan<- promethe // - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-general-statistics-object type mssqlGeneralStatistics struct { ActiveTempTables float64 `perflib:"Active Temp Tables"` - ConnectionResetPersec float64 `perblib:"Connection Reset/sec"` + ConnectionResetPersec float64 `perflib:"Connection Reset/sec"` EventNotificationsDelayedDrop float64 `perflib:"Event Notifications Delayed Drop"` HTTPAuthenticatedRequests float64 `perflib:"HTTP Authenticated Requests"` LogicalConnections float64 `perflib:"Logical Connections"` From d39d5230abbf6e2fd63e8a57f7e64ad2d01c252e Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sat, 12 Sep 2020 16:37:32 +0200 Subject: [PATCH 34/41] Change upgrade phase With afterInstallExecute, the old installation is only removed after the new one is finished, which has led to some users seeing the new version failing to start, leading to the install rolling back. afterInstallInitialize, in contrast, uninstalls before the new installation. Signed-off-by: Calle Pettersson --- installer/windows_exporter.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/windows_exporter.wxs b/installer/windows_exporter.wxs index f880baf3..65cea249 100644 --- a/installer/windows_exporter.wxs +++ b/installer/windows_exporter.wxs @@ -14,7 +14,7 @@ - + ENABLED_COLLECTORS From 2ebea42de5d2c805fad4e30fb53cedb77c773afe Mon Sep 17 00:00:00 2001 From: siku4 Date: Mon, 28 Sep 2020 15:37:48 +0200 Subject: [PATCH 35/41] Enable the use of remote ip addresses for fw rule Signed-off-by: siku4 --- README.md | 1 + installer/windows_exporter.wxs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 17e9399f..f24a5a86 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ Name | Description `LISTEN_PORT` | The port to bind to. Defaults to 9182. `METRICS_PATH` | The path at which to serve metrics. Defaults to `/metrics` `TEXTFILE_DIR` | As the `--collector.textfile.directory` flag, provide a directory to read text files with metrics from +`REMOTE_ADDR` | Allows setting comma separated remote IP addresses for the Windows Firewall exception (whitelist). Defaults to an empty string (any remote address). `EXTRA_FLAGS` | Allows passing full CLI flags. Defaults to an empty string. Parameters are sent to the installer via `msiexec`. Example invocations: diff --git a/installer/windows_exporter.wxs b/installer/windows_exporter.wxs index f880baf3..8e9f2ba1 100644 --- a/installer/windows_exporter.wxs +++ b/installer/windows_exporter.wxs @@ -28,6 +28,9 @@ METRICS_PATH + + + REMOTE_ADDR @@ -43,7 +46,9 @@ - + + [REMOTE_ADDR] + From 380eff24c9fc4f4f470f09e6ee11792b7721d196 Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Wed, 7 Oct 2020 22:25:58 -0700 Subject: [PATCH 36/41] Convert the tcp collector to use perflib instead of WMI Using perflib is substantially faster and more reliable than using WMI to retrieve Windows performance counter data. Signed-off-by: Michael Allen --- collector/tcp.go | 53 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/collector/tcp.go b/collector/tcp.go index 0253907a..c486f84e 100644 --- a/collector/tcp.go +++ b/collector/tcp.go @@ -4,13 +4,13 @@ package collector import ( "errors" - "github.com/StackExchange/wmi" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/log" ) func init() { - registerCollector("tcp", NewTCPCollector) + registerCollector("tcp", NewTCPCollector, "TCPv4") } // A TCPCollector is a Prometheus collector for WMI Win32_PerfRawData_Tcpip_TCPv4 metrics @@ -91,7 +91,7 @@ func NewTCPCollector() (Collector, error) { // Collect sends the metric values for each metric // to the provided prometheus Metric channel. func (c *TCPCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) error { - if desc, err := c.collect(ch); err != nil { + if desc, err := c.collect(ctx, ch); err != nil { log.Error("failed collecting tcp metrics:", desc, err) return err } @@ -100,74 +100,73 @@ func (c *TCPCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) // Win32_PerfRawData_Tcpip_TCPv4 docs // - https://msdn.microsoft.com/en-us/library/aa394341(v=vs.85).aspx -type Win32_PerfRawData_Tcpip_TCPv4 struct { - ConnectionFailures uint64 - ConnectionsActive uint64 - ConnectionsEstablished uint64 - ConnectionsPassive uint64 - ConnectionsReset uint64 - SegmentsPersec uint64 - SegmentsReceivedPersec uint64 - SegmentsRetransmittedPersec uint64 - SegmentsSentPersec uint64 +type tcp struct { + ConnectionFailures float64 `perflib:"Connection Failures"` + ConnectionsActive float64 `perflib:"Connections Active"` + ConnectionsEstablished float64 `perflib:"Connections Established"` + ConnectionsPassive float64 `perflib:"Connections Passive"` + ConnectionsReset float64 `perflib:"Connections Reset"` + SegmentsPersec float64 `perflib:"Segments/sec"` + SegmentsReceivedPersec float64 `perflib:"Segments Received/sec"` + SegmentsRetransmittedPersec float64 `perflib:"Segments Retransmitted/sec"` + SegmentsSentPersec float64 `perflib:"Segments Sent/sec"` } -func (c *TCPCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) { - var dst []Win32_PerfRawData_Tcpip_TCPv4 +func (c *TCPCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + var dst []tcp - q := queryAll(&dst) - if err := wmi.Query(q, &dst); err != nil { + if err := unmarshalObject(ctx.perfObjects["TCPv4"], &dst); err != nil { return nil, err } if len(dst) == 0 { - return nil, errors.New("WMI query returned empty result set") + return nil, errors.New("TCPv4 performance object not available") } // Counters ch <- prometheus.MustNewConstMetric( c.ConnectionFailures, prometheus.CounterValue, - float64(dst[0].ConnectionFailures), + dst[0].ConnectionFailures, ) ch <- prometheus.MustNewConstMetric( c.ConnectionsActive, prometheus.CounterValue, - float64(dst[0].ConnectionsActive), + dst[0].ConnectionsActive, ) ch <- prometheus.MustNewConstMetric( c.ConnectionsEstablished, prometheus.GaugeValue, - float64(dst[0].ConnectionsEstablished), + dst[0].ConnectionsEstablished, ) ch <- prometheus.MustNewConstMetric( c.ConnectionsPassive, prometheus.CounterValue, - float64(dst[0].ConnectionsPassive), + dst[0].ConnectionsPassive, ) ch <- prometheus.MustNewConstMetric( c.ConnectionsReset, prometheus.CounterValue, - float64(dst[0].ConnectionsReset), + dst[0].ConnectionsReset, ) ch <- prometheus.MustNewConstMetric( c.SegmentsTotal, prometheus.CounterValue, - float64(dst[0].SegmentsPersec), + dst[0].SegmentsPersec, ) ch <- prometheus.MustNewConstMetric( c.SegmentsReceivedTotal, prometheus.CounterValue, - float64(dst[0].SegmentsReceivedPersec), + dst[0].SegmentsReceivedPersec, ) ch <- prometheus.MustNewConstMetric( c.SegmentsRetransmittedTotal, prometheus.CounterValue, - float64(dst[0].SegmentsRetransmittedPersec), + dst[0].SegmentsRetransmittedPersec, ) ch <- prometheus.MustNewConstMetric( c.SegmentsSentTotal, prometheus.CounterValue, - float64(dst[0].SegmentsSentPersec), + dst[0].SegmentsSentPersec, ) return nil, nil From 94bda6aa79496e89f7cc213bc8dce5209a482bbf Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Thu, 8 Oct 2020 11:43:39 -0700 Subject: [PATCH 37/41] Expose TCPv6 performance counters in the tcp collector Signed-off-by: Michael Allen --- collector/tcp.go | 84 +++++++++++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/collector/tcp.go b/collector/tcp.go index c486f84e..e9d2adce 100644 --- a/collector/tcp.go +++ b/collector/tcp.go @@ -3,17 +3,15 @@ package collector import ( - "errors" - "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/log" ) func init() { - registerCollector("tcp", NewTCPCollector, "TCPv4") + registerCollector("tcp", NewTCPCollector, "TCPv4", "TCPv6") } -// A TCPCollector is a Prometheus collector for WMI Win32_PerfRawData_Tcpip_TCPv4 metrics +// A TCPCollector is a Prometheus collector for WMI Win32_PerfRawData_Tcpip_TCPv{4,6} metrics type TCPCollector struct { ConnectionFailures *prometheus.Desc ConnectionsActive *prometheus.Desc @@ -34,55 +32,55 @@ func NewTCPCollector() (Collector, error) { ConnectionFailures: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "connection_failures"), "(TCP.ConnectionFailures)", - nil, + []string{"af"}, nil, ), ConnectionsActive: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "connections_active"), "(TCP.ConnectionsActive)", - nil, + []string{"af"}, nil, ), ConnectionsEstablished: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "connections_established"), "(TCP.ConnectionsEstablished)", - nil, + []string{"af"}, nil, ), ConnectionsPassive: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "connections_passive"), "(TCP.ConnectionsPassive)", - nil, + []string{"af"}, nil, ), ConnectionsReset: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "connections_reset"), "(TCP.ConnectionsReset)", - nil, + []string{"af"}, nil, ), SegmentsTotal: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "segments_total"), "(TCP.SegmentsTotal)", - nil, + []string{"af"}, nil, ), SegmentsReceivedTotal: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "segments_received_total"), "(TCP.SegmentsReceivedTotal)", - nil, + []string{"af"}, nil, ), SegmentsRetransmittedTotal: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "segments_retransmitted_total"), "(TCP.SegmentsRetransmittedTotal)", - nil, + []string{"af"}, nil, ), SegmentsSentTotal: prometheus.NewDesc( prometheus.BuildFQName(Namespace, subsystem, "segments_sent_total"), "(TCP.SegmentsSentTotal)", - nil, + []string{"af"}, nil, ), }, nil @@ -100,6 +98,7 @@ func (c *TCPCollector) Collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) // Win32_PerfRawData_Tcpip_TCPv4 docs // - https://msdn.microsoft.com/en-us/library/aa394341(v=vs.85).aspx +// The TCPv6 performance object uses the same fields. type tcp struct { ConnectionFailures float64 `perflib:"Connection Failures"` ConnectionsActive float64 `perflib:"Connections Active"` @@ -112,62 +111,81 @@ type tcp struct { SegmentsSentPersec float64 `perflib:"Segments Sent/sec"` } -func (c *TCPCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { - var dst []tcp - - if err := unmarshalObject(ctx.perfObjects["TCPv4"], &dst); err != nil { - return nil, err - } - if len(dst) == 0 { - return nil, errors.New("TCPv4 performance object not available") - } - - // Counters +func writeTCPCounters(metrics tcp, labels []string, c *TCPCollector, ch chan<- prometheus.Metric) { ch <- prometheus.MustNewConstMetric( c.ConnectionFailures, prometheus.CounterValue, - dst[0].ConnectionFailures, + metrics.ConnectionFailures, + labels..., ) ch <- prometheus.MustNewConstMetric( c.ConnectionsActive, prometheus.CounterValue, - dst[0].ConnectionsActive, + metrics.ConnectionsActive, + labels..., ) ch <- prometheus.MustNewConstMetric( c.ConnectionsEstablished, prometheus.GaugeValue, - dst[0].ConnectionsEstablished, + metrics.ConnectionsEstablished, + labels..., ) ch <- prometheus.MustNewConstMetric( c.ConnectionsPassive, prometheus.CounterValue, - dst[0].ConnectionsPassive, + metrics.ConnectionsPassive, + labels..., ) ch <- prometheus.MustNewConstMetric( c.ConnectionsReset, prometheus.CounterValue, - dst[0].ConnectionsReset, + metrics.ConnectionsReset, + labels..., ) ch <- prometheus.MustNewConstMetric( c.SegmentsTotal, prometheus.CounterValue, - dst[0].SegmentsPersec, + metrics.SegmentsPersec, + labels..., ) ch <- prometheus.MustNewConstMetric( c.SegmentsReceivedTotal, prometheus.CounterValue, - dst[0].SegmentsReceivedPersec, + metrics.SegmentsReceivedPersec, + labels..., ) ch <- prometheus.MustNewConstMetric( c.SegmentsRetransmittedTotal, prometheus.CounterValue, - dst[0].SegmentsRetransmittedPersec, + metrics.SegmentsRetransmittedPersec, + labels..., ) ch <- prometheus.MustNewConstMetric( c.SegmentsSentTotal, prometheus.CounterValue, - dst[0].SegmentsSentPersec, + metrics.SegmentsSentPersec, + labels..., ) +} + +func (c *TCPCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (*prometheus.Desc, error) { + var dst []tcp + + // TCPv4 counters + if err := unmarshalObject(ctx.perfObjects["TCPv4"], &dst); err != nil { + return nil, err + } + if len(dst) != 0 { + writeTCPCounters(dst[0], []string{"ipv4"}, c, ch) + } + + // TCPv6 counters + if err := unmarshalObject(ctx.perfObjects["TCPv6"], &dst); err != nil { + return nil, err + } + if len(dst) != 0 { + writeTCPCounters(dst[0], []string{"ipv6"}, c, ch) + } return nil, nil } From 3bf94cdaf6130c760c6d68fe3fece52e5fd8ae3f Mon Sep 17 00:00:00 2001 From: Alexey Shumkin Date: Fri, 9 Oct 2020 13:45:49 +0300 Subject: [PATCH 38/41] Fix metrics description `windows_mssql_locks_lock_timeouts` and `windows_mssql_locks_lock_timeouts_excluding_NOWAIT` metrics have exchanged descriptions. According to https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-locks-object --- Lock Timeouts | Number of lock requests per second that (timeout > 0)/sec | timed out, but excluding requests for NOWAIT locks. --- Lock Timeouts/sec | Number of lock requests per second that timed | out, including requests for NOWAIT locks. --- Metrics gathered are correct but descriptions are exchanged. Signed-off-by: Alexey Shumkin --- docs/collector.mssql.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/collector.mssql.md b/docs/collector.mssql.md index bbc559af..bd44f0ac 100644 --- a/docs/collector.mssql.md +++ b/docs/collector.mssql.md @@ -194,8 +194,8 @@ Name | Description | Type | Labels `windows_mssql_genstats_user_connections` | Counts the number of users currently connected to SQL Server | counter | `instance` `windows_mssql_locks_average_wait_seconds` | Average amount of wait time (in milliseconds) for each lock request that resulted in a wait | counter | `instance`, `resource` `windows_mssql_locks_lock_requests` | Number of new locks and lock conversions per second requested from the lock manager | counter | `instance`, `resource` -`windows_mssql_locks_lock_timeouts` | Number of lock requests per second that timed out, but excluding requests for NOWAIT locks | counter | `instance`, `resource` -`windows_mssql_locks_lock_timeouts_excluding_NOWAIT` | Number of lock requests per second that timed out, including requests for NOWAIT locks | counter | `instance`, `resource` +`windows_mssql_locks_lock_timeouts` | Number of lock requests per second that timed out, including requests for NOWAIT locks | counter | `instance`, `resource` +`windows_mssql_locks_lock_timeouts_excluding_NOWAIT` | Number of lock requests per second that timed out, but excluding requests for NOWAIT locks | counter | `instance`, `resource` `windows_mssql_locks_lock_waits` | Total wait time (in milliseconds) for locks in the last second | counter | `instance`, `resource` `windows_mssql_locks_lock_wait_seconds` | Number of lock requests per second that required the caller to wait | counter | `instance`, `resource` `windows_mssql_locks_deadlocks` | Number of lock requests per second that resulted in a deadlock | counter | `instance`, `resource` From 51dd61beeb5fe3fda977c6892c486beb6ec7d2a7 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sat, 4 Jul 2020 21:23:45 +0200 Subject: [PATCH 39/41] Set Windows versioninfo on build Signed-off-by: Calle Pettersson --- .gitignore | 3 ++- appveyor.yml | 6 ++++++ versioninfo.json | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 versioninfo.json diff --git a/.gitignore b/.gitignore index 57676a59..e8af3c55 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ VERSION *.un~ output/ .vscode -.idea \ No newline at end of file +.idea +*.syso diff --git a/appveyor.yml b/appveyor.yml index 794bb14c..a6429fd1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,6 +22,7 @@ install: - ps: | $env:GO111MODULE="off" go get -u github.com/prometheus/promu + go get -u github.com/josephspurrier/goversioninfo/cmd/goversioninfo $env:GO111MODULE="on" test_script: @@ -37,8 +38,13 @@ build_script: # so we need to run it before setting the preference. go mod download $ErrorActionPreference = "Stop" + gitversion /output json /showvariable FullSemVer | Set-Content VERSION -PassThru $Version = Get-Content VERSION + # Windows versioninfo resources need the file version by parts (but product version is free text) + $VersionParts = ($Version -replace '^v?([0-9\.]+).*$','$1').Split(".") + goversioninfo.exe -ver-major $VersionParts[0] -ver-minor $VersionParts[1] -ver-patch $VersionParts[2] -product-version $Version -platform-specific + make crossbuild # GH requires all files to have different names, so add version/arch to differentiate foreach($Arch in "amd64","386") { diff --git a/versioninfo.json b/versioninfo.json new file mode 100644 index 00000000..c8860228 --- /dev/null +++ b/versioninfo.json @@ -0,0 +1,7 @@ +{ + "StringFileInfo": { + "CompanyName": "prometheus-community", + "LegalCopyright": "Copyright 2020 The Prometheus Authors", + "ProductName": "windows_exporter" + } +} From be39c1126ac1bc4cf83d3d8ebf457cc6c5b4d67e Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Fri, 9 Oct 2020 20:18:18 -0700 Subject: [PATCH 40/41] Document changes to the tcp collector Note that TCPv6 metrics are now exported, and there is a new label, `af`. Signed-off-by: Michael Allen --- docs/collector.tcp.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/collector.tcp.md b/docs/collector.tcp.md index 081be618..de15eab8 100644 --- a/docs/collector.tcp.md +++ b/docs/collector.tcp.md @@ -5,7 +5,8 @@ The tcp collector exposes metrics about the TCP/IPv4 network stack. ||| -|- Metric name prefix | `tcp` -Classes | [`Win32_PerfRawData_Tcpip_TCPv4`](https://msdn.microsoft.com/en-us/library/aa394341(v=vs.85).aspx) +Data source | Perflib +Classes | [`Win32_PerfRawData_Tcpip_TCPv4`](https://msdn.microsoft.com/en-us/library/aa394341(v=vs.85).aspx), Win32_PerfRawData_Tcpip_TCPv6 Enabled by default? | No ## Flags @@ -16,15 +17,15 @@ None Name | Description | Type | Labels -----|-------------|------|------- -`windows_tcp_connection_failures` | Number of times TCP connections have made a direct transition to the CLOSED state from the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition from the SYN-RCVD state to the LISTEN state | counter | None -`windows_tcp_connections_active` | Number of times TCP connections have made a direct transition from the CLOSED state to the SYN-SENT state.| counter | None -`windows_tcp_connections_established` | Number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT. | counter | None -`windows_tcp_connections_passive` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | None -`windows_tcp_connections_reset` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | None -`windows_tcp_segments_total` | Total segments sent or received using the TCP protocol | counter | None -`windows_tcp_segments_received_total` | Total segments received, including those received in error. This count includes segments received on currently established connections | counter | None -`windows_tcp_segments_retransmitted_total` | Total segments retransmitted. That is, segments transmitted that contain one or more previously transmitted bytes | counter | None -`windows_tcp_segments_sent_total` | Total segments sent, including those on current connections, but excluding those containing *only* retransmitted bytes | counter | None +`windows_tcp_connection_failures` | Number of times TCP connections have made a direct transition to the CLOSED state from the SYN-SENT state or the SYN-RCVD state, plus the number of times TCP connections have made a direct transition from the SYN-RCVD state to the LISTEN state | counter | af +`windows_tcp_connections_active` | Number of times TCP connections have made a direct transition from the CLOSED state to the SYN-SENT state.| counter | af +`windows_tcp_connections_established` | Number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT. | counter | af +`windows_tcp_connections_passive` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | af +`windows_tcp_connections_reset` | Number of times TCP connections have made a direct transition from the LISTEN state to the SYN-RCVD state. | counter | af +`windows_tcp_segments_total` | Total segments sent or received using the TCP protocol | counter | af +`windows_tcp_segments_received_total` | Total segments received, including those received in error. This count includes segments received on currently established connections | counter | af +`windows_tcp_segments_retransmitted_total` | Total segments retransmitted. That is, segments transmitted that contain one or more previously transmitted bytes | counter | af +`windows_tcp_segments_sent_total` | Total segments sent, including those on current connections, but excluding those containing *only* retransmitted bytes | counter | af ### Example metric _This collector does not yet have explained examples, we would appreciate your help adding them!_ From c5ea575fb17c413a5e86c8b8a17c2a18a4777824 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sat, 10 Oct 2020 21:01:20 +0200 Subject: [PATCH 41/41] Remove cs metrics from memory collector docs Signed-off-by: Calle Pettersson --- docs/collector.memory.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/collector.memory.md b/docs/collector.memory.md index eb28106b..ad8bf00e 100644 --- a/docs/collector.memory.md +++ b/docs/collector.memory.md @@ -17,8 +17,6 @@ None Name | Description | Type | Labels -----|-------------|------|------- -`windows_cs_logical_processors` | Number of installed logical processors | gauge | None -`windows_cs_physical_memory_bytes` | Total installed physical memory | gauge | None `windows_memory_available_bytes` | The amount of physical memory immediately available for allocation to a process or for system use. It is equal to the sum of memory assigned to the standby (cached), free and zero page lists | gauge | None `windows_memory_cache_bytes` | Number of bytes currently being used by the file system cache | gauge | None `windows_memory_cache_bytes_peak` | Maximum number of CacheBytes after the system was last restarted | gauge | None