二进制安装prometheus
下载prometheus
解压到指定目录
mkdir /opt/app
tar xvf prometheus-2.29.1.linux-amd64.tar.gz -C /opt/app
mv /opt/app/prometheus-2.29.1.linux-amd64 /opt/app/prometheus
准备service文件
cat <<-"EOF" > /etc/systemd/system/prometheus.service
[Unit]
Description="prometheus"
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
ExecStart=/opt/app/prometheus/prometheus --config.file=/opt/app/prometheus/prometheus.yml --storage.tsdb.path=/opt/app/prometheus/data --web.enable-lifecycle # 表示启用热加载配置 curl -X POST 127.0.0.1:9090/-/reload 可能会有安全问题
Restart=on-failure
RestartSecs=5s
SuccessExitStatus=0
LimitNOFILE=655360
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=prometheus
[Install]
WantedBy=multi-user.target
EOF
启动prometheus 服务
systemctl daemon-reload
systemctl restart prometheus
systemctl status prometheus
检查prometheus服务
# 查看端口 进程 日志
ss -ntlp |grep 9090
ps -ef |grep prometheus |grep -v grep
tail -100 /var/log/messages |grep prometheus
Comments NOTHING