下载安装consul_exporter
#下载软件wget https://github.com/prometheus/consul_exporter/releases/download/v0.6.0/consul_exporter-0.6.0.linux-amd64.tar.gz[root@xxg-sit-md-13 src]# ls -l consul_exporter-0.6.0.linux-amd64.tar.gz-rw-r--r-- 1 root root 7227104 Mar 12 18:04 consul_exporter-0.6.0.linux-amd64.tar.gz#解压文件,并重命名[root@xxg-sit-md-13 src]# tar xf consul_exporter-0.6.0.linux-amd64.tar.gz[root@xxg-sit-md-13 src]# mv consul_exporter-0.6.0.linux-amd64 ../[root@xxg-sit-md-13 local]# mv consul_exporter-0.6.0.linux-amd64/ consul_exporter#配置启动文件[root@xxg-sit-md-13 local]# cat /etc/systemd/system/consul_exporter.service[Unit]Description=consul_exporterAfter=network.target[Service]Restart=on-failureExecStart=/usr/local/consul_exporter/consul_exporter --consul.server=10.4.62.13:8500[Install]WantedBy=multi-user.target#启动consul_exporter,并加入开机自启动[root@xxg-sit-md-13 src]# systemctl enable consul_exporter[root@xxg-sit-md-13 src]# systemctl start consul_exporter[root@xxg-sit-md-13 local]# ss -lntp|grep 9107LISTEN 0 16384 [::]:9107 [::]:* users:(("consul_exporter",pid=13107,fd=3))
接下去配置prometheus文件,基于文件服务发现,请查看文件服务发现文档
