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

posted @ 2024-03-11 10:03  热气球!  阅读(333)  评论(0编辑  收藏  举报