$ oc get routes -n openshift-monitoring thanos-querier -o jsonpath='{.status.ingress[0].host}'
You can access metrics to monitor the performance of cluster components and your 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 OKD CLI (oc
).
You have obtained the OKD 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 OKD 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 OKD API route for Thanos Querier. |
You can use the OKD metrics query browser to run Prometheus Query Language (PromQL) queries to examine metrics visualized on a plot. This functionality provides information about the state of a cluster and any user-defined workloads that you are monitoring.
As a cluster administrator or as a user with view permissions for all projects, you can access metrics for all default OKD and user-defined projects in the Metrics UI.
The Metrics UI includes predefined queries, for example, CPU, memory, bandwidth, or network packet for all projects. You can also run custom Prometheus Query Language (PromQL) queries.
You have access to the cluster as a user with the cluster-admin
cluster role or with view permissions for all projects.
You have installed the OpenShift CLI (oc
).
In the Administrator perspective of the OKD web console, click Observe and go to the Metrics tab.
To add one or more queries, perform any of the following actions:
Option | Description |
---|---|
Select an existing query. |
From the Select query drop-down list, select an existing query. |
Create a custom query. |
Add your Prometheus Query Language (PromQL) query to the Expression field. As you type a PromQL expression, autocomplete suggestions appear in a drop-down list. These suggestions include functions, metrics, labels, and time tokens. Use the keyboard arrows to select one of these suggested items and then press Enter to add the item to your expression. Move your mouse pointer over a suggested item to view a brief description of that item. |
Add multiple queries. |
Click Add query. |
Duplicate an existing query. |
Click the options menu |
Disable a query from being run. |
Click the options menu |
To run queries that you created, click Run queries. The metrics from the queries are visualized on the plot. If a query is invalid, the UI shows an error message.
|
Optional: Save the page URL to use this set of queries again in the future.
Explore the visualized metrics. Initially, all metrics from all enabled queries are shown on the plot. Select which metrics are shown by performing any of the following actions:
Option | Description |
---|---|
Hide all metrics from a query. |
Click the options menu |
Hide a specific metric. |
Go to the query table and click the colored square near the metric name. |
Zoom into the plot and change the time range. |
Perform one of the following actions:
|
Reset the time range. |
Click Reset zoom. |
Display outputs for all queries at a specific point in time. |
Hover over the plot at the point you are interested in. The query outputs appear in a pop-up box. |
Hide the plot. |
Click Hide graph. |
Querying Prometheus (Prometheus documentation)
You can use the OKD web console to view, search, and filter the endpoints that are currently targeted for scraping, which helps you to identify and troubleshoot problems. For example, you can view the current status of targeted endpoints to see when OKD monitoring is not able to scrape metrics from a targeted component.
The Metrics targets page shows targets for default OKD projects and for user-defined projects.
You have access to the cluster as an administrator for the project for which you want to view metrics targets.
In the Administrator perspective of the OKD web console, go to Observe → Targets. The Metrics targets page opens with a list of all service endpoint targets that are being scraped for metrics.
This page shows details about targets for default OKD and user-defined projects. This page lists the following information for each target:
Service endpoint URL being scraped
The ServiceMonitor
resource being monitored
The up or down status of the target
Namespace
Last scrape time
Duration of the last scrape
Optional: To find a specific target, perform any of the following actions:
Option | Description |
---|---|
Filter the targets by status and source. |
Choose filters in the Filter list. The following filtering options are available:
|
Search for a target by name or label. |
Enter a search term in the Text or Label field next to the search box. |
Sort the targets. |
Click one or more of the Endpoint Status, Namespace, Last Scrape, and Scrape Duration column headers. |
Click the URL in the Endpoint column for a target to go to its Target details page. This page provides information about the target, including the following information:
The endpoint URL being scraped for metrics
The current Up or Down status of the target
A link to the namespace
A link to the ServiceMonitor
resource details
Labels attached to the target
The most recent time that the target was scraped for metrics
In the Administrator perspective, you can view dashboards relating to core OKD cluster components.
You have access to the cluster as a user with the cluster-admin
cluster role.
In the Administrator perspective of the OKD web console, go to Observe → Dashboards.
Choose a dashboard in the Dashboard list. Some dashboards, such as etcd and Prometheus dashboards, produce additional sub-menus when selected.
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.