Skip to content

Commit 1a7aa65

Browse files
authored
Merge pull request #512 from karan/dev_net_metrics
Add network interface stats
2 parents 45f70a8 + 2a2bab3 commit 1a7aa65

File tree

10 files changed

+465
-9
lines changed

10 files changed

+465
-9
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"net": {
3+
"metricsConfigs": {
4+
"net/rx_bytes": {
5+
"displayName": "net/rx_bytes"
6+
},
7+
"net/rx_packets": {
8+
"displayName": "net/rx_packets"
9+
},
10+
"net/rx_errors": {
11+
"displayName": "net/rx_errors"
12+
},
13+
"net/rx_dropped": {
14+
"displayName": "net/rx_dropped"
15+
},
16+
"net/rx_fifo": {
17+
"displayName": "net/rx_fifo"
18+
},
19+
"net/rx_frame": {
20+
"displayName": "net/rx_frame"
21+
},
22+
"net/rx_compressed": {
23+
"displayName": "net/rx_compressed"
24+
},
25+
"net/rx_multicast": {
26+
"displayName": "net/rx_multicast"
27+
},
28+
"net/tx_bytes": {
29+
"displayName": "net/tx_bytes"
30+
},
31+
"net/tx_packets": {
32+
"displayName": "net/tx_packets"
33+
},
34+
"net/tx_errors": {
35+
"displayName": "net/tx_errors"
36+
},
37+
"net/tx_dropped": {
38+
"displayName": "net/tx_dropped"
39+
},
40+
"net/tx_fifo": {
41+
"displayName": "net/tx_fifo"
42+
},
43+
"net/tx_collisions": {
44+
"displayName": "net/tx_collisions"
45+
},
46+
"net/tx_carrier": {
47+
"displayName": "net/tx_carrier"
48+
},
49+
"net/tx_compressed": {
50+
"displayName": "net/tx_compressed"
51+
}
52+
}
53+
},
54+
"invokeInterval": "120s"
55+
}

config/systemd/node-problem-detector-metric-only.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ExecStart=/home/kubernetes/bin/node-problem-detector --v=2 --logtostderr --enabl
1010
--exporter.stackdriver=/home/kubernetes/node-problem-detector/config/exporter/stackdriver-exporter.json \
1111
--config.system-log-monitor=/home/kubernetes/node-problem-detector/config/kernel-monitor.json,/home/kubernetes/node-problem-detector/config/docker-monitor.json,/home/kubernetes/node-problem-detector/config/systemd-monitor.json \
1212
--config.custom-plugin-monitor=/home/kubernetes/node-problem-detector/config/kernel-monitor-counter.json,/home/kubernetes/node-problem-detector/config/systemd-monitor-counter.json \
13-
--config.system-stats-monitor=/home/kubernetes/node-problem-detector/config/system-stats-monitor.json
13+
--config.system-stats-monitor=/home/kubernetes/node-problem-detector/config/system-stats-monitor.json,/home/kubernetes/node-problem-detector/config/net-cgroup-system-stats-monitor.json
1414

1515
[Install]
1616
WantedBy=multi-user.target

pkg/exporters/stackdriver/stackdriver_exporter.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ var NPDMetricToSDMetric = map[metrics.MetricID]string{
7373
metrics.SystemProcsRunning: "kubernetes.io/internal/node/guest/system/procs_running",
7474
metrics.SystemProcsBlocked: "kubernetes.io/internal/node/guest/system/procs_blocked",
7575
metrics.SystemInterruptsTotal: "kubernetes.io/internal/node/guest/system/interrupts_total",
76+
metrics.NetDevRxBytes: "kubernetes.io/internal/node/guest/net/rx_bytes",
77+
metrics.NetDevRxPackets: "kubernetes.io/internal/node/guest/net/rx_packets",
78+
metrics.NetDevRxErrors: "kubernetes.io/internal/node/guest/net/rx_errors",
79+
metrics.NetDevRxDropped: "kubernetes.io/internal/node/guest/net/rx_dropped",
80+
metrics.NetDevRxFifo: "kubernetes.io/internal/node/guest/net/rx_fifo",
81+
metrics.NetDevRxFrame: "kubernetes.io/internal/node/guest/net/rx_frame",
82+
metrics.NetDevRxCompressed: "kubernetes.io/internal/node/guest/net/rx_compressed",
83+
metrics.NetDevRxMulticast: "kubernetes.io/internal/node/guest/net/rx_multicast",
84+
metrics.NetDevTxBytes: "kubernetes.io/internal/node/guest/net/tx_bytes",
85+
metrics.NetDevTxPackets: "kubernetes.io/internal/node/guest/net/tx_packets",
86+
metrics.NetDevTxErrors: "kubernetes.io/internal/node/guest/net/tx_errors",
87+
metrics.NetDevTxDropped: "kubernetes.io/internal/node/guest/net/tx_dropped",
88+
metrics.NetDevTxFifo: "kubernetes.io/internal/node/guest/net/tx_fifo",
89+
metrics.NetDevTxCollisions: "kubernetes.io/internal/node/guest/net/tx_collisions",
90+
metrics.NetDevTxCarrier: "kubernetes.io/internal/node/guest/net/tx_carrier",
91+
metrics.NetDevTxCompressed: "kubernetes.io/internal/node/guest/net/tx_compressed",
7692
}
7793

7894
func getMetricTypeConversionFunction(customMetricPrefix string) func(*view.View) string {

pkg/systemstatsmonitor/README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,41 @@ Below metrics are collected from `memory` component:
7777
* `memory_unevictable_used`: [Unevictable memory][/proc doc] usage, in Bytes.
7878
* `memory_dirty_used`: Dirty pages usage, in Bytes. Memory usage state is reported under the `state` metric label (e.g. `dirty`, `writeback`). `dirty` means the memory is waiting to be written back to disk, and `writeback` means the memory is actively being written back to disk.
7979

80-
### OS features
80+
### OS features
8181

82-
The guest OS features such as KTD kernel, GPU support are collected. Below are the OS
82+
The guest OS features such as KTD kernel, GPU support are collected. Below are the OS
8383
features collected:
8484

8585
* `KTD`: Enabled, if KTD feature is enabled on OS
8686
* `UnifiedCgroupHierarchy`: Enabled, if Unified hierarchy is enabled on OS.
8787
* `KernelModuleIntegrity`: Enabled, if load pin security is enabled and modules are signed.
8888
* `GPUSupport`: Enabled, if OS has GPU drivers installed like nvidia.
8989
* `UnknownModules`: Enabled, if the OS has third party kernel modules installed.
90-
UnknownModules are derived from the /proc/modules compared with the known-modules.json.
90+
UnknownModules are derived from the /proc/modules compared with the known-modules.json.
9191

9292
And an option:
93-
`knownModulesConfigPath`: The path to the file that contains the known modules(default
94-
modules) can be set. By default, the path is set to `known-modules.json`
93+
`knownModulesConfigPath`: The path to the file that contains the known modules(default
94+
modules) can be set. By default, the path is set to `known-modules.json`
95+
96+
### IP Stats (Net Dev)
97+
98+
Below metrics are collected from `net` component:
99+
100+
* `net/rx_bytes`: Cumulative count of bytes received.
101+
* `net/rx_packets`: Cumulative count of packets received.
102+
* `net/rx_errors`: Cumulative count of receive errors encountered.
103+
* `net/rx_dropped`: Cumulative count of packets dropped while receiving.
104+
* `net/rx_fifo`: Cumulative count of FIFO buffer errors.
105+
* `net/rx_frame`: Cumulative count of packet framing errors.
106+
* `net/rx_compressed`: Cumulative count of compressed packets received by the device driver.
107+
* `net/rx_multicast`: Cumulative count of multicast frames received by the device driver.
108+
* `net/tx_bytes`: Cumulative count of bytes transmitted.
109+
* `net/tx_packets`: Cumulative count of packets transmitted.
110+
* `net/tx_errors`: Cumulative count of transmit errors encountered.
111+
* `net/tx_dropped`: Cumulative count of packets dropped while transmitting.
112+
* `net/tx_fifo`: Cumulative count of FIFO buffer errors.
113+
* `net/tx_collisions`: Cumulative count of collisions detected on the interface.
114+
* `net/tx_carrier`: Cumulative count of carrier losses detected by the device driver.
115+
* `net/tx_compressed`: Cumulative count of compressed packets transmitted by the device driver.
116+
117+
All of the above have `interface_name` label for the net interface.

pkg/systemstatsmonitor/labels.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ const osVersionLabel = "os_version"
4242

4343
// osVersionLabel labels the kernel version
4444
const kernelVersionLabel = "kernel_version"
45+
46+
// interfaceNameLabel labels the network interface name
47+
const interfaceNameLabel = "interface_name"

0 commit comments

Comments
 (0)