1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# download curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.6.0/node_exporter-1.6.0.linux-amd64.tar.gz # 解凍 tar xvzf node_exporter-1.6.0.linux-amd64.tar.gz # インストール cd node_exporter-1.6.0.linux-amd64 sudo cp node_exporter /usr/local/bin/ # systemdファイル作成 sudo bash -c 'cat << EOF > /etc/systemd/system/node_exporter.service [Unit] Description=Node Exporter Wants=network-online.target After=network-online.target [Service] User=node_exporter ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=default.target EOF' ## 実行ユーザー作成 sudo useradd -rs /bin/false node_exporter sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter # 起動 sudo systemctl daemon-reload sudo systemctl start node_exporter sudo systemctl enable node_exporter # 動作チェック curl http://localhost:9100/metrics # ファイアウォール穴あけ sudo firewall-cmd --add-port=9100/tcp --permanent sudo firewall-cmd --reload |