一、Prometheus的简介
Prometheus是一种开源的监控和警报工具,用于收集、存储和查询各种系统和服务的指标数据。它具有灵活的查询语言和强大的可视化功能,可用于实时监控应用程序性能和状态。
二、prometheus监控体系
三、Rocky Linux系统安装
链接:VMware Workstation 下载安装(含秘钥)
链接:VMware Workstation 创建虚拟机
链接:Rocky_Linux 下载安装教程
链接:Rocky_Linux 网卡静态配置教程
链接:MobaXterm 下载安装
四、Rocky Linux安装部署Prometheus
1、官网下载地址
链接:https://prometheus.io/download/
2、筛选“linux",“amd64”
3、向下拖动至“prometheus”,点击下载“最新安装包”
3、上传至root目录下
教程链接:SFTP文件上传/下载教程
4、查看文件是否已上传
[root@localhost ~]# ll
教程链接:Rocky Linux 运维工具 ls
5、把preometheus解压缩至/opt/
[root@localhost ~]# tar zxvf prometheus-2.50.0-rc.0.linux-amd64.tar.gz -C /opt/
教程链接:Rocky Linux 运维工具 tar
6、查看目录文件
[root@localhost ~]# ls -l /opt
教程链接:Rocky Linux 运维工具 ls
6、重命名prometheus
[root@localhost ~]# mv /opt/prometheus-2.50.1.linux-amd64 /opt/prometheus
教程链接:Rocky Linux 运维工具 mv
7、查看目录文件
[root@localhost ~]# ls -l /opt
教程链接:Rocky Linux 运维工具 ls
8、创建用户组prometheus
[root@localhost ~]# groupadd prometheus
教程链接:Rocky Linux 运维工具 groupadd
9、创建用户
[root@localhost ~]# useradd -g prometheus -m -s /sbin/nologin prometheus
10、目录授权
[root@localhost ~]# chown prometheus:prometheus -R /opt/prometheus
11、创建prometheus服务
[root@localhost ~]# vim /etc/systemd/system/prometheus.service
1 [Unit]
2 Description=prometheus
3 After=network.target
4 [Service]
5 Type=simple
6 User=prometheus
7 ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml --storage.tsdb.path=/opt/prometheus/data
8 Restart=on-failure
9 [Install]
10 WantedBy=multi-user.target
教程链接:Rocky Linux 运维工具 vim
教程链接:Rocky Linux 运维工具 systemd
12、加载服务
[root@localhost ~]# systemctl daemon-reload
教程链接:Rocky Linux 运维工具 systemctl
13、开机自启
[root@localhost ~]# systemctl enable prometheus.service
教程链接:Rocky Linux 运维工具 systemctl
14、启动服务
[root@localhost ~]# systemctl start prometheus.service
教程链接:Rocky Linux 运维工具 systemctl
15、服务状态
[root@localhost ~]# systemctl status prometheus.service
教程链接:Rocky Linux 运维工具 systemctl
16、开放9090端口
[root@localhost ~]# firewall-cmd --zone=public --add-port=9090/tcp --permanent
教程链接:Rocky Linux 运维工具 firewall-cmd
17、加载策略
[root@localhost ~]# firewall-cmd --reload
教程链接:Rocky Linux 运维工具 firewall-cmd
18、浏览器访问192.168.100.10:9090,点击“Status”,点击“Targets”
17、prometheus部署完成,运行正常
18、访问http://192.168.100.10:9090/metrics,可以查看到监控的数据