繼續 Raspberry pi 安裝 Nginx_vts_exporter 文章
再往下新增Prometheus功能
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 42 43 |
# 下載 prometheus $ wget https://github.com/prometheus/prometheus/releases/download/v2.14.0/prometheus-2.14.0.linux-armv7.tar.gz # 解壓縮 $ tar -zxvf prometheus-2.14.0.linux-armv7.tar.gz # 修改 prometheus.yml targets要改成Nginx-vts-exporter輸出網址 $ nano prometheus-2.14.0.linux-armv7/prometheus.yml # static_configs: # - targets: ['localhost:9913'] # 新增系統服務 $ sudo nano /etc/systemd/system/prometheus.service # 新增以下內容 [Unit] Description=Prometheus Metrics After=network.target [Service] Type=simple User=pi ExecStart=/home/pi/prometheus-2.14.0.linux-armv7/prometheus --storage.tsdb.retention.time=30d WorkingDirectory=/home/pi/prometheus-2.14.0.linux-armv7/ Restart=always RestartSec=10 [Install] WantedBy=multi-user.target #完成後,儲存離開 # 系統重新讀取服務 $ sudo systemctl daemon-reload # 設定開機自動執行 $ sudo systemctl enable prometheus # 啟動prometheus $ sudo systemctl start prometheus # 查詢執行狀況 $ sudo systemctl status prometheus |
完成後即可以到http://localhost:9090,觀看prometheus運行狀況
http://localhost:9090/targets
Reference