(十)进程监控process_exporte
yum -y install atop
在机器上部署 process-exporter
- 项目地址 https://github.com/ncabatoff/process-exporter
- 使用ansible部署 process-exporter
ansible-playbook -i host_file service_deploy.yaml -e "tgz=process-exporter-0.7.5.linux-amd64.tar.gz" -e "app=process-exporter"
准备配置文件 process-exporter.yaml
指定采集进程的方式,下面的例子代表所有cmdline
cat <<EOF >/opt/app/process-exporter/process-exporter.yaml process_names: - name: "{{.Comm}}" cmdline: - '.+' EOF
将process-exporter采集加入的采集池中
- job_name: process_exporter honor_timestamps: true scrape_interval: 15s scrape_timeout: 10s metrics_path: /metrics scheme: http static_configs: - targets: - 172.16.58.78:9256 - 172.16.58.79:9256
grafana 上导入process-exporter dashboard
变量替换
label_values(namedprocess_namegroup_num_procs, instance)
label_values(namedprocess_namegroup_cpu_seconds_total{instance=~"$host"},groupname)