prometheus+grafana监控添加新节点

mac2024-03-26  31

已部署好prometheus+grafana,并能正常运行 在Client端先部署好已经编写好的node_exporter 编写脚本并执行

#! /bin/bash wget http://IP/node.tar.gz ##获取编写好的node tar zxvf node.tar.gz -C /usr/local/ ##解压 mv /usr/local/node_exporter-0.18.1.linux-amd64/ /usr/local/node_exporter ##放到默认目录下面去 /usr/local/node_exporter/node_exporter --web.listen-address=":9101" & ##后台静默运行监听9101端口 rm node.tar.gz

在Client端打开9101端口

firewall-cmd --zone=public --add-port=9101/tcp --permanent ##防火墙上public区开放9101端口 firewall-cmd --reload #重启防火墙(修改配置后要重启防火墙)

在Server端prometheus中修改配置文件

cd /usr/local/prometheus-2.11.1.linux-amd64/ vim prometheus.yml

添加如下内容

- targets: ['*ClientIP*:9101'] labels: instance: *name*

重启

ps -ef |grep prometheus kill -9 *PID* ./prometheus --config.file=prometheus.yml &

然后在grafana页面刷新即可

最新回复(0)