Prometheus監控系統程序---process-exporter

热气球!發表於2024-03-11

參考文件

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

相關文章