标签:info map mysqld 重启 name eth network 编写 bsp
process-exporter可以用来检测所选进程的存活状态
下载地址:https://github.com/ncabatoff/process-exporter/releases/tag/v0.4.0
tar -zxvf process-exporter-0.4.0.linux-amd64.tar.gz -C /usr/local/process-exporter
编写配置文件
vim process-exporter-ncabatoff.yaml process_names: - name: "{{.Matches}}" cmdline: - ‘redis-server‘ - name: "{{.Matches}}" cmdline: - ‘mysqld‘ - name: "{{.Matches}}" cmdline: - ‘org.apache.zookeeper.server.quorum.QuorumPeerMain‘ - name: "{{.Matches}}" cmdline: - ‘org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer‘ - name: "{{.Matches}}" cmdline: - ‘org.apache.hadoop.hdfs.qjournal.server.JournalNode‘
注 cmdline: 所选进程的唯一标识,ps -ef 可以查询到。如果改进程不存在,则不会有该进程的数据采集到。
编写启动脚本
vim /usr/lib/systemd/system/process_exporter.service [Unit] Description=Prometheus exporter for processors metrics, written in Go with pluggable metric collectors. Documentation=https://github.com/ncabatoff/process-exporter After=network.target [Service] Type=simple User=prometheus WorkingDirectory=/usr/local/process-exporter ExecStart=/usr/local/process-exporter/process-exporter -config.path=/usr/local/process-exporter/process-exporter-ncabatoff.yaml Restart=on-failure [Install] WantedBy=multi-user.target
systemctl daemon-reload systemctl start process_exporter systemctl enable process_exporter
curl localhost:9256/metrics
增加 - job_name: ‘process‘ static_configs: - targets: [‘172.16.8.187:9256‘]
重启Prometheus
标签:info map mysqld 重启 name eth network 编写 bsp
原文地址:https://www.cnblogs.com/bigberg/p/10174222.html