Prometheus 监控安装

Prometheus 监控安装

官方手册请参阅:https://prometheus.io/docs/prometheus/latest/getting_started/

Prometheus 安装文档:

  1. 本测试需要的环境:
    系统: centos7

  2. 安装:

    wget https://github.com/prometheus/prometheus/releases/download/v2.14.0/prometheus-2.14.0.linux-amd64.tar.gz
    
    tar xf prometheus-2.14.0.linux-amd64.tar.gz
    
    # 拷贝两个工具包
    cp prometheus-2.14.0.linux-amd64/{prometheus,prometool} /usr/local/bin/
    
    # 查看版本
    prometheus --version
    
    # 备份配置文件
    cd prometheus-2.14.0.linux-amd64
    cp prometheus.yml prometheus.yul.bak
    
    # 拷贝配置文件到 etc
    mkdir -p /etc/prometheus
    cp prometheus.yml /etc/prometheus/
    
    # 测试配置文件内 内容是否正确
    promtool check config /etc/prometheus/prometheus.yml
    
    # 后台启动 prometheus
    prometheus --config.file "/etc/prometheus/prometheus.yml" &
    
  3. 查看端口是否启动

]# netstat -ntlp | grep 9090
tcp6       0      0 :::9090            :::*       LISTEN     4456/prometheus 
  1. 访问浏览器

在这里插入图片描述

如果服务启动,无法访问,在网页中无法访问说明防火墙未放行(即使防火墙关闭)
配置防火墙放行端口 9090:

# 查看防火墙是否开启
systemctl status firewalld

# 如果未开启防火墙,请开启防火墙,不然无法配置放行
systemctl start firewalld

# 配置放行端口
firewall-cmd --permanent --add-port=9090/tcp

# 重新加载防火墙
firewall-cmd --reload

# 查看那些端口被放行
firewall-cmd --list-ports
3000/tcp 443/tcp 80/tcp 9090/tcp 20/tcp 21/tcp 10051/tcp
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章