Skip to content

Commit

Permalink
Merge pull request #512 from karan/dev_net_metrics
Browse files Browse the repository at this point in the history
Add network interface stats
  • Loading branch information
k8s-ci-robot authored Jan 20, 2021
2 parents 45f70a8 + 2a2bab3 commit 1a7aa65
Show file tree
Hide file tree
Showing 10 changed files with 465 additions and 9 deletions.
55 changes: 55 additions & 0 deletions config/net-cgroup-system-stats-monitor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"net": {
"metricsConfigs": {
"net/rx_bytes": {
"displayName": "net/rx_bytes"
},
"net/rx_packets": {
"displayName": "net/rx_packets"
},
"net/rx_errors": {
"displayName": "net/rx_errors"
},
"net/rx_dropped": {
"displayName": "net/rx_dropped"
},
"net/rx_fifo": {
"displayName": "net/rx_fifo"
},
"net/rx_frame": {
"displayName": "net/rx_frame"
},
"net/rx_compressed": {
"displayName": "net/rx_compressed"
},
"net/rx_multicast": {
"displayName": "net/rx_multicast"
},
"net/tx_bytes": {
"displayName": "net/tx_bytes"
},
"net/tx_packets": {
"displayName": "net/tx_packets"
},
"net/tx_errors": {
"displayName": "net/tx_errors"
},
"net/tx_dropped": {
"displayName": "net/tx_dropped"
},
"net/tx_fifo": {
"displayName": "net/tx_fifo"
},
"net/tx_collisions": {
"displayName": "net/tx_collisions"
},
"net/tx_carrier": {
"displayName": "net/tx_carrier"
},
"net/tx_compressed": {
"displayName": "net/tx_compressed"
}
}
},
"invokeInterval": "120s"
}
2 changes: 1 addition & 1 deletion config/systemd/node-problem-detector-metric-only.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ExecStart=/home/kubernetes/bin/node-problem-detector --v=2 --logtostderr --enabl
--exporter.stackdriver=/home/kubernetes/node-problem-detector/config/exporter/stackdriver-exporter.json \
--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 \
--config.custom-plugin-monitor=/home/kubernetes/node-problem-detector/config/kernel-monitor-counter.json,/home/kubernetes/node-problem-detector/config/systemd-monitor-counter.json \
--config.system-stats-monitor=/home/kubernetes/node-problem-detector/config/system-stats-monitor.json
--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

[Install]
WantedBy=multi-user.target
16 changes: 16 additions & 0 deletions pkg/exporters/stackdriver/stackdriver_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ var NPDMetricToSDMetric = map[metrics.MetricID]string{
metrics.SystemProcsRunning: "kubernetes.io/internal/node/guest/system/procs_running",
metrics.SystemProcsBlocked: "kubernetes.io/internal/node/guest/system/procs_blocked",
metrics.SystemInterruptsTotal: "kubernetes.io/internal/node/guest/system/interrupts_total",
metrics.NetDevRxBytes: "kubernetes.io/internal/node/guest/net/rx_bytes",
metrics.NetDevRxPackets: "kubernetes.io/internal/node/guest/net/rx_packets",
metrics.NetDevRxErrors: "kubernetes.io/internal/node/guest/net/rx_errors",
metrics.NetDevRxDropped: "kubernetes.io/internal/node/guest/net/rx_dropped",
metrics.NetDevRxFifo: "kubernetes.io/internal/node/guest/net/rx_fifo",
metrics.NetDevRxFrame: "kubernetes.io/internal/node/guest/net/rx_frame",
metrics.NetDevRxCompressed: "kubernetes.io/internal/node/guest/net/rx_compressed",
metrics.NetDevRxMulticast: "kubernetes.io/internal/node/guest/net/rx_multicast",
metrics.NetDevTxBytes: "kubernetes.io/internal/node/guest/net/tx_bytes",
metrics.NetDevTxPackets: "kubernetes.io/internal/node/guest/net/tx_packets",
metrics.NetDevTxErrors: "kubernetes.io/internal/node/guest/net/tx_errors",
metrics.NetDevTxDropped: "kubernetes.io/internal/node/guest/net/tx_dropped",
metrics.NetDevTxFifo: "kubernetes.io/internal/node/guest/net/tx_fifo",
metrics.NetDevTxCollisions: "kubernetes.io/internal/node/guest/net/tx_collisions",
metrics.NetDevTxCarrier: "kubernetes.io/internal/node/guest/net/tx_carrier",
metrics.NetDevTxCompressed: "kubernetes.io/internal/node/guest/net/tx_compressed",
}

func getMetricTypeConversionFunction(customMetricPrefix string) func(*view.View) string {
Expand Down
33 changes: 28 additions & 5 deletions pkg/systemstatsmonitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,41 @@ Below metrics are collected from `memory` component:
* `memory_unevictable_used`: [Unevictable memory][/proc doc] usage, in Bytes.
* `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.

### OS features
### OS features

The guest OS features such as KTD kernel, GPU support are collected. Below are the OS
The guest OS features such as KTD kernel, GPU support are collected. Below are the OS
features collected:

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

And an option:
`knownModulesConfigPath`: The path to the file that contains the known modules(default
modules) can be set. By default, the path is set to `known-modules.json`
`knownModulesConfigPath`: The path to the file that contains the known modules(default
modules) can be set. By default, the path is set to `known-modules.json`

### IP Stats (Net Dev)

Below metrics are collected from `net` component:

* `net/rx_bytes`: Cumulative count of bytes received.
* `net/rx_packets`: Cumulative count of packets received.
* `net/rx_errors`: Cumulative count of receive errors encountered.
* `net/rx_dropped`: Cumulative count of packets dropped while receiving.
* `net/rx_fifo`: Cumulative count of FIFO buffer errors.
* `net/rx_frame`: Cumulative count of packet framing errors.
* `net/rx_compressed`: Cumulative count of compressed packets received by the device driver.
* `net/rx_multicast`: Cumulative count of multicast frames received by the device driver.
* `net/tx_bytes`: Cumulative count of bytes transmitted.
* `net/tx_packets`: Cumulative count of packets transmitted.
* `net/tx_errors`: Cumulative count of transmit errors encountered.
* `net/tx_dropped`: Cumulative count of packets dropped while transmitting.
* `net/tx_fifo`: Cumulative count of FIFO buffer errors.
* `net/tx_collisions`: Cumulative count of collisions detected on the interface.
* `net/tx_carrier`: Cumulative count of carrier losses detected by the device driver.
* `net/tx_compressed`: Cumulative count of compressed packets transmitted by the device driver.

All of the above have `interface_name` label for the net interface.
3 changes: 3 additions & 0 deletions pkg/systemstatsmonitor/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ const osVersionLabel = "os_version"

// osVersionLabel labels the kernel version
const kernelVersionLabel = "kernel_version"

// interfaceNameLabel labels the network interface name
const interfaceNameLabel = "interface_name"
Loading

0 comments on commit 1a7aa65

Please sign in to comment.