You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<1> A dashboard is accessible at the grafana route listed. You can use this to view metrics across all managed clusters.
216
+
+
217
+
[NOTE]
218
+
====
219
+
A dashboard is accessible at the grafana route listed. You can use this to view metrics across all managed clusters.
220
+
====
217
221
218
-
For more information on observability in {rh-rhacm-title}, see link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.12/html/observability/index[Observability].
222
+
For more information on observability in {rh-rhacm-title}, see link:https://docs.redhat.com/en/documentation/red_hat_advanced_cluster_management_for_kubernetes/2.12/html/observability/index[Observability].
By default, {product-title} does not collect metrics for application workloads. You can configure a cluster to collect workload metrics.
9
+
[role="_abstract"]
10
+
By default, {product-title} does not collect metrics for application workloads. You can configure a cluster to collect workload metrics and create alerts for user workloads.
10
11
11
12
.Prerequisites
12
13
@@ -25,9 +26,10 @@ metadata:
25
26
namespace: openshift-monitoring
26
27
data:
27
28
config.yaml: |
28
-
enableUserWorkload: true <1>
29
+
enableUserWorkload: true
29
30
----
30
-
<1> Set to `true` to enable workload monitoring.
31
+
+
32
+
Set `enableUserWorkload` to `true` to enable workload monitoring.
31
33
32
34
. Apply the `ConfigMap` CR by running the following command:
33
35
+
@@ -48,58 +50,33 @@ metadata:
48
50
name: myapp
49
51
namespace: myns
50
52
spec:
51
-
endpoints: <1>
53
+
endpoints:
52
54
- interval: 30s
53
55
port: ui-http
54
56
scheme: http
55
-
path: /healthz <2>
57
+
path: /healthz
56
58
selector:
57
59
matchLabels:
58
60
app: ui
59
61
----
60
-
<1> Use endpoints to define workload metrics.
61
-
<2> Prometheus scrapes the path `/metrics` by default. You can define a custom path here.
62
+
+
63
+
--
64
+
* `endpoints` specifies the workload metrics endpoints to scrape.
65
+
* `path` specifies a custom scrape path. Prometheus scrapes the `/metrics` path by default.
66
+
--
62
67
63
68
. Apply the `ServiceMonitor` CR by running the following command:
64
69
+
65
70
[source,terminal]
66
71
----
67
72
$ oc apply -f monitoringServiceMonitor.yaml
68
73
----
69
-
70
-
Prometheus scrapes the `/metrics` path by default. However, you can define a custom path.
71
-
The vendor of the application must decide whether to expose the endpoint for scraping, with metrics that they deem relevant.
72
-
73
-
== Creating a workload alert
74
-
75
-
You can enable alerts for user workloads on a cluster.
76
-
77
-
.Procedure
78
-
79
-
. Create a `ConfigMap` CR, and save it as `monitoringConfigMap.yaml`, as in the following example:
80
74
+
81
-
[source,yaml]
82
-
----
83
-
apiVersion: v1
84
-
kind: ConfigMap
85
-
metadata:
86
-
name: cluster-monitoring-config
87
-
namespace: openshift-monitoring
88
-
data:
89
-
config.yaml: |
90
-
enableUserWorkload: true <1>
91
-
# ...
92
-
----
93
-
<1> Set to `true` to enable workload monitoring.
75
+
The vendor of the application must decide whether to expose the endpoint for scraping, with metrics that they deem relevant.
94
76
95
-
. Apply the `ConfigMap` CR by running the following command:
96
-
+
97
-
[source,terminal]
98
-
----
99
-
$ oc apply -f monitoringConfigMap.yaml
100
-
----
77
+
. To enable alerts for user workloads, verify that the `cluster-monitoring-config` ConfigMap has `enableUserWorkload: true` set. If you completed step 1, this is already configured.
101
78
102
-
. Create a YAML file for alerting rules, `monitoringAlertRule.yaml`, as in the following example:
79
+
. Create a YAML file for alerting rules and save it as`monitoringAlertRule.yaml`, as in the following example:
0 commit comments