// This is included in the following assemblies: // // networking/k8s_nmstate/k8s-nmstate-about-the-k8s-nmstate-operator.adoc :_mod-docs-content-type: PROCEDURE [id="viewing-stats-collected-kubernetes-nmtate-op_{context}"] = Viewing metrics collected by the Kubernetes NMState Operator The Kubernetes NMState Operator, `kubernetes-nmstate-operator`, can collect metrics from the `kubernetes_nmstate_features_applied` component and expose them as ready-to-use metrics. As a use case for viewing metrics, consider a situation where you created a `NodeNetworkConfigurationPolicy` custom resource and you want to confirm that the policy is active. [NOTE] ==== The `kubernetes_nmstate_features_applied` metrics are not an API and might change between {product-title} versions. ==== In the web console, the Metrics UI includes some predefined CPU, memory, bandwidth, and network packet queries for the selected project. You can run custom Prometheus Query Language (PromQL) queries for CPU, memory, bandwidth, network packet and application metrics for the project. The following example demonstrates a `NodeNetworkConfigurationPolicy` manifest example that is applied to an {product-title} cluster: [source,yaml] ---- # ... interfaces: - name: br1 type: linux-bridge state: up ipv4: enabled: true dhcp: true dhcp-custom-hostname: foo bridge: options: stp: enabled: false port: [] # ... ---- The `NodeNetworkConfigurationPolicy` manifest exposes metrics and makes them available to the Cluster Monitoring Operator (CMO). The following example shows some exposed metrics: [source,terminal] ---- controller_runtime_reconcile_time_seconds_bucket{controller="nodenetworkconfigurationenactment",le="0.005"} 16 controller_runtime_reconcile_time_seconds_bucket{controller="nodenetworkconfigurationenactment",le="0.01"} 16 controller_runtime_reconcile_time_seconds_bucket{controller="nodenetworkconfigurationenactment",le="0.025"} 16 ... # HELP kubernetes_nmstate_features_applied Number of nmstate features applied labeled by its name # TYPE kubernetes_nmstate_features_applied gauge kubernetes_nmstate_features_applied{name="dhcpv4-custom-hostname"} 1 ---- .Prerequisites * You have installed the {oc-first}. * You have logged in to the web console as the administrator and installed the Kubernetes NMState Operator. * You have access to the cluster as a developer or as a user with view permissions for the project that you are viewing metrics for. * You have enabled monitoring for user-defined projects. * You have deployed a service in a user-defined project. * You have created a `NodeNetworkConfigurationPolicy` manifest and applied it to your cluster. include::snippets/snip-unified-perspective-web-console.adoc[] .Procedure . If you want to view the metrics from the *Developer* perspective in the {product-title} web console, complete the following tasks: + .. Click *Observe*. + .. To view the metrics of a specific project, select the project in the *Project:* list. For example, `openshift-nmstate`. + .. Click the *Metrics* tab. + .. To visualize the metrics on the plot, select a query from the *Select query* list or create a custom PromQL query based on the selected query by selecting *Show PromQL*. + [NOTE] ==== You can only run one query at a time with the developer role. ==== . If you want to view the metrics in the {product-title} web console as an administrator, complete the following tasks: + .. Click *Observe* -> *Metrics*. + .. Enter `kubernetes_nmstate_features_applied` in the *Expression* field. + .. Click *Add query* and then *Run queries*. . To explore the visualized metrics, do any of the following tasks: + .. To zoom into the plot and change the time range, do any of the following tasks: + ** To visually select the time range, click and drag on the plot horizontally. ** To select the time range, use the menu which is in the upper left of the console. + .. To reset the time range, select *Reset zoom*. + .. To display the output for all the queries at a specific point in time, hold the mouse cursor on the plot at that point. The query output displays in a pop-up box.