mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 14:06:38 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe7e5cb4d8 | ||
|
|
c156f2bcbe | ||
|
|
832771b4a2 | ||
|
|
16fecfbc67 | ||
|
|
bad1e7f7b0 | ||
|
|
c868c00e89 | ||
|
|
5035e97369 | ||
|
|
144715e3d2 | ||
|
|
a20cf1274a | ||
|
|
626a25cd00 | ||
|
|
96dd456bb1 | ||
|
|
af1b8bf4d0 | ||
|
|
d83615a818 | ||
|
|
fe4c61a70e | ||
|
|
143705bbf6 | ||
|
|
e8ffb736d0 |
@@ -9,15 +9,16 @@ Prometheus exporter for Windows machines, using the WMI (Windows Management Inst
|
||||
|
||||
Name | Description | Enabled by default
|
||||
---------|-------------|--------------------
|
||||
ad | [Win32_PerfRawData_DirectoryServices_DirectoryServices](https://msdn.microsoft.com/en-us/library/ms803980.aspx) Active Directory |
|
||||
ad | [Win32_PerfRawData_DirectoryServices_DirectoryServices](https://msdn.microsoft.com/en-us/library/ms803980.aspx) Active Directory |
|
||||
cpu | [Win32_PerfRawData_PerfOS_Processor](https://msdn.microsoft.com/en-us/library/aa394317(v=vs.90).aspx) metrics (cpu usage) | ✓
|
||||
cs | [Win32_ComputerSystem](https://msdn.microsoft.com/en-us/library/aa394102) metrics (system properties, num cpus/total memory) | ✓
|
||||
dns | [Win32_PerfRawData_DNS_DNS](https://technet.microsoft.com/en-us/library/cc977686.aspx) metrics (DNS Server) |
|
||||
hyperv | Performance counters for Hyper-V hosts |
|
||||
hyperv | Performance counters for Hyper-V hosts |
|
||||
iis | [Win32_PerfRawData_W3SVC_WebService](https://msdn.microsoft.com/en-us/library/aa394345) IIS metrics |
|
||||
logical_disk | [Win32_PerfRawData_PerfDisk_LogicalDisk](https://msdn.microsoft.com/en-us/windows/hardware/aa394307(v=vs.71)) metrics (disk I/O) | ✓
|
||||
net | [Win32_PerfRawData_Tcpip_NetworkInterface](https://technet.microsoft.com/en-us/security/aa394340(v=vs.80)) metrics (network interface I/O) | ✓
|
||||
msmq | [Win32_PerfRawData_MSMQ_MSMQQueue](http://wutils.com/wmi/root/cimv2/win32_perfrawdata_msmq_msmqqueue/) metrics (MSMQ/journal count) |
|
||||
msmq | [Win32_PerfRawData_MSMQ_MSMQQueue](http://wutils.com/wmi/root/cimv2/win32_perfrawdata_msmq_msmqqueue/) metrics (MSMQ/journal count) |
|
||||
mssql | various [SQL Server Performance Objects](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects#SQLServerPOs) metrics |
|
||||
os | [Win32_OperatingSystem](https://msdn.microsoft.com/en-us/library/aa394239) metrics (memory, processes, users) | ✓
|
||||
process | [Win32_PerfRawData_PerfProc_Process](https://msdn.microsoft.com/en-us/library/aa394323(v=vs.85).aspx) metrics (per-process stats) |
|
||||
service | [Win32_Service](https://msdn.microsoft.com/en-us/library/aa394418(v=vs.85).aspx) metrics (service states) | ✓
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
package collector
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
@@ -616,6 +618,9 @@ func (c *ADCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, er
|
||||
if err := wmi.Query(q, &dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.AddressBookOperationsTotal,
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
package collector
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
@@ -60,6 +62,9 @@ func (c *CSCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, er
|
||||
if err := wmi.Query(q, &dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.LogicalProcessors,
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
package collector
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
@@ -237,6 +239,9 @@ func (c *DNSCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
|
||||
if err := wmi.Query(q, &dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ZoneTransferRequestsReceived,
|
||||
|
||||
421
collector/iis.go
421
collector/iis.go
@@ -7,6 +7,7 @@
|
||||
package collector
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
@@ -1738,216 +1739,218 @@ func (c *IISCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(dst_cache) > 0 {
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_ActiveFlushedEntries,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].ActiveFlushedEntries),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FileCacheMemoryUsage,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].CurrentFileCacheMemoryUsage),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MaximumFileCacheMemoryUsage,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].MaximumFileCacheMemoryUsage),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FileCacheFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedFiles),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FileCacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].FileCacheHits+dst_cache[0].FileCacheMisses),
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FileCacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].FileCacheHits),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FilesCached,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].CurrentFilesCached),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FilesCachedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFilesCached),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FilesFlushedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedFiles),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedURIs),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelTotalFlushedURIs),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].URICacheHits+dst_cache[0].URICacheMisses),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelURICacheHits+dst_cache[0].KernelURICacheMisses),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].URICacheHits),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelURICacheHits),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsCached,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].CurrentURIsCached),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsCached,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].KernelCurrentURIsCached),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsCachedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalURIsCached),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsCachedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelTotalURIsCached),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsFlushedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedURIs),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsFlushedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelTotalFlushedURIs),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCached,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].CurrentMetadataCached),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCacheFlushes,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedMetadata),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].MetadataCacheHits+dst_cache[0].MetadataCacheMisses),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].MetadataCacheHits),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCachedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalMetadataCached),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataFlushedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedMetadata),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheActiveFlushedItems,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheCurrentFlushedItems),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheItems,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheCurrentItems),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheMemoryUsage,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheCurrentMemoryUsage),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheTotalHits+dst_cache[0].OutputCacheTotalMisses),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheTotalHits),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheFlushedItemsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheTotalFlushedItems),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheTotalFlushes),
|
||||
)
|
||||
if len(dst_cache) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_ActiveFlushedEntries,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].ActiveFlushedEntries),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FileCacheMemoryUsage,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].CurrentFileCacheMemoryUsage),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MaximumFileCacheMemoryUsage,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].MaximumFileCacheMemoryUsage),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FileCacheFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedFiles),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FileCacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].FileCacheHits+dst_cache[0].FileCacheMisses),
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FileCacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].FileCacheHits),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FilesCached,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].CurrentFilesCached),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FilesCachedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFilesCached),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_FilesFlushedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedFiles),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedURIs),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelTotalFlushedURIs),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].URICacheHits+dst_cache[0].URICacheMisses),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelURICacheHits+dst_cache[0].KernelURICacheMisses),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].URICacheHits),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URICacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelURICacheHits),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsCached,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].CurrentURIsCached),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsCached,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].KernelCurrentURIsCached),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsCachedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalURIsCached),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsCachedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelTotalURIsCached),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsFlushedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedURIs),
|
||||
"user",
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_URIsFlushedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].KernelTotalFlushedURIs),
|
||||
"kernel",
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCached,
|
||||
prometheus.GaugeValue,
|
||||
float64(dst_cache[0].CurrentMetadataCached),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCacheFlushes,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedMetadata),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].MetadataCacheHits+dst_cache[0].MetadataCacheMisses),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].MetadataCacheHits),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataCachedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalMetadataCached),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_MetadataFlushedTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].TotalFlushedMetadata),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheActiveFlushedItems,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheCurrentFlushedItems),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheItems,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheCurrentItems),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheMemoryUsage,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheCurrentMemoryUsage),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheQueriesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheTotalHits+dst_cache[0].OutputCacheTotalMisses),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheHitsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheTotalHits),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheFlushedItemsTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheTotalFlushedItems),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ServiceCache_OutputCacheFlushesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(dst_cache[0].OutputCacheTotalFlushes),
|
||||
)
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
3546
collector/mssql.go
Normal file
3546
collector/mssql.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@
|
||||
package collector
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/StackExchange/wmi"
|
||||
@@ -142,6 +143,10 @@ func (c *OSCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, er
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.PhysicalMemoryFreeBytes,
|
||||
prometheus.GaugeValue,
|
||||
|
||||
@@ -177,6 +177,11 @@ type Win32_PerfRawData_PerfProc_Process struct {
|
||||
WorkingSetPrivate uint64
|
||||
}
|
||||
|
||||
type WorkerProcess struct {
|
||||
AppPoolName string
|
||||
ProcessId uint32
|
||||
}
|
||||
|
||||
func (c *ProcessCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
||||
var dst []Win32_PerfRawData_PerfProc_Process
|
||||
q := queryAllWhere(&dst, c.queryWhereClause)
|
||||
@@ -184,6 +189,10 @@ func (c *ProcessCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var dst_wp []WorkerProcess
|
||||
q_wp := queryAll(&dst_wp)
|
||||
wmi.QueryNamespace(q_wp, &dst_wp, "root\\WebAdministration")
|
||||
|
||||
for _, process := range dst {
|
||||
|
||||
if process.Name == "_Total" {
|
||||
@@ -194,6 +203,13 @@ func (c *ProcessCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des
|
||||
pid := strconv.FormatUint(uint64(process.IDProcess), 10)
|
||||
cpid := strconv.FormatUint(uint64(process.CreatingProcessID), 10)
|
||||
|
||||
for _, wp := range dst_wp {
|
||||
if wp.ProcessId == process.IDProcess {
|
||||
processName = strings.Join([]string{processName, wp.AppPoolName}, "_")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.StartTime,
|
||||
prometheus.GaugeValue,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package collector
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
@@ -94,6 +95,9 @@ func (c *SystemCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc
|
||||
if err := wmi.Query(q, &dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.ContextSwitchesTotal,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package collector
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
@@ -118,6 +119,9 @@ func (c *TCPCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
|
||||
if err := wmi.Query(q, &dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
// Counters
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
package collector
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/StackExchange/wmi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/log"
|
||||
@@ -201,6 +203,9 @@ func (c *VmwareCollector) collectMem(ch chan<- prometheus.Metric) (*prometheus.D
|
||||
if err := wmi.Query(q, &dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.MemActive,
|
||||
@@ -287,6 +292,9 @@ func (c *VmwareCollector) collectCpu(ch chan<- prometheus.Metric) (*prometheus.D
|
||||
if err := wmi.Query(q, &dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(dst) == 0 {
|
||||
return nil, errors.New("WMI query returned empty result set")
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.CpuLimitMHz,
|
||||
|
||||
@@ -185,7 +185,7 @@ func main() {
|
||||
).Default("/metrics").String()
|
||||
enabledCollectors = kingpin.Flag(
|
||||
"collectors.enabled",
|
||||
"Comma-separated list of collectors to use. Use '[default]' as a placeholder for all the collectors enabled by default.").
|
||||
"Comma-separated list of collectors to use. Use '[defaults]' as a placeholder for all the collectors enabled by default.").
|
||||
Default(filterAvailableCollectors(defaultCollectors)).String()
|
||||
printCollectors = kingpin.Flag(
|
||||
"collectors.print",
|
||||
|
||||
Reference in New Issue
Block a user