prometheus process-export进程监控

2022/8/23 5:24:00

本文主要是介绍prometheus process-export进程监控,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 

 
  • prometheus
  • process-export
  • 进程监控
 

一、环境部署,见
prometheus 邮件告警 第一节
https://blog.csdn.net/oToyix/article/details/120160633
二、process-export进程监控
1、process-export 下载、配置、启动

wget -c https://github.com/ncabatoff/process-exporter/releases/download/v0.7.5/process-exporter-0.7.5.linux-amd64.tar.gz
tar -xf process-exporter-0.7.5.linux-amd64.tar.gz -C /usr/local/
cd /usr/local/
ln -s process-exporter-0.7.5.linux-amd64 process-exporter
nohup ./process-exporter &
firewall-cmd --add-port=9256/tcp --permanent
firewall-cmd --reload
cd process-exporter

进程配置文件

vim process-exporter.yaml
process_names:
 
  - name: "{{.Matches}}"
    cmdline:
    - 'mysqld'
 
  - name: "{{.Matches}}"
    cmdline:
    - 'nginx'
 
  - name: "{{.Matches}}"
    cmdline:
    - 'php-fpm.conf'

启动

nohup /usr/local/process-exporter/process-exporter -config.path=/usr/local/process-exporter/process-exporter.yaml &

3、prometheus服务端配置
添加告警规则 之 文件发现
vim prometheus.yml

  - job_name: "proess"
    file_sd_configs:
      - files:
        - targets/proess-*.yaml
        refresh_interval: 2m

cat targets/proess-all.yaml

- targets:
  - 192.168.0.63:9256
  labels:
    app: node-process
    job: process

告警规则,当进程数为0时 告警
cat alert_rules/process_down.yaml

groups:
- name: Allprocess
  rules:
  - alert: InproessDown
    expr: namedprocess_namegroup_num_procs == 0
    for: 1m
    annotations:
      title: "process down"
      description: 'process has been down for more than 1 m .'
    labels:
      severity: 'critical'

在这里插入图片描述
----------------end



这篇关于prometheus process-export进程监控的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程