Last active
March 12, 2025 10:08
-
-
Save stan1ey-shen/0b5d658c0c5b3a92c5e0afc5ce19d30c to your computer and use it in GitHub Desktop.
Revisions
-
stan1ey-shen revised this gist
Mar 12, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## Grafana 監控 Node ### Node Exporter 設定 -
stan1ey-shen revised this gist
Mar 12, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## Grafana 監控 N ### Node Exporter 設定 -
stan1ey-shen revised this gist
Feb 19, 2025 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,24 @@ ### Node Exporter 設定 #### Docker compose ```yml services: node_exporter: image: quay.io/prometheus/node-exporter:v1.9.0 container_name: node_exporter command: - '--path.rootfs=/host' network_mode: host pid: host restart: unless-stopped ports: - 9100:9100 volumes: - '/:/host:ro,rslave' ``` #### Linux service 1. 在 node 產生一個使用者, 用來執行服務: ```shell sudo useradd -s /bin/false node-exporter -
stan1ey-shen created this gist
Feb 19, 2025 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ ## Grafana 監控 PVE ### Node Exporter 設定 1. 在 node 產生一個使用者, 用來執行服務: ```shell sudo useradd -s /bin/false node-exporter ``` 2. 下載 [node exporter](https://prometheus.io/download/#node_exporter) ```shell export NODE_EXPORTER_VERSION=1.9.0 && wget https://github.com/prometheus/node_exporter/releases/download/v$NODE_EXPORTER_VERSION/node_exporter-$NODE_EXPORTER_VERSION.linux-$(dpkg --print-architecture).tar.gz ``` 3. 解壓縮 ```shell tar xvf node_exporter-$NODE_EXPORTER_VERSION.linux-$(dpkg --print-architecture).tar.gz -C /opt/node_exporter ``` 4. 新增一個 service 執行 node-exporter - `/etc/systemd/system/node_exporter.service`: ```txt [Unit] Description=Node Exporter Wants=network-online.target After=network-online.target [Service] User=node-exporter Type=simple ExecStart=/opt/node_exporter/node_exporter --collector.systemd [Install] WantedBy=multi-user.target ``` 5. 啟動服務: ```shell sudo systemctl daemon-reload sudo systemctl enable --now node_exporter sudo systemctl status node_exporter ``` 6. 測試: ```shell curl http://<PVE_HOST>:9100/metrics ``` ### Prometheus 設定 新增 config 抓 node exporter: ``` scrape_configs: - job_name: node static_configs: - targets: ['localhost:9100'] ``` ### Grafana 設定 匯入 dashboard - [Node Exporter Full](https://grafana.com/grafana/dashboards/1860-node-exporter-full/) ID: `1860`