首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >prometheus部署教程(一)

prometheus部署教程(一)

原创
作者头像
用户10662715
发布2025-04-11 15:50:28
发布2025-04-11 15:50:28
1K0
举报

prometheus IP

被监控主机ip

192.168.43.166

192.168.43.149

1、prometheus 安装

(1)下载文件:

# wget https://github.com/prometheus/prometheus/releases/tag/v3.2.1/prometheus-3.2.1.linux-amd64.tar.gz

(2)解压安装包:

[root@localhost ~]#tar xvf prometheus-3.2.1.linux-amd64.tar.gz -C /usr/local/

[root@localhost ~]#mv /usr/local/ prometheus-3.2.1.linux-amd64 /usr/local/prometheus

(3)创建数据启动和数据目录

[root@localhost ~]#mkdir -p /etc/prometheus /var/lib/prometheus

[root@localhost ~]#cp /usr/local/prometheus/prometheus.yml /etc/prometheus/

(4)创建service文件:

[root@localhost ~]#vim /etc/systemd/system/prometheus.service

[Unit]

Description=Prometheus Monitoring System

After=network.target

[Service]

ExecStart=/usr/local/prometheus/prometheus \

--config.file=/etc/prometheus/prometheus.yml \

--storage.tsdb.path=/var/lib/prometheus \

--web.listen-address=:9090 \

--web.enable-lifecycle

Restart=on-failure

[Install]

WantedBy=multi-user.target

(5)重载配置并启动服务

systemctl daemon-reload

systemctl start prometheus

systemctl enable prometheus   

systemctl status prometheus

(6)关闭防火墙

(7)页面上访问

2、监控主机(node_exporter)安装

(1)下载安装包

下载并解压:

wget https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz

[root@localhost ~]# tar -zxvf node_exporter-1.6.1.linux-amd64.tar.gz -C /usr/local/

[root@localhost ~]# mv /usr/local/node_exporter-1.6.1.linux-amd64 /usr/local/node_exporter

(2)创建service文件:

[root@localhost ~]# vi /etc/systemd/system/node_exporter.service

[Unit]

Description=node_exporter

After=network.target

[Service]

User=root

ExecStart=/usr/local/node_exporter/node_exporter

Restart=on-failure

[Install]

WantedBy=multi-user.target

(3)重载配置并启动服务

[root@localhost ~]# systemctl daemon-reload

[root@localhost ~]# systemctl start node_exporter

(4)关闭防火墙

(5)在promethues的配置文件上添加主机信息

[root@localhost ~]# vim /etc/prometheus/prometheus.yml

(6)重启promethues

(7)登录prometheus页面查看主机已经被监控到了

到此prometheus监控主机的配置已完成,

3、验证cpu,内存,存储

(1)cpu信息

(2)内存信息

(3)存储信息

页面上还可以查看网络,io,端口等主机信息都可以监控,这里不一一展示。

接下来分享mysql_exporter,redis_exporter和grafana等,请各位大佬指教。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、prometheus 安装
  • 2、监控主机(node_exporter)安装
  • 3、验证cpu,内存,存储
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档