关于prometheus:nodeexporter和cAdvisor部署

9次阅读

共计 2004 个字符,预计需要花费 6 分钟才能阅读完成。

node_exporter install

wget https://github.com/prometheus/node_exporter/releases/download/v1.6.0/node_exporter-1.6.0.linux-amd64.tar.gz

cat /usr/lib/systemd/system/node_export.service
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
 
[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/node_exporter --web.listen-address=0.0.0.0:39100 --collector.systemd --collector.systemd.unit-whitelist=(docker|sshd).service --collector.textfile.directory /var/lib/node_exporter/textfile_collector/
Restart=on-failure
 
[Install]
WantedBy=multi-user.target
mv /usr/lib/systemd/system/node_export.service /usr/lib/systemd/system/node_exporter.service
systemctl daemon-reload
systemctl enable node_exporter
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.

systemctl start node_exporter
netstat -tnpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1079/sshd           
tcp6       0      0 :::22                   :::*                    LISTEN      1079/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1399/master         
tcp6       0      0 :::39100                :::*                    LISTEN      6735/node_exporter  
tcp6       0      0 :::39104                :::*                    LISTEN      4456/mysqld_exporte 

cadvisor


[root@vm5 ~]# docker run --publish=38081:8080 --detach=true --name=cadvisor google/cadvisor
Unable to find image 'google/cadvisor:latest' locally
latest: Pulling from google/cadvisor
ff3a5c916c92: Pull complete 
44a45bb65cdf: Pull complete 
0bbe1a2fe2a6: Pull complete 
Digest: sha256:815386ebbe9a3490f38785ab11bda34ec8dacf4634af77b8912832d4f85dca04
Status: Downloaded newer image for google/cadvisor:latest
6765d0b66bab4fceb43c8b9ca4f4ab4a681981cee56534692c616e8ce24ee51b
[root@vm5 ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      957/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1469/master                
tcp6       0      0 :::38080                :::*                    LISTEN      30961/docker-proxy  
tcp6       0      0 :::38081                :::*                    LISTEN      3147/docker-proxy 
[root@server01 ~]# vi /opt/prometheus/prometheus.yml 
 
  - job_name: 'docker'
    static_configs:
    - targets: ['10.xx.x.1:38081']

正文完
 0