prometheus
prometheus是业内非常流行的开源监控系统,同时本身也是一款时序数据库。需要将其安装在主控节点,默认占用端口为9090,将prometheus安装包放入主控节点环境并切换到目标用户空间后,执行如下命令:
-
解压并切换到prometheus目录下:
tar zxvf prometheus-2.42.0.linux-amd64.tar.gz cd prometheus-2.42.0.linux-amd64/
-
修改prometheus配置文件:
vi prometheus.yml
在该文件中找到 scrape_configs 部分,该部分包含了所有需要被抓取的targets的配置信息,用户需要根据自己的节点数量和端口占用情况进行修改。根据规划配置可做如下配置:
scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['192.168.100.4:9090'] - job_name: 'opengauss_exporter' static_configs: - targets: ['192.168.100.4:9187', '192.168.100.4:9188', '192.168.100.4:9189'] - job_name: 'node_exporter' static_configs: - targets: ['192.168.100.1:9100', '192.168.100.2:9100', '192.168.100.3:9100'] - job_name: 'reprocessing_exporter' static_configs: - targets: ['192.168.100.4:8181'] - job_name: 'cmd_exporter' static_configs: - targets: ['192.168.100.2:9180']
-
启动prometheus并将日志输入到同目录下的prometheus.log里:
./prometheus --web.enable-admin-api --web.enable-lifecycle --storage.tsdb.retention.time=1w >./prometheus.log 2>&1 &