mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-12 07:56:38 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9b8cfd1ca |
@@ -39,6 +39,7 @@ type NetworkCollector struct {
|
|||||||
PacketsReceivedTotal *prometheus.Desc
|
PacketsReceivedTotal *prometheus.Desc
|
||||||
PacketsReceivedUnknown *prometheus.Desc
|
PacketsReceivedUnknown *prometheus.Desc
|
||||||
PacketsSentTotal *prometheus.Desc
|
PacketsSentTotal *prometheus.Desc
|
||||||
|
CurrentBandwidth *prometheus.Desc
|
||||||
|
|
||||||
nicWhitelistPattern *regexp.Regexp
|
nicWhitelistPattern *regexp.Regexp
|
||||||
nicBlacklistPattern *regexp.Regexp
|
nicBlacklistPattern *regexp.Regexp
|
||||||
@@ -115,6 +116,12 @@ func NewNetworkCollector() (Collector, error) {
|
|||||||
[]string{"nic"},
|
[]string{"nic"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
CurrentBandwidth: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(Namespace, subsystem, "current_bandwidth"),
|
||||||
|
"(Network.CurrentBandwidth)",
|
||||||
|
[]string{"nic"},
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
|
||||||
nicWhitelistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *nicWhitelist)),
|
nicWhitelistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *nicWhitelist)),
|
||||||
nicBlacklistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *nicBlacklist)),
|
nicBlacklistPattern: regexp.MustCompile(fmt.Sprintf("^(?:%s)$", *nicBlacklist)),
|
||||||
@@ -150,6 +157,7 @@ type Win32_PerfRawData_Tcpip_NetworkInterface struct {
|
|||||||
PacketsReceivedPerSec uint64
|
PacketsReceivedPerSec uint64
|
||||||
PacketsReceivedUnknown uint64
|
PacketsReceivedUnknown uint64
|
||||||
PacketsSentPerSec uint64
|
PacketsSentPerSec uint64
|
||||||
|
CurrentBandwidth uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *NetworkCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
func (c *NetworkCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
||||||
@@ -238,6 +246,12 @@ func (c *NetworkCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des
|
|||||||
float64(nic.PacketsSentPerSec),
|
float64(nic.PacketsSentPerSec),
|
||||||
name,
|
name,
|
||||||
)
|
)
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.CurrentBandwidth,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
float64(nic.CurrentBandwidth),
|
||||||
|
name,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user