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


收集成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值