This documentation is for a release that is no longer maintained
See documentation for the latest supported version.3.6.4.3.2. 使用 Prometheus 收集 OpenShift Dev Spaces 服务器指标
使用 Prometheus 为 OpenShift Dev Spaces 服务器收集、存储和查询 JVM 指标:
先决条件
-
OpenShift Dev Spaces 在端口
8087上公开指标。请参阅启用并公开 OpenShift Dev Spaces 服务器 JVM 指标。 -
Prometheus 2.26.0 或更高版本正在运行。Prometheus 控制台在端口
9090上运行,带有对应的服务。参阅 Prometheus 的第一个步骤。
流程
将 Prometheus 配置为从端口
8087中提取指标。注意示例监控堆栈 已经使用空配置创建
prometheus-configConfigMap。要提供 Prometheus 配置详情,请编辑 ConfigMap 的data字段。例 3.33. Prometheus 配置
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 缩减
PrometheusDeployment,并最多从上一步中读取更新的 ConfigMap。oc scale --replicas=0 deployment/prometheus -n monitoring && oc scale --replicas=1 deployment/prometheus -n monitoring
$ oc scale --replicas=0 deployment/prometheus -n monitoring && oc scale --replicas=1 deployment/prometheus -n monitoringCopy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
使用端口转发在本地访问
Prometheus服务:oc port-forward svc/prometheus 9090:9090 -n monitoring
$ oc port-forward svc/prometheus 9090:9090 -n monitoringCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
通过查看
localhost:9090/targets上的目标端点,验证所有目标是否已启动。 使用 Prometheus 控制台查看和查询指标:
-
查看
localhost:9090/metrics中的指标。 从
localhost:9090/graph查询指标。如需更多信息,请参阅 使用表达式浏览器。
-
查看