sudo useradd -M -r -s /bin/false pushgateway
wget https://github.com/prometheus/pushgateway/releases/download/v1.2.0/pushgateway-1.2.0.linux-amd64.tar.gz
tar xvfz pushgateway-1.2.0.linux-amd64.tar.gz
sudo cp pushgateway-1.2.0.linux-amd64/pushgateway /usr/local/bin/
sudo chown pushgateway:pushgateway /usr/local/bin/pushgateway
sudo vi /etc/systemd/system/pushgateway.service
[Unit]
Description=Prometheus Pushgateway
Wants=network-online.target
After=network-online.target
[Service]
User=pushgateway
Group=pushgateway
Type=simple
ExecStart=/usr/local/bin/pushgateway
[Install]
WantedBy=multi-user.target
sudo systemctl enable pushgateway
sudo systemctl start pushgateway
sudo systemctl status pushgateway
curl localhost:9091/metrics
sudo vi /etc/prometheus/prometheus.yml
- job_name: 'Pushgateway'
honor_labels: true
static_configs:
- targets: ['localhost:9091']
sudo systemctl restart prometheus sudo systemctl status prometheus curl 3.239.169.164:9090/api/v1/