1.下載二進位制檔案process-exporter
專案地址:https://github.com/ncabatoff/process-exporter
下載地址:https://github.com/ncabatoff/process-exporter/releases/download/
2.啟動
#解壓
tar -zxvf process-exporter-0.8.2.linux-amd64.tar.gz mkdir /usr/local/node_exporter/ mv process-exporter-0.8.2.linux-amd64/process_exporter /usr/local/node_exporter/process_exporter
#編輯配置檔案
vim /usr/local/node_exporter/conf/process.yml process_names: - name: "{{.Matches}}" cmdline: - 'tomcat' #唯一標識 - name: "{{.Matches}}" cmdline: - '9500' #唯一標識
#建立systemd
vim /etc/systemd/system/process_exporter.service [Unit] Description=process_exporter After=network.target [Service] Type=simple ExecStart=/usr/local/node_exporter/process_exporter -config.path=/usr/local/node_exporter/conf/process.yml Restart=on-failure [Install] WantedBy=multi-user.target
啟動程序
systemctl daemon-reload
systemctl start process_exporter
systemctl enable process_exporter