mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-05 21:00:12 -08:00
Adds metrics and tests for UDP receive and send buffer errors (#1534)
* Adds metrics for UDP receive and send buffer errors Signed-off-by: Phil Porada <philporada@gmail.com>
This commit is contained in:
parent
cfcaeee145
commit
14eafab016
|
@ -1903,6 +1903,12 @@ node_netstat_Udp6_NoPorts 0
|
||||||
# HELP node_netstat_Udp6_OutDatagrams Statistic Udp6OutDatagrams.
|
# HELP node_netstat_Udp6_OutDatagrams Statistic Udp6OutDatagrams.
|
||||||
# TYPE node_netstat_Udp6_OutDatagrams untyped
|
# TYPE node_netstat_Udp6_OutDatagrams untyped
|
||||||
node_netstat_Udp6_OutDatagrams 0
|
node_netstat_Udp6_OutDatagrams 0
|
||||||
|
# HELP node_netstat_Udp6_RcvbufErrors Statistic Udp6RcvbufErrors.
|
||||||
|
# TYPE node_netstat_Udp6_RcvbufErrors untyped
|
||||||
|
node_netstat_Udp6_RcvbufErrors 9
|
||||||
|
# HELP node_netstat_Udp6_SndbufErrors Statistic Udp6SndbufErrors.
|
||||||
|
# TYPE node_netstat_Udp6_SndbufErrors untyped
|
||||||
|
node_netstat_Udp6_SndbufErrors 8
|
||||||
# HELP node_netstat_UdpLite6_InErrors Statistic UdpLite6InErrors.
|
# HELP node_netstat_UdpLite6_InErrors Statistic UdpLite6InErrors.
|
||||||
# TYPE node_netstat_UdpLite6_InErrors untyped
|
# TYPE node_netstat_UdpLite6_InErrors untyped
|
||||||
node_netstat_UdpLite6_InErrors 0
|
node_netstat_UdpLite6_InErrors 0
|
||||||
|
@ -1921,6 +1927,12 @@ node_netstat_Udp_NoPorts 120
|
||||||
# HELP node_netstat_Udp_OutDatagrams Statistic UdpOutDatagrams.
|
# HELP node_netstat_Udp_OutDatagrams Statistic UdpOutDatagrams.
|
||||||
# TYPE node_netstat_Udp_OutDatagrams untyped
|
# TYPE node_netstat_Udp_OutDatagrams untyped
|
||||||
node_netstat_Udp_OutDatagrams 53028
|
node_netstat_Udp_OutDatagrams 53028
|
||||||
|
# HELP node_netstat_Udp_RcvbufErrors Statistic UdpRcvbufErrors.
|
||||||
|
# TYPE node_netstat_Udp_RcvbufErrors untyped
|
||||||
|
node_netstat_Udp_RcvbufErrors 9
|
||||||
|
# HELP node_netstat_Udp_SndbufErrors Statistic UdpSndbufErrors.
|
||||||
|
# TYPE node_netstat_Udp_SndbufErrors untyped
|
||||||
|
node_netstat_Udp_SndbufErrors 8
|
||||||
# HELP node_network_address_assign_type address_assign_type value of /sys/class/net/<iface>.
|
# HELP node_network_address_assign_type address_assign_type value of /sys/class/net/<iface>.
|
||||||
# TYPE node_network_address_assign_type gauge
|
# TYPE node_network_address_assign_type gauge
|
||||||
node_network_address_assign_type{device="eth0"} 3
|
node_network_address_assign_type{device="eth0"} 3
|
||||||
|
|
|
@ -1924,6 +1924,12 @@ node_netstat_Udp6_NoPorts 0
|
||||||
# HELP node_netstat_Udp6_OutDatagrams Statistic Udp6OutDatagrams.
|
# HELP node_netstat_Udp6_OutDatagrams Statistic Udp6OutDatagrams.
|
||||||
# TYPE node_netstat_Udp6_OutDatagrams untyped
|
# TYPE node_netstat_Udp6_OutDatagrams untyped
|
||||||
node_netstat_Udp6_OutDatagrams 0
|
node_netstat_Udp6_OutDatagrams 0
|
||||||
|
# HELP node_netstat_Udp6_RcvbufErrors Statistic Udp6RcvbufErrors.
|
||||||
|
# TYPE node_netstat_Udp6_RcvbufErrors untyped
|
||||||
|
node_netstat_Udp6_RcvbufErrors 9
|
||||||
|
# HELP node_netstat_Udp6_SndbufErrors Statistic Udp6SndbufErrors.
|
||||||
|
# TYPE node_netstat_Udp6_SndbufErrors untyped
|
||||||
|
node_netstat_Udp6_SndbufErrors 8
|
||||||
# HELP node_netstat_UdpLite6_InErrors Statistic UdpLite6InErrors.
|
# HELP node_netstat_UdpLite6_InErrors Statistic UdpLite6InErrors.
|
||||||
# TYPE node_netstat_UdpLite6_InErrors untyped
|
# TYPE node_netstat_UdpLite6_InErrors untyped
|
||||||
node_netstat_UdpLite6_InErrors 0
|
node_netstat_UdpLite6_InErrors 0
|
||||||
|
@ -1942,6 +1948,12 @@ node_netstat_Udp_NoPorts 120
|
||||||
# HELP node_netstat_Udp_OutDatagrams Statistic UdpOutDatagrams.
|
# HELP node_netstat_Udp_OutDatagrams Statistic UdpOutDatagrams.
|
||||||
# TYPE node_netstat_Udp_OutDatagrams untyped
|
# TYPE node_netstat_Udp_OutDatagrams untyped
|
||||||
node_netstat_Udp_OutDatagrams 53028
|
node_netstat_Udp_OutDatagrams 53028
|
||||||
|
# HELP node_netstat_Udp_RcvbufErrors Statistic UdpRcvbufErrors.
|
||||||
|
# TYPE node_netstat_Udp_RcvbufErrors untyped
|
||||||
|
node_netstat_Udp_RcvbufErrors 9
|
||||||
|
# HELP node_netstat_Udp_SndbufErrors Statistic UdpSndbufErrors.
|
||||||
|
# TYPE node_netstat_Udp_SndbufErrors untyped
|
||||||
|
node_netstat_Udp_SndbufErrors 8
|
||||||
# HELP node_network_address_assign_type address_assign_type value of /sys/class/net/<iface>.
|
# HELP node_network_address_assign_type address_assign_type value of /sys/class/net/<iface>.
|
||||||
# TYPE node_network_address_assign_type gauge
|
# TYPE node_network_address_assign_type gauge
|
||||||
node_network_address_assign_type{device="eth0"} 3
|
node_network_address_assign_type{device="eth0"} 3
|
||||||
|
|
|
@ -7,6 +7,6 @@ IcmpMsg: 104 120
|
||||||
Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts InCsumErrors
|
Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts InCsumErrors
|
||||||
Tcp: 1 200 120000 -1 3556 230 341 161 0 57252008 54915039 227 5 1003 0
|
Tcp: 1 200 120000 -1 3556 230 341 161 0 57252008 54915039 227 5 1003 0
|
||||||
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors
|
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors
|
||||||
Udp: 88542 120 0 53028 0 0 0
|
Udp: 88542 120 0 53028 9 8 0
|
||||||
UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors
|
UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors
|
||||||
UdpLite: 0 0 0 0 0 0 0
|
UdpLite: 0 0 0 0 0 0 0
|
||||||
|
|
|
@ -72,8 +72,8 @@ Udp6InDatagrams 0
|
||||||
Udp6NoPorts 0
|
Udp6NoPorts 0
|
||||||
Udp6InErrors 0
|
Udp6InErrors 0
|
||||||
Udp6OutDatagrams 0
|
Udp6OutDatagrams 0
|
||||||
Udp6RcvbufErrors 0
|
Udp6RcvbufErrors 9
|
||||||
Udp6SndbufErrors 0
|
Udp6SndbufErrors 8
|
||||||
Udp6InCsumErrors 0
|
Udp6InCsumErrors 0
|
||||||
Udp6IgnoredMulti 0
|
Udp6IgnoredMulti 0
|
||||||
UdpLite6InDatagrams 0
|
UdpLite6InDatagrams 0
|
||||||
|
|
|
@ -34,7 +34,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
netStatFields = kingpin.Flag("collector.netstat.fields", "Regexp of fields to return for netstat collector.").Default("^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts))$").String()
|
netStatFields = kingpin.Flag("collector.netstat.fields", "Regexp of fields to return for netstat collector.").Default("^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$").String()
|
||||||
)
|
)
|
||||||
|
|
||||||
type netStatCollector struct {
|
type netStatCollector struct {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
|
|
||||||
func TestNetStats(t *testing.T) {
|
func TestNetStats(t *testing.T) {
|
||||||
testNetStats(t, "fixtures/proc/net/netstat")
|
testNetStats(t, "fixtures/proc/net/netstat")
|
||||||
|
testSNMPStats(t, "fixtures/proc/net/snmp")
|
||||||
testSNMP6Stats(t, "fixtures/proc/net/snmp6")
|
testSNMP6Stats(t, "fixtures/proc/net/snmp6")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +45,27 @@ func testNetStats(t *testing.T, fileName string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testSNMPStats(t *testing.T, fileName string) {
|
||||||
|
file, err := os.Open(fileName)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
snmpStats, err := parseNetStats(file, fileName)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if want, got := "9", snmpStats["Udp"]["RcvbufErrors"]; want != got {
|
||||||
|
t.Errorf("want netstat Udp RcvbufErrors %s, got %s", want, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
if want, got := "8", snmpStats["Udp"]["SndbufErrors"]; want != got {
|
||||||
|
t.Errorf("want netstat Udp SndbufErrors %s, got %s", want, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testSNMP6Stats(t *testing.T, fileName string) {
|
func testSNMP6Stats(t *testing.T, fileName string) {
|
||||||
file, err := os.Open(fileName)
|
file, err := os.Open(fileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -63,4 +85,12 @@ func testSNMP6Stats(t *testing.T, fileName string) {
|
||||||
if want, got := "8", snmp6Stats["Icmp6"]["OutMsgs"]; want != got {
|
if want, got := "8", snmp6Stats["Icmp6"]["OutMsgs"]; want != got {
|
||||||
t.Errorf("want netstat ICPM6 OutMsgs %s, got %s", want, got)
|
t.Errorf("want netstat ICPM6 OutMsgs %s, got %s", want, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if want, got := "9", snmp6Stats["Udp6"]["RcvbufErrors"]; want != got {
|
||||||
|
t.Errorf("want netstat Udp6 RcvbufErrors %s, got %s", want, got)
|
||||||
|
}
|
||||||
|
|
||||||
|
if want, got := "8", snmp6Stats["Udp6"]["SndbufErrors"]; want != got {
|
||||||
|
t.Errorf("want netstat Udp6 SndbufErrors %s, got %s", want, got)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue