第 11 章 Red Hat Decision Manager 中的 Prometheus metrics 监控
Prometheus 是一个开源系统监控工具包,可与 Red Hat Decision Manager 一同使用来收集和存储与执行业务规则、流程、决策模型和未编译(DMN)模型和其他红帽决策管理器资产相关的指标。您可以通过 REST API 调用 KIE 服务器、通过 Prometheus 表达式浏览器或使用 Grafana 等数据图形工具访问存储的指标。
您可以为内部 KIE 服务器实例、Spring Boot 上的 KIE 服务器或 Red Hat OpenShift Container Platform 上部署 KIE 服务器配置 Prometheus 指标监控。
有关 KIE 服务器与 Prometheus 公开的可用指标列表,请从红帽客户门户网站下载 Red Hat Process Automation Manager 7.13.2 Source Distribution /kie-server-services-prometheus/src/main/7.13.2 -sources/src/droolsjbpm-integration-$VERSION/kie-server-parent/kie-server-services/kie-server-services-prometheus/src/main/java/org/kie/server/services/prometheus
。https://access.redhat.com/jbossnetwork/restricted/listSoftware.html
Red Hat support for Prometheus 仅限于 Red Hat 产品文档中提供的设置和配置建议。
11.1. 为 KIE 服务器配置 Prometheus 指标监控 复制链接链接已复制到粘贴板!
您可以将 KIE 服务器实例配置为使用 Prometheus 来收集并存储与红帽 Decision Manager 中业务资产活动相关的指标。有关 KIE 服务器与 Prometheus 公开的可用指标列表,请从红帽客户门户网站下载 Red Hat Process Automation Manager 7.13.2 Source Distribution /kie-server-services-prometheus/src/main/7.13.2 -sources/src/droolsjbpm-integration-$VERSION/kie-server-parent/kie-server-services/kie-server-services-prometheus/src/main/java/org/kie/server/services/prometheus
。https://access.redhat.com/jbossnetwork/restricted/listSoftware.html
先决条件
- 已安装 KIE 服务器。
-
您有
kie-server
用户角色访问权限到 KIE 服务器。 - 已安装 Prometheus。有关下载和使用 Prometheus 的详情,请查看 Prometheus 文档页面。
流程
-
在您的 KIE 服务器实例中,将
org.kie.prometheus.server.ext.disabled
系统属性设置为false
以启用 Prometheus 扩展。您可在启动 KIE 服务器时或在 Red Hat Decision Manager 发行版的standalone.xml
或standalone-full.xml
文件中定义此属性。 如果您在 Spring Boot 上运行 Red Hat Decision Manager,请在
application.properties
系统属性中配置所需的密钥:Spring Boot application.properties key for Red Hat Decision Manager 和 Prometheus
kieserver.drools.enabled=true kieserver.dmn.enabled=true kieserver.prometheus.enabled=true
kieserver.drools.enabled=true kieserver.dmn.enabled=true kieserver.prometheus.enabled=true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在 Prometheus 发行版本的
prometheus.yaml
文件中,在scrape_configs
部分添加以下设置,将 Prometheus 配置为从 KIE 服务器中提取指标:prometheus.yaml 文件中的 scrape 配置
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Spring Boot 的 prometheus.yaml 文件中的 scrape 配置(如果适用)
scrape_configs: - job_name: 'kie' metrics_path: /rest/metrics static_configs: - targets: ["HOST:PORT"]
scrape_configs: - job_name: 'kie' metrics_path: /rest/metrics static_configs: - targets: ["HOST:PORT"]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 根据您的 KIE 服务器位置和设置值。
启动 KIE 服务器实例。
红帽 JBoss EAP 上的红帽决策管理器入门命令示例
cd ~/EAP_HOME/bin ./standalone.sh --c standalone-full.xml
$ cd ~/EAP_HOME/bin $ ./standalone.sh --c standalone-full.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 启动配置的 KIE 服务器实例后,Prometheus 开始收集指标,KIE 服务器会将指标发布到 REST API 端点
http://HOST:PORT/SERVER/services/rest/metrics
(或在 Spring Boot 上,或在 Spring Boot 上)发布指标到http://HOST:PORT/rest/metrics
。在 REST 客户端或 curl 实用程序中,使用以下组件发送 REST API 请求,以验证 KIE 服务器是否发布指标:
对于 REST 客户端:
-
身份验证 :使用
kie-server
角色输入 KIE 服务器用户的用户名和密码。 HTTP 标头 :设置以下标头:
-
接受
:application/json
-
-
HTTP 方法 :设置为
GET
。 -
URL :输入 KIE 服务器 REST API 基础 URL 和指标端点,如
http://localhost:8080/kie-server/services/rest/metrics
(或在 Spring Boot、http://localhost:8080/rest/metrics
上)。
对于 curl 实用程序:
-
-
U :使用kie-server
角色输入 KIE 服务器用户的用户名和密码。 -H
:设置以下标头:-
接受
:application/json
-
-
-x
:设置为GET
。 -
URL :输入 KIE 服务器 REST API 基础 URL 和指标端点,如
http://localhost:8080/kie-server/services/rest/metrics
(或在 Spring Boot、http://localhost:8080/rest/metrics
上)。
红帽 JBoss EAP 上红帽决策管理器的 curl 命令示例
curl -u 'baAdmin:password@1' -X GET "http://localhost:8080/kie-server/services/rest/metrics"
curl -u 'baAdmin:password@1' -X GET "http://localhost:8080/kie-server/services/rest/metrics"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Spring Boot 上的 Red Hat Decision Manager 的 curl 命令示例
curl -u 'baAdmin:password@1' -X GET "http://localhost:8080/rest/metrics"
curl -u 'baAdmin:password@1' -X GET "http://localhost:8080/rest/metrics"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 服务器响应示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 如果 KIE 服务器中没有指标,请查看并验证本节中描述的 KIE 服务器和 Prometheus 配置。
您还可以在
http://HOST:PORT/graph
中与 Prometheus 表达式浏览器中收集的指标进行交互,或者将 Prometheus 数据源与数据图形工具(如 Grafana)集成:图 11.1. 带有 KIE 服务器指标的 Prometheus 表达式浏览器
图 11.2. 带有 KIE 服务器目标的 Prometheus 表达式浏览器
图 11.3. DMN 型号的 KIE 服务器指标的 Grafana 仪表板
图 11.4. 带有临时解决方案的 KIE 服务器指标的 Grafana 仪表板
-
身份验证 :使用