mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 20:36:21 +01:00
netclass_linux: remove varying labels from the 'up' metric (#1243)
* netclass_linux: remove varying labels from the 'up' metric This moves the variable label values such as 'operstate' out of the 'network_up' metric and into a separate metric called '_info'. This allows the 'up' metric to remain continous over state changes. Fixes #1236 Signed-off-by: Paul Gier <pgier@redhat.com>
This commit is contained in:
parent
6ea0aa73e4
commit
e0d6d11859
@ -5,6 +5,7 @@
|
|||||||
* Renamed `interface` label to `device` in netclass collector for consistency with
|
* Renamed `interface` label to `device` in netclass collector for consistency with
|
||||||
other network metrics #1224
|
other network metrics #1224
|
||||||
* The cpufreq metrics now separate the `cpufreq` and `scaling` data based on what the driver provides. #1248
|
* The cpufreq metrics now separate the `cpufreq` and `scaling` data based on what the driver provides. #1248
|
||||||
|
* The labels for the network_up metric have changed, see issue #1236
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|
||||||
@ -15,6 +16,7 @@
|
|||||||
* [CHANGE] Add a limit to the number of in-flight requests #1166
|
* [CHANGE] Add a limit to the number of in-flight requests #1166
|
||||||
* [CHANGE] Add separate cpufreq and scaling metrics #1248
|
* [CHANGE] Add separate cpufreq and scaling metrics #1248
|
||||||
* [ENHANCEMENT] Add Infiniband counters #1120
|
* [ENHANCEMENT] Add Infiniband counters #1120
|
||||||
|
* [ENHANCEMENT] Move network_up labels into new metric network_info #1236
|
||||||
* [FEATURE] Add a flag to disable exporter metrics #1148
|
* [FEATURE] Add a flag to disable exporter metrics #1148
|
||||||
* [FEATURE] Add kstat-based Solaris metrics for boottime, cpu and zfs collectors #1197
|
* [FEATURE] Add kstat-based Solaris metrics for boottime, cpu and zfs collectors #1197
|
||||||
* [FEATURE] Add uname collector for FreeBSD #1239
|
* [FEATURE] Add uname collector for FreeBSD #1239
|
||||||
|
@ -1835,6 +1835,9 @@ node_network_iface_link{interface="eth0"} 2
|
|||||||
# HELP node_network_iface_link_mode iface_link_mode value of /sys/class/net/<iface>.
|
# HELP node_network_iface_link_mode iface_link_mode value of /sys/class/net/<iface>.
|
||||||
# TYPE node_network_iface_link_mode gauge
|
# TYPE node_network_iface_link_mode gauge
|
||||||
node_network_iface_link_mode{interface="eth0"} 1
|
node_network_iface_link_mode{interface="eth0"} 1
|
||||||
|
# HELP node_network_info Non-numeric data from /sys/class/net/<iface>, value is always 1.
|
||||||
|
# TYPE node_network_info gauge
|
||||||
|
node_network_info{address="01:01:01:01:01:01",broadcast="ff:ff:ff:ff:ff:ff",device="eth0",duplex="full",ifalias="",operstate="up"} 1
|
||||||
# HELP node_network_mtu_bytes mtu_bytes value of /sys/class/net/<iface>.
|
# HELP node_network_mtu_bytes mtu_bytes value of /sys/class/net/<iface>.
|
||||||
# TYPE node_network_mtu_bytes gauge
|
# TYPE node_network_mtu_bytes gauge
|
||||||
node_network_mtu_bytes{interface="eth0"} 1500
|
node_network_mtu_bytes{interface="eth0"} 1500
|
||||||
@ -2045,9 +2048,9 @@ node_network_transmit_packets_total{device="💩0"} 304261
|
|||||||
# HELP node_network_transmit_queue_length transmit_queue_length value of /sys/class/net/<iface>.
|
# HELP node_network_transmit_queue_length transmit_queue_length value of /sys/class/net/<iface>.
|
||||||
# TYPE node_network_transmit_queue_length gauge
|
# TYPE node_network_transmit_queue_length gauge
|
||||||
node_network_transmit_queue_length{interface="eth0"} 1000
|
node_network_transmit_queue_length{interface="eth0"} 1000
|
||||||
# HELP node_network_up Valid operstate for interface.
|
# HELP node_network_up Value is 1 if operstate is 'up', 0 otherwise.
|
||||||
# TYPE node_network_up gauge
|
# TYPE node_network_up gauge
|
||||||
node_network_up{address="01:01:01:01:01:01",broadcast="ff:ff:ff:ff:ff:ff",duplex="full",ifalias="",interface="eth0",operstate="up"} 1
|
node_network_up{device="eth0"} 1
|
||||||
# HELP node_nf_conntrack_entries Number of currently allocated flow entries for connection tracking.
|
# HELP node_nf_conntrack_entries Number of currently allocated flow entries for connection tracking.
|
||||||
# TYPE node_nf_conntrack_entries gauge
|
# TYPE node_nf_conntrack_entries gauge
|
||||||
node_nf_conntrack_entries 123
|
node_nf_conntrack_entries 123
|
||||||
|
@ -1835,6 +1835,9 @@ node_network_iface_link{device="eth0"} 2
|
|||||||
# HELP node_network_iface_link_mode iface_link_mode value of /sys/class/net/<iface>.
|
# HELP node_network_iface_link_mode iface_link_mode value of /sys/class/net/<iface>.
|
||||||
# TYPE node_network_iface_link_mode gauge
|
# TYPE node_network_iface_link_mode gauge
|
||||||
node_network_iface_link_mode{device="eth0"} 1
|
node_network_iface_link_mode{device="eth0"} 1
|
||||||
|
# HELP node_network_info Non-numeric data from /sys/class/net/<iface>, value is always 1.
|
||||||
|
# TYPE node_network_info gauge
|
||||||
|
node_network_info{address="01:01:01:01:01:01",broadcast="ff:ff:ff:ff:ff:ff",device="eth0",duplex="full",ifalias="",operstate="up"} 1
|
||||||
# HELP node_network_mtu_bytes mtu_bytes value of /sys/class/net/<iface>.
|
# HELP node_network_mtu_bytes mtu_bytes value of /sys/class/net/<iface>.
|
||||||
# TYPE node_network_mtu_bytes gauge
|
# TYPE node_network_mtu_bytes gauge
|
||||||
node_network_mtu_bytes{device="eth0"} 1500
|
node_network_mtu_bytes{device="eth0"} 1500
|
||||||
@ -2045,9 +2048,9 @@ node_network_transmit_packets_total{device="💩0"} 304261
|
|||||||
# HELP node_network_transmit_queue_length transmit_queue_length value of /sys/class/net/<iface>.
|
# HELP node_network_transmit_queue_length transmit_queue_length value of /sys/class/net/<iface>.
|
||||||
# TYPE node_network_transmit_queue_length gauge
|
# TYPE node_network_transmit_queue_length gauge
|
||||||
node_network_transmit_queue_length{device="eth0"} 1000
|
node_network_transmit_queue_length{device="eth0"} 1000
|
||||||
# HELP node_network_up Valid operstate for device.
|
# HELP node_network_up Value is 1 if operstate is 'up', 0 otherwise.
|
||||||
# TYPE node_network_up gauge
|
# TYPE node_network_up gauge
|
||||||
node_network_up{address="01:01:01:01:01:01",broadcast="ff:ff:ff:ff:ff:ff",device="eth0",duplex="full",ifalias="",operstate="up"} 1
|
node_network_up{device="eth0"} 1
|
||||||
# HELP node_nf_conntrack_entries Number of currently allocated flow entries for connection tracking.
|
# HELP node_nf_conntrack_entries Number of currently allocated flow entries for connection tracking.
|
||||||
# TYPE node_nf_conntrack_entries gauge
|
# TYPE node_nf_conntrack_entries gauge
|
||||||
node_nf_conntrack_entries 123
|
node_nf_conntrack_entries 123
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/prometheus/procfs/sysfs"
|
"github.com/prometheus/procfs/sysfs"
|
||||||
"gopkg.in/alecthomas/kingpin.v2"
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -57,8 +57,8 @@ func (c *netClassCollector) Update(ch chan<- prometheus.Metric) error {
|
|||||||
for _, ifaceInfo := range netClass {
|
for _, ifaceInfo := range netClass {
|
||||||
upDesc := prometheus.NewDesc(
|
upDesc := prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(namespace, c.subsystem, "up"),
|
prometheus.BuildFQName(namespace, c.subsystem, "up"),
|
||||||
"Valid operstate for device.",
|
"Value is 1 if operstate is 'up', 0 otherwise.",
|
||||||
[]string{"device", "address", "broadcast", "duplex", "operstate", "ifalias"},
|
[]string{"device"},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
upValue := 0.0
|
upValue := 0.0
|
||||||
@ -66,7 +66,17 @@ func (c *netClassCollector) Update(ch chan<- prometheus.Metric) error {
|
|||||||
upValue = 1.0
|
upValue = 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(upDesc, prometheus.GaugeValue, upValue, ifaceInfo.Name, ifaceInfo.Address, ifaceInfo.Broadcast, ifaceInfo.Duplex, ifaceInfo.OperState, ifaceInfo.IfAlias)
|
ch <- prometheus.MustNewConstMetric(upDesc, prometheus.GaugeValue, upValue, ifaceInfo.Name)
|
||||||
|
|
||||||
|
infoDesc := prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(namespace, c.subsystem, "info"),
|
||||||
|
"Non-numeric data from /sys/class/net/<iface>, value is always 1.",
|
||||||
|
[]string{"device", "address", "broadcast", "duplex", "operstate", "ifalias"},
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
infoValue := 1.0
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(infoDesc, prometheus.GaugeValue, infoValue, ifaceInfo.Name, ifaceInfo.Address, ifaceInfo.Broadcast, ifaceInfo.Duplex, ifaceInfo.OperState, ifaceInfo.IfAlias)
|
||||||
|
|
||||||
if ifaceInfo.AddrAssignType != nil {
|
if ifaceInfo.AddrAssignType != nil {
|
||||||
pushMetric(ch, c.subsystem, "address_assign_type", *ifaceInfo.AddrAssignType, ifaceInfo.Name, prometheus.GaugeValue)
|
pushMetric(ch, c.subsystem, "address_assign_type", *ifaceInfo.AddrAssignType, ifaceInfo.Name, prometheus.GaugeValue)
|
||||||
|
Loading…
Reference in New Issue
Block a user