Prometheus 監控安裝
官方手冊請參閱:https://prometheus.io/docs/prometheus/latest/getting_started/
Prometheus 安裝文檔:
-
本測試需要的環境:
系統: centos7 -
安裝:
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" &
-
查看端口是否啓動
]# netstat -ntlp | grep 9090
tcp6 0 0 :::9090 :::* LISTEN 4456/prometheus
- 訪問瀏覽器
如果服務啓動,無法訪問,在網頁中無法訪問說明防火牆未放行(即使防火牆關閉)
配置防火牆放行端口 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