Prometheus監控遠程liunx主機

需要先安裝Prometheus,如未安裝可查看:
我的另一篇文章【開源的監控Prometheus 安裝部署】
首先在遠程linux上安裝node_export組件,幫助prometheus來收集數據。
從官網下載 node_exporter-1.0.1.linux-amd64.tar.gz
下載地址:https://prometheus.io/download/

tar -xvf node_exporter-1.0.1.linux-amd64.tar.gz
mv node_exporter-1.0.1.linux-amd64 node_exporter
cd node_exporter
#啓動node_exporter來收集數據
nohup ./node_exporter &

nohup 是 Linux 的一個常用命令,當你想要在退出賬戶或者關閉終端後進程仍在運行時,就可以使用 nohup 命令。nohup 就是不掛斷的意思(no hang up)。

查看9100端口占有情況

[root@VM_0_8_centos node_exporter]# lsof -i:9100
COMMAND     PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
node_expo 23251 root    3u  IPv6 143217964      0t0  TCP *:jetdirect (LISTEN)

查看監控信息

配置prometheus server端拉取node信息

pkill prometheus   #殺掉prometheus進程
ss -nltup | grep 9090   #查看prometheus是否已經被kill

在文件/usr/local/prometheus/prometheus.yml最後添加

- job_name: 'agent'

    static_configs:
      - targets: ['49.234.203.221:9100']

重新啓動prometheus

./prometheus &
ss -naltp |grep 9090


收集成功

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章