前言
prometheus中使用process-exporter进行对服务器进程的数据采集,在这里给大家简单的分享一下。
一、安装
1、解压安装包
tar zxf process-exporter-0.5.0.linux-amd64.tar.gz -C /data/
2、添加配置
cd /data/process-exporter-0.5.0.linux-amd64/
vim process-name.yaml
process_names:
- name: "{
{.Matches}}"
cmdline:
- 'httpd'
- name: "{
{.Matches}}"
cmdline:
- 'prometheus'
3、启动
nohup ./process-exporter -config.path process-name.yaml &
二、配置prometheus
1、添加配置
#在scrape_configs: 这个栏目下
- job_name: 'process'
static_configs:
- targets: ['192.168.84.128:9256']
2、重启prometheus
#检查配置文件
./promtool check config prometheus.yml
#先kill再启动
nohup ./prometheus --config.file=prometheus.yml &
配置成功
3、测试报警
关闭http,查看是否报警,alerts配置会在之后的章节中讲到。