如何启用监控功能 #
监控功能需要通过 Prometheus 的 node_exporter 来实现主机监控,以及通过 SphereEx 企业数据服务平台的 agent 模块来实现计算节点监控。
前提条件
启用监控功能前:
- 请确认在监控主机上已经运行 node_exporter。 a. 使用者根据实际的操作系统下载对应的 node_exporter 组件,下载地址:https://prometheus.io/download/。 b. 解压 node_exporter 安装包,执行 ./node_exporter 命令启动。
- 请确保计算节点上开启 agent 功能。相关操作可参考 https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-proxy/observability/。
操作步骤
- 安装并启动 Prometheus。 假设运行地址为 192.168.1.100,端口 9090。
- 配置监控目标。 注意: 修改 Prometheus 的配置文件 prometheus.yml,在 scrape_configs 节点下的 static_configs.targets 中添加监控目标的主机、计算节点 IP 及端口。需要使用主机及计算节点实际的 IP 地址,不建议使用 127.0.0.1、localhost 等本地地址。
假设监控主机的 node_exporter 访问地址为 192.168.1.100:9100,计算节点的 agent 模块中 Prometheus 插件运行地址为 192.168.1.100:9000。
static_configs:
- targets: ["192.168.1.100:9100", "192.168.1.100:9000"]
3.配置 application.properties 中 Prometheus 的地址。 prometheus.server.address=http://192.168.1.100:9090