Prometheus监控系统进程---process-exporter
参考文档
Named processes stacked | Grafana Labs
Named processes | Grafana Labs
ncabatoff/process-exporter:Prometheus 导出器,用于挖掘 /proc 以报告所选进程 (github.com)
操作步骤
下载安装包
wget https://github.com/ncabatoff/process-exporter/releases/download/v0.7.10/process-exporter-0.7.10.linux-arm64.tar.gz
安装
tar -xvzf process-exporter-0.7.10.linux-arm64.tar.gz
cp process-exporter-0.7.10.linux-arm64/process-exporter /usr/local/bin/process-exporter
rm -rf process-exporter-0.7.10.linux-arm64*
mkdir /etc/process-exporter
cat > /etc/process-exporter/filename.yml << EOF
process_names:
- comm:
- chromium-browse
- bash
- prometheus
- gvim
- java
- nginx
- exe:
- /sbin/upstart
cmdline:
- --user
name: upstart:-user
EOF
cat > /etc/systemd/system/process-exporter.service << EOF
[Unit]
Description=process-exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
ExecStart=/usr/local/bin/process-exporter -config.path /etc/process-exporter/filename.yml
Restart=on-failure
RestartSec=20
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl restart process-exporter
systemctl enable process-exporter
systemctl status process-exporter
配置Prometheus
root@grafana:~# cat /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "process-exporter"
static_configs:
- targets: ["10.0.0.10:9256"]
Grafana导入图标
导入官方推荐的715、249
一个人花在影响自己未来命运的工作选择上的精力,竟比花在购买穿了一年就会扔掉的衣服上的心思要少得多,这是一件多么奇怪的事情,尤其是当他未来的幸福和富足要全部依赖于这份工作时。