1.xshell连接服务器或虚拟机

使用xftp连接,把对应的软件包传送过去

2.解压node_exporter和prometheus压缩包

tar -zxvf node_exporter-1.4.0.linux-amd64.tar.gz #解压
mv node_exporter-1.4.0.linux-amd64 node_exporter #重命名
tar -zxvf prometheus-2.39.1.linux-amd64.tar.gz #解压
mv prometheus-2.39.1.linux-amd64 prometheus #重命名

3.切到prometheus目录,并给配置文件755权限

cd prometheus
chmod 755 prometheus.yml

4.编辑配置文件

vi prometheus.yml ,追加对应的信息

5.安装Grafana,并启动服务

yum install grafana-enterprise-9.2.0-1.x86_64.rpm #安装grafana
systemctl start grafana-server #开启grafana服务
systemctl enable grafana-server #开机自启grafana服务

6.启动prometheus

cd prometheus
./prometheus --config.file=prometheus.yml

7.启动node_exporter

cd node_exporter

./node_exporter

 

8.打开prometheus

访问https://虚拟机或服务器ip:9090,查看prometheus和node_exporter是否全部启动

9.打开grafana配置信息并展示

访问http://服务器ip或虚拟机ip:3000/login输入用户名/密码 admin/admin

 

 

登录进去配置数据源

配置url

选择save& test 如果有下图表示成功导入对应的模板信息

选择数据源,导入