端口3000: Grafana Web
端口9090: Prometheus Web
端口9100: 被监听的服务器
Download node_exporter archive.
curl -s https://api.github.com/repos/prometheus/node_exporter/releases/latest \ | grep browser_download_url \ | grep linux-amd64 \ | cut -d '"' -f 4 \ | wget -qi -
Extract downloaded file and move the binary file to /usr/local/bin.
tar -xvf node_exporter*.tar.gz cd node_exporter*/ sudo cp node_exporter /usr/local/bin
Confirm installation.
$ node_exporter --version node_exporter, version 0.18.1 (branch: HEAD, revision: 3db77732e925c08f675d7404a8c46466b2ece83e) build user: root@b50852a1acba build date: 20190604-16:41:18 go version: go1.12.5
Create node_exporter service.
sudo tee /etc/systemd/system/node_exporter.service <<EOF [Unit] Description=Node Exporter Wants=network-online.target After=network-online.target [Service] User=prometheus ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=default.target EOF
Reload systemd and start the service.
sudo systemctl daemon-reload sudo systemctl start node_exporter sudo systemctl enable node_exporter
Confirm status:
$ systemctl status node_exporter.service
Once we confirm the service to be running, let’s add the node_exporter to the Prometheus server.
sudo vim /etc/prometheus/prometheus.yml
Add new job under scrape_config
section.
- job_name: 'node_exporter' static_configs: - targets: ['localhost:9100']
Restart Prometheus:
sudo systemctl restart prometheus
来源:https://computingforgeeks.com/how-to-install-prometheus-and-node-exporter-on-debian/