|
| 1 | +// This is included in the following assemblies: |
| 2 | +// |
| 3 | +// networking/k8s_nmstate/k8s-nmstate-about-the-k8s-nmstate-operator.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="viewing-stats-collected-kubernetes-nmtate-op_{context}"] |
| 7 | += Viewing metrics collected by the Kubernetes NMState Operator |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +[NOTE] |
| 12 | +==== |
| 13 | +The `kubernetes_nmstate_features_applied` metrics are not an API and might change between {product-title} versions. |
| 14 | +==== |
| 15 | + |
| 16 | +In the *Developer* and *Administrator* perspectives, 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. |
| 17 | + |
| 18 | +The following example demonstrates a `NodeNetworkConfigurationPolicy` manifest example that is applied to an {product-title} cluster: |
| 19 | + |
| 20 | +[source,yaml] |
| 21 | +---- |
| 22 | +# ... |
| 23 | +interfaces: |
| 24 | + - name: br1 |
| 25 | + type: linux-bridge |
| 26 | + state: up |
| 27 | + ipv4: |
| 28 | + enabled: true |
| 29 | + dhcp: true |
| 30 | + dhcp-custom-hostname: foo |
| 31 | + bridge: |
| 32 | + options: |
| 33 | + stp: |
| 34 | + enabled: false |
| 35 | + port: [] |
| 36 | +# ... |
| 37 | +---- |
| 38 | + |
| 39 | +The `NodeNetworkConfigurationPolicy` manifest exposes metrics and makes them available to the Cluster Monitoring Operator (CMO). The following example shows some exposed metrics: |
| 40 | + |
| 41 | +[source,terminal] |
| 42 | +---- |
| 43 | +controller_runtime_reconcile_time_seconds_bucket{controller="nodenetworkconfigurationenactment",le="0.005"} 16 |
| 44 | +controller_runtime_reconcile_time_seconds_bucket{controller="nodenetworkconfigurationenactment",le="0.01"} 16 |
| 45 | +controller_runtime_reconcile_time_seconds_bucket{controller="nodenetworkconfigurationenactment",le="0.025"} 16 |
| 46 | +... |
| 47 | +# HELP kubernetes_nmstate_features_applied Number of nmstate features applied labeled by its name |
| 48 | +# TYPE kubernetes_nmstate_features_applied gauge |
| 49 | +kubernetes_nmstate_features_applied{name="dhcpv4-custom-hostname"} 1 |
| 50 | +---- |
| 51 | + |
| 52 | +.Prerequisites |
| 53 | + |
| 54 | +* You have installed the {oc-first}. |
| 55 | +* You have logged in to the web console as the administrator and installed the Kubernetes NMState Operator. |
| 56 | +* 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. |
| 57 | +* You have enabled monitoring for user-defined projects. |
| 58 | +* You have deployed a service in a user-defined project. |
| 59 | +* You have created a `NodeNetworkConfigurationPolicy` manifest and applied it to your cluster. |
| 60 | +
|
| 61 | +.Procedure |
| 62 | + |
| 63 | +. If you want to view the metrics from the *Developer* perspective in the {product-title} web console, complete the following tasks: |
| 64 | ++ |
| 65 | +.. Click *Observe*. |
| 66 | ++ |
| 67 | +.. To view the metrics of a specific project, select the project in the *Project:* list. For example, `openshift-nmstate`. |
| 68 | ++ |
| 69 | +.. Click the *Metrics* tab. |
| 70 | ++ |
| 71 | +.. 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*. |
| 72 | ++ |
| 73 | +[NOTE] |
| 74 | +==== |
| 75 | +In the *Developer* perspective, you can only run one query at a time. |
| 76 | +==== |
| 77 | + |
| 78 | +. If you want to view the metrics from the *Administrator* perspective in the {product-title} web console, complete the following tasks: |
| 79 | ++ |
| 80 | +.. Click *Observe* -> *Metrics*. |
| 81 | ++ |
| 82 | +.. Enter `kubernetes_nmstate_features_applied` in the *Expression* field. |
| 83 | ++ |
| 84 | +.. Click *Add query* and then *Run queries*. |
| 85 | + |
| 86 | +. To explore the visualized metrics, do any of the following tasks: |
| 87 | ++ |
| 88 | +.. To zoom into the plot and change the time range, do any of the following tasks: |
| 89 | ++ |
| 90 | +** To visually select the time range, click and drag on the plot horizontally. |
| 91 | +** To select the time range, use the menu which is in the upper left of the console. |
| 92 | ++ |
| 93 | +.. To reset the time range, select *Reset zoom*. |
| 94 | ++ |
| 95 | +.. 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. |
0 commit comments