The Single Root I/O Virtualization (SR-IOV) network metrics exporter reads the metrics for SR-IOV virtual functions (VFs) and exposes these VF metrics in Prometheus format. When the SR-IOV network metrics exporter is enabled, you can query the SR-IOV VF metrics by using the OKD web console to monitor the networking activity of the SR-IOV pods.
 
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 SR-IOV VF metrics that the metrics exporter reads and exposes in Prometheus format are described in the following table:
 
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 with the kube-state-metrics 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
The Single Root I/O Virtualization (SR-IOV) network metrics exporter is disabled by default. To enable the metrics exporter, you must set the spec.featureGates.metricsExporter field to true.
 
| 
 | 
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
 
 
The sriov-network-metrics-exporter pod must be 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".