部署安装prometheus pushgateway
- 下载安装包
官方下载地址:https://prometheus.io/download/
下载历史版本:https://github.com/prometheus/pushgateway/releases
wget https://github.com/prometheus/pushgateway/releases/download/v1.4.2/pushgateway-1.4.2.linux-amd64.tar.gz - 解压安装
tar -xf pushgateway-1.4.2.linux-amd64.tar.gz -C /data/app
mv /data/app/pushgateway-1.4.2.linux-amd64/ /data/app/pushgateway - 创建用户
groupadd prometheus
useradd prometheus -g prometheus -M -s /sbin/nologin
- 编写服务启动脚本
vim /usr/lib/systemd/system/pushgateway.service
[Unit]
Description=pushgateway
Documentation=https://prometheus.io/
After=network.target[Service]
Type=simple
User=prometheus
ExecStart=/data/app/pushgateway/pushgateway
Restart=on-failure[Install]
WantedBy=multi-user.target - 服务开机自启动
systemctl daemon-reload
systemctl start pushgateway.service
systemctl status pushgateway.service
systemctl enable pushgateway.service
systemctl is-enabled pushgateway.service
修改prometheus
cd prometheus
vim cfg/prometheus.yml
- job_name: 'pushgateway'
static_configs:
- targets: ['master.prometheus:9091']
重点:添加完配置之后重启prometheus服务才生效

浙公网安备 33010602011771号