From 2732a9a050a4b6660485d0803a771feba7dc4ade Mon Sep 17 00:00:00 2001 From: Brian Burt Date: Thu, 12 Jan 2023 11:37:56 -0500 Subject: [PATCH] RHDEVDOCS-3456-how-to-view-default-monitoring-metrics --- ...g-viewing-a-list-of-available-metrics.adoc | 36 +++++++++++++++++++ monitoring/managing-metrics.adoc | 3 ++ 2 files changed, 39 insertions(+) create mode 100644 modules/monitoring-viewing-a-list-of-available-metrics.adoc diff --git a/modules/monitoring-viewing-a-list-of-available-metrics.adoc b/modules/monitoring-viewing-a-list-of-available-metrics.adoc new file mode 100644 index 0000000000..16b4d2ed42 --- /dev/null +++ b/modules/monitoring-viewing-a-list-of-available-metrics.adoc @@ -0,0 +1,36 @@ +// Module included in the following assemblies: +// +// * monitoring/managing-metrics.adoc + +:_content-type: PROCEDURE +[id="viewing-a-list-of-available-metrics_{context}"] += Viewing a list of available metrics + +As a cluster administrator or as a user with view permissions for all projects, you can view a list of metrics available in a cluster and output the list in JSON format. + +.Prerequisites +* You have installed the {product-title} CLI (`oc`). +* You have obtained the {product-title} API route for Thanos Querier. +* You are a cluster administrator, or you have access to the cluster as a user with the `cluster-monitoring-view` role. ++ +[NOTE] +==== +You can only use bearer token authentication to access the Thanos Querier API route. +==== + +.Procedure + +. If you have not obtained the {product-title} API route for Thanos Querier, run the following command: ++ +[source,terminal] +---- +$ oc get routes -n openshift-monitoring thanos-querier -o jsonpath='{.status.ingress[0].host}' +---- + +. Retrieve a list of metrics in JSON format from the Thanos Querier API route by running the following command. This command uses `oc` to authenticate with a bearer token. ++ +[source,terminal] +---- +$ curl -k -H "Authorization: Bearer $(oc whoami -t)" https:///api/v1/metadata <1> +---- +<1> Replace `` with the {product-title} API route for Thanos Querier. diff --git a/monitoring/managing-metrics.adoc b/monitoring/managing-metrics.adoc index ae30681ae5..00b6315c9a 100644 --- a/monitoring/managing-metrics.adoc +++ b/monitoring/managing-metrics.adoc @@ -30,6 +30,9 @@ include::modules/monitoring-specifying-how-a-service-is-monitored.adoc[leveloffs * xref:../rest_api/monitoring_apis/podmonitor-monitoring-coreos-com-v1.adoc[PodMonitor API] * xref:../rest_api/monitoring_apis/servicemonitor-monitoring-coreos-com-v1.adoc[ServiceMonitor API] +// Viewing a list of available metrics for a cluster +include::modules/monitoring-viewing-a-list-of-available-metrics.adoc[leveloffset=+1] + [id="next-steps_querying-metrics"] == Next steps