From ddc1fc596a530631a50805061db6a3c19abd3369 Mon Sep 17 00:00:00 2001 From: Eliska Romanova Date: Thu, 27 Mar 2025 09:04:19 +0100 Subject: [PATCH] OBSDOCS-1326: Improve 'troubleshooting monitoring issues: Investigating why user-defined project metrics are unavailable' - post OCPBUGS-39126 --- ...hy-user-defined-metrics-are-unavailable.adoc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/monitoring-investigating-why-user-defined-metrics-are-unavailable.adoc b/modules/monitoring-investigating-why-user-defined-metrics-are-unavailable.adoc index af462e9efe0d..4824cec3c2d4 100644 --- a/modules/monitoring-investigating-why-user-defined-metrics-are-unavailable.adoc +++ b/modules/monitoring-investigating-why-user-defined-metrics-are-unavailable.adoc @@ -23,7 +23,7 @@ endif::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[] .Procedure -. Ensure that your project is not excluded from user workload monitoring. The following examples use the `ns1` project. +. Ensure that your project and resources are not excluded from user workload monitoring. The following examples use the `ns1` project. .. Verify that the project _does not_ have the `openshift.io/user-monitoring=false` label attached: + @@ -37,6 +37,13 @@ $ oc get namespace ns1 --show-labels | grep 'openshift.io/user-monitoring=false' The default label set for user workload projects is `openshift.io/user-monitoring=true`. However, the label is not visible unless you manually apply it. ==== +.. Verify that the `ServiceMonitor` and `PodMonitor` resources _do not_ have the `openshift.io/user-monitoring=false` label attached. The following example checks the `prometheus-example-monitor` service monitor. ++ +[source,terminal] +---- +$ oc -n ns1 get servicemonitor prometheus-example-monitor --show-labels | grep 'openshift.io/user-monitoring=false' +---- + .. If the label is attached, remove the label: + .Example of removing the label from the project @@ -45,6 +52,12 @@ The default label set for user workload projects is `openshift.io/user-monitorin $ oc label namespace ns1 'openshift.io/user-monitoring-' ---- + +.Example of removing the label from the resource +[source,terminal] +---- +$ oc -n ns1 label servicemonitor prometheus-example-monitor 'openshift.io/user-monitoring-' +---- ++ .Example output [source,terminal] ---- @@ -66,7 +79,7 @@ $ oc -n ns1 get service prometheus-example-app -o yaml app: prometheus-example-app ---- + -.. Check that the `matchLabels` definition in the `ServiceMonitor` resource configuration matches the label output in the preceding step. +.. Check that the `matchLabels` definition in the `ServiceMonitor` resource configuration matches the label output in the previous step. + [source,terminal] ----