centos9(linux): 安装prometheus服务端2.55(centos stream9)
一,官方下载地址:
https://www.prometheus.io/download/
如图:
二,下载
用wget从命令行下载
[root@backup prometheus]# wget https://github.com/prometheus/prometheus/releases/download/v2.55.0/prometheus-2.55.0.linux-amd64.tar.gz
三,安装
1,解压
[root@backup prometheus]# tar -zxvf prometheus-2.55.0.linux-amd64.tar.gz
2,把解压后的目录移动到安装目录下:
[root@backup prometheus]# mv prometheus-2.55.0.linux-amd64 /usr/local/soft/
四,用systemctl管理prometheus
1,创建服务文件
[root@backup prometheus]# vi /lib/systemd/system/prometheus.service
内容:
[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/soft/prometheus-2.55.0.linux-amd64/prometheus --config.file="/usr/local/soft/prometheus-2.55.0.linux-amd64/prometheus.yml"
LimitNOFILE=65536
PrivateTmp=true
RestartSec=2
StartLimitInterval=0
Restart=always
[Install]
WantedBy=multi-user.target
2,重新加载service文件
[root@backup prometheus]# systemctl daemon-reload
启动prometheus服务:
[root@backup prometheus]# systemctl start prometheus.service
五,测试效果:
1,用ss查看端口是否打开:
[root@backup prometheus]# ss -lntp | grep 9090
LISTEN 0 4096 *:9090 *:* users:(("prometheus",pid=468312,fd=6))
2,从浏览器查看效果:
访问服务器的9090端口即可