Skip to content

Commit df96a70

Browse files
committed
OBSDOCS-215-how-to-enable-dedicated-service-monitor
1 parent e51e341 commit df96a70

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/configuring-the-monitoring-stack.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="configuring-a-dedicated-service-monitor_{context}"]
7+
= Configuring a dedicated service monitor
8+
9+
You can configure {product-title} core platform monitoring to use dedicated service monitors to collect metrics for the resource metrics pipeline.
10+
11+
When enabled, a dedicated service monitor exposes two additional metrics from the kubelet endpoint and sets the value of the `honorTimestamps` field to true.
12+
13+
By enabling a dedicated service monitor, you can improve the consistency of Prometheus Adapter-based CPU usage measurements used by, for example, the `oc adm top pod` command or the Horizontal Pod Autoscaler.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/configuring-the-monitoring-stack.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="enabling-a-dedicated-service-monitor_{context}"]
7+
= Enabling a dedicated service monitor
8+
9+
You can configure core platform monitoring to use a dedicated service monitor by configuring the `dedicatedServiceMonitors` key in the `cluster-monitoring-config` `ConfigMap` object in the `openshift-monitoring` namespace.
10+
11+
.Prerequisites
12+
13+
* You have installed the OpenShift CLI (`oc`).
14+
* You have access to the cluster as a user with the `cluster-admin` cluster role.
15+
* You have created the `cluster-monitoring-config` `ConfigMap` object.
16+
17+
.Procedure
18+
19+
. Edit the `cluster-monitoring-config` `ConfigMap` object in the `openshift-monitoring` namespace:
20+
+
21+
[source,terminal]
22+
----
23+
$ oc -n openshift-monitoring edit configmap cluster-monitoring-config
24+
----
25+
26+
. Add an `enabled: true` key-value pair as shown in the following sample:
27+
+
28+
[source,yaml]
29+
----
30+
apiVersion: v1
31+
kind: ConfigMap
32+
metadata:
33+
name: cluster-monitoring-config
34+
namespace: openshift-monitoring
35+
data:
36+
config.yaml: |
37+
k8sPrometheusAdapter:
38+
dedicatedServiceMonitors:
39+
enabled: true <1>
40+
----
41+
<1> Set the value of the `enabled` field to `true` to deploy a dedicated service monitor that exposes the kubelet `/metrics/resource` endpoint.
42+
43+
. Save the file to apply the changes automatically.
44+
+
45+
[WARNING]
46+
====
47+
When you save changes to a `cluster-monitoring-config` config map, the pods and other resources in the `openshift-monitoring` project might be redeployed.
48+
The running monitoring processes in that project might also restart.
49+
====
50+

monitoring/configuring-the-monitoring-stack.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ include::modules/monitoring-setting-the-body-size-limit-for-metrics-scraping.ado
8585

8686
* link:https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config[Prometheus scrape configuration documentation]
8787

88+
// Enabling a dedicated service monitor
89+
include::modules/monitoring-configuring-dedicated-service-monitors.adoc[leveloffset=+1]
90+
include::modules/monitoring-enabling-a-dedicated-service-monitor.adoc[leveloffset=+2]
91+
8892
// Configuring persistent storage
8993
include::modules/monitoring-configuring-persistent-storage.adoc[leveloffset=+1]
9094
include::modules/monitoring-configuring-a-local-persistent-volume-claim.adoc[leveloffset=+2]

0 commit comments

Comments
 (0)