-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RHDEVDOCS-3924 - document option to add cluster id to off-cluster int…
…egrations
- Loading branch information
Showing
3 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
modules/monitoring-adding-cluster-id-labels-to-metrics.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * monitoring/configuring-the-monitoring-stack.adoc | ||
|
||
:_content-type: CONCEPT | ||
[id="adding-cluster-id-labels-to-metrics_{context}"] | ||
= Adding cluster ID labels to metrics | ||
|
||
If you manage multiple {product-title} clusters and use the remote write feature to send metrics data from these clusters to an external storage location, you can add cluster ID labels to identify the metrics data coming from different clusters. | ||
You can then query these labels to identify the source cluster for a metric and distinguish that data from similar metrics data sent by other clusters. | ||
|
||
This way, if you manage many clusters for multiple customers and send metrics data to a single centralized storage system, you can use cluster ID labels to query metrics for a particular cluster or customer. | ||
|
||
Creating and using cluster ID labels involves three general steps: | ||
|
||
* Configuring the write relabel settings for remote write storage. | ||
* Adding cluster ID labels to the metrics. | ||
* Querying these labels to identify the source cluster or customer for a metric. |
95 changes: 95 additions & 0 deletions
95
modules/monitoring-creating-cluster-id-labels-for-metrics.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * monitoring/configuring-the-monitoring-stack.adoc | ||
|
||
:_content-type: PROCEDURE | ||
[id="creating-cluster-id-labels-for-metrics_{context}"] | ||
= Creating cluster ID labels for metrics | ||
|
||
You can create cluster ID labels for metrics for default platform monitoring and for user workload monitoring. | ||
|
||
For default platform monitoring, you add cluster ID labels for metrics in the `write_relabel` settings for remote write storage in the `cluster-monitoring-config` config map in the `openshift-monitoring` namespace. | ||
|
||
For user workload monitoring, you edit the settings in the `user-workload-monitoring-config` config map in the `openshift-user-workload-monitoring` namespace. | ||
|
||
.Prerequsites | ||
|
||
* You have installed the OpenShift CLI (`oc`). | ||
* You have configured remote write storage. | ||
* *If you are configuring default platform monitoring components:* | ||
** You have access to the cluster as a user with the `cluster-admin` role. | ||
** You have created the `cluster-monitoring-config` `ConfigMap` object. | ||
* *If you are configuring components that monitor user-defined projects:* | ||
** You have access to the cluster as a user with the `cluster-admin` role or as a user with the `user-workload-monitoring-config-edit` role in the `openshift-user-workload-monitoring` project. | ||
** You have created the `user-workload-monitoring-config` `ConfigMap` object. | ||
.Procedure | ||
|
||
. Edit the `cluster-monitoring-config` `ConfigMap` object in the `openshift-monitoring` project: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ oc -n openshift-monitoring edit configmap cluster-monitoring-config | ||
---- | ||
+ | ||
[NOTE] | ||
==== | ||
If you configure cluster ID labels for metrics for the Prometheus instance that monitors user-defined projects, edit the `user-workload-monitoring-config` config map in the `openshift-user-workload-monitoring` namespace. | ||
Note that the Prometheus component is called `prometheus` in this config map and not `prometheusK8s`, which is the name used in the `cluster-monitoring-config` config map. | ||
==== | ||
|
||
. In the `writeRelabelConfigs:` section under `data/config.yaml/prometheusK8s/remoteWrite`, add cluster ID relabel configuration values: | ||
+ | ||
[source,yaml] | ||
---- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: cluster-monitoring-config | ||
namespace: openshift-monitoring | ||
data: | ||
config.yaml: | | ||
prometheusK8s: | ||
remoteWrite: | ||
- url: "https://remote-write-endpoint.example.com" | ||
<endpoint_authentication_credentials> | ||
writeRelabelConfigs: <1> | ||
- <relabel_config> <2> | ||
---- | ||
<1> Add a list of write relabel configurations for metrics that you want to send to the remote endpoint. | ||
<2> Substitute the label configuration for the metrics sent to the remote write endpoint. | ||
+ | ||
The following sample shows how to forward a metric with the cluster ID label `cluster_id` in default platform monitoring: | ||
+ | ||
[source,yaml] | ||
---- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: cluster-monitoring-config | ||
namespace: openshift-monitoring | ||
data: | ||
config.yaml: | | ||
prometheusK8s: | ||
remoteWrite: | ||
- url: "https://remote-write-endpoint.example.com" | ||
writeRelabelConfigs: | ||
- sourceLabels: | ||
- __tmp_openshift_cluster_id__ <1> | ||
targetLabel: cluster_id <2> | ||
action: replace <3> | ||
---- | ||
<1> The system initially applies a temporary cluster ID source label named `+++__tmp_openshift_cluster_id__+++`. This temporary label gets replaced by the cluster ID label name that you specify. | ||
<2> Specify the name of the cluster ID label for metrics sent to remote write storage. | ||
If you use a label name that already exists for a metric, that value is overwritten with the name of this cluster ID label. | ||
For the label name, do not use `+++__tmp_openshift_cluster_id__+++`. The final relabeling step removes labels that use this name. | ||
<3> The `replace` write relabel action replaces the temporary label with the target label for outgoing metrics. | ||
This action is the default and is applied if no action is specified. | ||
|
||
. Save the file to apply the changes to the `ConfigMap` object. | ||
The pods affected by the updated configuration automatically restart. | ||
+ | ||
[WARNING] | ||
==== | ||
Saving changes to a monitoring `ConfigMap` object might redeploy the pods and other resources in the related project. Saving changes might also restart the running monitoring processes in that project. | ||
==== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters