Skip to content

Instantly share code, notes, and snippets.

@rodrigo-galba
Last active June 11, 2021 14:08
Show Gist options
  • Save rodrigo-galba/4abce43b3f36173702929bac3eb4d1a6 to your computer and use it in GitHub Desktop.
Save rodrigo-galba/4abce43b3f36173702929bac3eb4d1a6 to your computer and use it in GitHub Desktop.
Prometheus + Push gateway setup

Prometheus + Push gateway setup

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment