$ oc get routes -n openshift-monitoring thanos-querier -o jsonpath='{.status.ingress[0].host}'
You can access metrics to monitor the performance of your cluster workloads.
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.
You are a cluster administrator, or you have access to the cluster as a user with the cluster-monitoring-view
cluster role.
You have installed the OpenShift Container Platform CLI (oc
).
You have obtained the OpenShift Container Platform API route for Thanos Querier.
You are able to get a bearer token by using the oc whoami -t
command.
You can only use bearer token authentication to access the Thanos Querier API route. |
If you have not obtained the OpenShift Container Platform API route for Thanos Querier, run the following command:
$ 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.
$ curl -k -H "Authorization: Bearer $(oc whoami -t)" https://<thanos_querier_route>/api/v1/metadata (1)
1 | Replace <thanos_querier_route> with the OpenShift Container Platform API route for Thanos Querier. |
You can use the OpenShift Container Platform metrics query browser to run Prometheus Query Language (PromQL) queries to examine metrics visualized on a plot. This functionality provides information about any user-defined workloads that you are monitoring.
As a developer, you must specify a project name when querying metrics. You must have the required privileges to view metrics for the selected project.
In the Developer perspective, the Metrics UI includes some predefined CPU, memory, bandwidth, and network packet queries for the selected project. You can also run custom Prometheus Query Language (PromQL) queries for CPU, memory, bandwidth, network packet and application metrics for the project.
Developers can only use the Developer perspective and not the Administrator perspective. As a developer, you can only query metrics for one project at a time. |
You have access to the cluster as a developer or as a user with view permissions for the project that you are viewing metrics for.
You have enabled monitoring for user-defined projects.
You have deployed a service in a user-defined project.
You have created a ServiceMonitor
custom resource definition (CRD) for the service to define how the service is monitored.
From the Developer perspective in the OpenShift Container Platform web console, select Observe → Metrics.
Select the project that you want to view metrics for from the Project: list.
Select a query from the Select query list, or create a custom PromQL query based on the selected query by selecting Show PromQL. The metrics from the queries are visualized on the plot.
In the Developer perspective, you can only run one query at a time. |
Explore the visualized metrics by doing any of the following:
Option | Description |
---|---|
Zoom into the plot and change the time range. |
Either:
|
Reset the time range. |
Select Reset zoom. |
Display outputs for all queries at a specific point in time. |
Hold the mouse cursor on the plot at that point. The query outputs appear in a pop-up box. |
Querying Prometheus (Prometheus documentation)
In the Developer perspective, you can view dashboards relating to a selected project.
In the Developer perspective, you can view dashboards for only one project at a time. |
You have access to the cluster as a developer or as a user.
You have view permissions for the project that you are viewing the dashboard for.
In the Developer perspective in the OpenShift Container Platform web console, navigate to Observe → Dashboard.
Select a project from the Project: drop-down list.
Select a dashboard from the Dashboard drop-down list to see the filtered metrics.
All dashboards produce additional sub-menus when selected, except Kubernetes / Compute Resources / Namespace (Pods). |
Optional: Select a time range for the graphs in the Time Range list.
Select a pre-defined time period.
Set a custom time range by clicking Custom time range in the Time Range list.
Input or select the From and To dates and times.
Click Save to save the custom time range.
Optional: Select a Refresh Interval.
Hover over each of the graphs within a dashboard to display detailed information about specific items.