您的位置:首页 > 科技 > IT业 > 9.1 使用ansible部署process-exporter

9.1 使用ansible部署process-exporter

2024/9/29 23:47:29 来源:https://blog.csdn.net/weixin_48502062/article/details/140958429  浏览:    关键词:9.1 使用ansible部署process-exporter

本节重点介绍 :

  • ansible 部署二进制 process-exporter

项目地址

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

下载地址

wget -O  /opt/tgzs/process-exporter-0.7.5.linux-amd64.tar.gz https://github.com/ncabatoff/process-exporter/releases/download/v0.7.5/process-exporter-0.7.5.linux-amd64.tar.gz

准备配置文件 process-exporter.yaml

  • 指定采集进程的方式,下面的例子代表所有cmdline
mkdir /opt/app/process-exporter
cat <<EOF >/opt/app/process-exporter/process-exporter.yaml
process_names:- name: "{{.Comm}}"cmdline:- '.+'
EOF

使用ansible部署 process-exporter

  • 准备 service文件
cat <<EOF> process-exporter.service
[Unit]
Description=process-exporter Exporter
Wants=network-online.target
After=network-online.target[Service]
ExecStart=/opt/app/process-exporter/process-exporter -config.path=/opt/app/process-exporter/process-exporter.yaml
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=process-exporter
[Install]
WantedBy=default.target
EOF
  • 执行ansible-playbook
ansible-playbook -i host_file  service_deploy.yaml  -e "tgz=process-exporter-0.7.5.linux-amd64.tar.gz" -e "app=process-exporter"

检查部署情况


# 查看端口 进程 日志
ss -ntlp |grep 9256
ps -ef |grep process-exporter |grep -v grep 

本节重点总结 :

  • ansible 部署二进制 process-exporter

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com