首页 > 系统服务 > 详细

prometheus监控进程

时间:2021-09-02 00:06:36      阅读:33      评论:0      收藏:0      [点我收藏+]

process-exporter简介

项目地址: https://github.com/ncabatoff/process-exporter

grafana:  https://grafana.com/grafana/dashboards/4202 | https://grafana.com/grafana/dashboards/10317

process-exporter是主要针对进程进行监控

部署

下载

wget 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 /opt/process-exporter-0.7.5.linux-amd64

ln -s /opt/process-exporter-0.7.5.linux-amd64 /opt/process-exporter

准备监控模板

模板变量

 

  •  包含原始可执行文件的基本名称,即第二个字段 /proc/<pid>/stat

 [root@izx7dvghztbiorz process-exporter]# ps -ef | grep redis 
redis 771 1 0 Jun05 ? 00:45:49 /usr/bin/redis-server *:6379

{{.Comm}}  groupname="redis-server" exe或者sh文件名称
{{.ExeBase}} groupname="redis-server *:6379" /
{{.ExeFull}} groupname="/usr/bin/redis-server *:6379" ps中的进程完成信息
{{.Username}} groupname="redis" 使用进程所属的用户进行分组
{{.Matches}} groupname="map[:redis]"

表示配置到关键字“redis”

 

 

 

 

 

 

 

监控全部进程

process_names:
  - name: "{{.Comm}}"
    cmdline:
    - .+

监控指定进程

process_names:
  - name: "{{.Matches}}"
    cmdline:
    - nginx

  - name: "{{.Matches}}"
    cmdline:
    - zombie

准备启动文件

[root@ops targets]# cat /usr/lib/systemd/system/process-exporter.service 
[Unit]
Description=process-exporter Exporter
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/opt/process-exporter/process-exporter -config.path=/opt/process-exporter/process-exporter.yaml
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=process-exporter
[Install]

启动

systemctl start process-exporter.service 
systemctl enable process-exporter.service 
systemctl status process-exporter.service 

 

prometheus监控进程

原文:https://www.cnblogs.com/yanshicheng/p/15211489.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!