Last active
February 15, 2018 07:21
-
-
Save nqbao/8cab1bf703560b1c0b409dbbe254ab7e to your computer and use it in GitHub Desktop.
Install common prometheus exporter to a node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -f "/etc/systemd/system/node_exporter.service" ]; then | |
wget https://github.com/prometheus/node_exporter/releases/download/v0.15.2/node_exporter-0.15.2.linux-amd64.tar.gz | |
tar -xvf node_exporter* | |
sudo mv node_exporter-0.15.2.linux-amd64/node_exporter /usr/sbin | |
sudo bash -c 'cat <<EOT > /etc/systemd/system/node_exporter.service | |
[Unit] | |
Description=Node Exporter | |
[Service] | |
#User=node_exporter | |
#EnvironmentFile=/etc/sysconfig/node_exporter | |
ExecStart=/usr/sbin/node_exporter | |
[Install] | |
WantedBy=multi-user.target | |
EOT' | |
sudo systemctl daemon-reload | |
sudo systemctl enable node_exporter | |
sudo systemctl start node_exporter | |
fi | |
sudo docker rm -f cadvisor | |
sudo docker run -d -v /:/rootfs:ro -v /var/run:/var/run:rw \ | |
--volume=/sys:/sys:ro \ | |
--volume=/var/lib/docker/:/var/lib/docker:ro \ | |
--publish=29101:8080 --restart=always --name=cadvisor google/cadvisor:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment