To monitor the networking activity of SR-IOV pods, enable the SR-IOV network metrics exporter. This tool exposes metrics for SR-IOV virtual functions (VFs) in Prometheus format, so that you can query and visualize data through the OKD web console.
When you query the SR-IOV VF metrics by using the web console, the SR-IOV network metrics exporter fetches and returns the VF network statistics along with the name and namespace of the pod that the VF is attached to.
The following table describes the SR-IOV VF metrics that the metrics exporter reads and exposes in Prometheus format:
Table 2. SR-IOV VF metrics
| Metric |
Description |
Example PromQL query to examine the VF metric |
sriov_vf_rx_bytes
|
Received bytes per virtual function. |
sriov_vf_rx_bytes * on (pciAddr,node) group_left(pod,namespace,dev_type) sriov_kubepoddevice
|
sriov_vf_tx_bytes
|
Transmitted bytes per virtual function. |
sriov_vf_tx_bytes * on (pciAddr,node) group_left(pod,namespace,dev_type) sriov_kubepoddevice
|
sriov_vf_rx_packets
|
Received packets per virtual function. |
sriov_vf_rx_packets * on (pciAddr,node) group_left(pod,namespace,dev_type) sriov_kubepoddevice
|
sriov_vf_tx_packets
|
Transmitted packets per virtual function. |
sriov_vf_tx_packets * on (pciAddr,node) group_left(pod,namespace,dev_type) sriov_kubepoddevice
|
sriov_vf_rx_dropped
|
Dropped packets upon receipt per virtual function. |
sriov_vf_rx_dropped * on (pciAddr,node) group_left(pod,namespace,dev_type) sriov_kubepoddevice
|
sriov_vf_tx_dropped
|
Dropped packets during transmission per virtual function. |
sriov_vf_tx_dropped * on (pciAddr,node) group_left(pod,namespace,dev_type) sriov_kubepoddevice
|
sriov_vf_rx_multicast
|
Received multicast packets per virtual function. |
sriov_vf_rx_multicast * on (pciAddr,node) group_left(pod,namespace,dev_type) sriov_kubepoddevice
|
sriov_vf_rx_broadcast
|
Received broadcast packets per virtual function. |
sriov_vf_rx_broadcast * on (pciAddr,node) group_left(pod,namespace,dev_type) sriov_kubepoddevice
|
sriov_kubepoddevice
|
Virtual functions linked to active pods. |
- |
You can also combine these queries by using the kube-state-metrics tool to get more information about the SR-IOV pods. For example, you can use the following query to get the VF network statistics along with the application name from the standard Kubernetes pod label:
(sriov_vf_tx_packets * on (pciAddr,node) group_left(pod,namespace) sriov_kubepoddevice) * on (pod,namespace) group_left (label_app_kubernetes_io_name) kube_pod_labels
Enabling the SR-IOV network metrics exporter
To enable the SR-IOV network metrics exporter, set the spec.featureGates.metricsExporter field to true. Because the exporter is disabled by default, you must explicitly activate this feature gate to start exposing metrics for your SR-IOV devices.
|
|
When the metrics exporter is enabled, the SR-IOV Network Operator deploys the metrics exporter only on nodes with SR-IOV capabilities.
|
Prerequisites
-
You have installed the OpenShift CLI (oc).
-
You have logged in as a user with cluster-admin privileges.
-
You have installed the SR-IOV Network Operator.
Procedure
-
Enable cluster monitoring by running the following command:
$ oc label ns/openshift-sriov-network-operator openshift.io/cluster-monitoring=true
To enable cluster monitoring, you must add the openshift.io/cluster-monitoring=true label in the namespace where you have installed the SR-IOV Network Operator.
-
Set the spec.featureGates.metricsExporter field to true by running the following command:
$ oc patch -n openshift-sriov-network-operator sriovoperatorconfig/default \
--type='merge' -p='{"spec": {"featureGates": {"metricsExporter": true}}}'
Verification
-
Check that the SR-IOV network metrics exporter is enabled by running the following command:
$ oc get pods -n openshift-sriov-network-operator
Example output
NAME READY STATUS RESTARTS AGE
operator-webhook-hzfg4 1/1 Running 0 5d22h
sriov-network-config-daemon-tr54m 1/1 Running 0 5d22h
sriov-network-metrics-exporter-z5d7t 1/1 Running 0 10s
sriov-network-operator-cc6fd88bc-9bsmt 1/1 Running 0 5d22h
Ensure that sriov-network-metrics-exporter pod is in the READY state.
-
Optional: Examine the SR-IOV virtual function (VF) metrics by using the OKD web console. For more information, see "Querying metrics".