prometheus監控主機


上篇文章我們在IP:10.0.0.17上部署好了Prometheus,這篇文章我們在IP:10.0.0.18上安裝node_exporter,用Prometheus來監控遠端的主機。

1.node_exporter軟件下載

1.官網地址:https://prometheus.io/download/

2.選擇node_exporter然后下載

2.安裝node組件

在被監控端agent上安裝node_exporter組件,這樣prometheus就可以接收到被監控端的數據了

1.上傳軟件包到Linux服務器上(agent被監控端)

2.解壓node_exporter組件
 tar xf node_exporter-1.3.0.linux-amd64.tar.gz  -C /usr/local/
 
 3.創建軟連接,以后如果版本需要升級,重新指定源文件即可。
 cd /usr/local/
 ln -sv  node_exporter-1.3.0.linux-amd64  node_exporter

3.啟動node_exporter

1.后台啟動node_exporter
nohup /usr/local/node_exporter/node_exporter &

2.查看端口信息
netstat -tunlp |grep 9100

通過瀏覽器訪問:IP/meterics ------> http://10.0.0.18:9100/metrics

4.讓prometheus拉取node節點信息

Prometheus服務器的配置文件里添加被監控機器配置
IP:10.0.0.17上操作
1.在prometheus配置文件添加,如下3行信息
[root@prometheus-17 ~]# tail -3 /usr/local/prometheus/etc/prometheus.yml
  - job_name: 'agent'
    static_configs:
    - targets: ['10.0.0.18:9100']

2.設置完成之后重啟Prometheus
systemctl restart prometheus.service 
systemctl status  prometheus.service 

5.查看主機是否被監控到

瀏覽器訪問IP:9090


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM