Skip to main content
This lesson shows how to install Prometheus Pushgateway, run it for testing, and configure Prometheus to scrape it. Use Pushgateway when short-lived or batch jobs need to push metrics to Prometheus.

1) Download Pushgateway

Download the latest Pushgateway release from the official GitHub Releases page:
The image shows a webpage for downloading the Prometheus Pushgateway with options for different operating systems and corresponding file details such as architecture, size, and SHA256 checksum.

2) Extract and run (quick test)

After downloading the release tarball on your server, extract it and change into the extracted directory:
For a quick test you can run the pushgateway binary directly; it listens on port 9091 by default:
Open another terminal and verify the metrics endpoint:
Run Pushgateway under systemd to ensure it starts on boot and is managed consistently. Create a dedicated system user and install the binary:
Create the systemd unit file at /etc/systemd/system/pushgateway.service with the following content:
Reload systemd, start and enable the service:

Quick reference: common commands and locations

If your server has a firewall (for example ufw or firewalld), ensure port 9091 is open for Prometheus scrapes or only allow access from Prometheus servers. Running services as root is not recommended — the example above uses a dedicated unprivileged pushgateway user.

4) Configure Prometheus to scrape Pushgateway

Add Pushgateway as a scrape target in your prometheus.yml. In many setups you should enable honor_labels: true so label values pushed by clients (for example job and instance) are preserved in Prometheus instead of being replaced by the Pushgateway scrape labels. Example prometheus.yml snippet:
Use honor_labels: true when multiple jobs push metrics to Pushgateway and you want the original job and instance labels from the pushing clients to be preserved in Prometheus. Without this, Prometheus will overwrite those labels with the Pushgateway’s own scrape labels.

5) Verify end-to-end

  1. Push a sample metric from a client (example using curl):
  1. Confirm metrics are visible on Pushgateway:
  1. Confirm Prometheus scrapes the Pushgateway and the metric appears in Prometheus targets and in PromQL queries (use the Prometheus UI at /targets and /graph).

Troubleshooting tips

  • If metrics don’t appear in Prometheus:
    • Verify prometheus.yml has the correct address and that Prometheus has reloaded.
    • Check honor_labels behavior — it may affect label attribution.
    • Confirm network/firewall rules allow Prometheus to reach port 9091.
  • Check logs:
    • Pushgateway logs: journalctl -u pushgateway
    • Prometheus logs: journalctl -u prometheus or view Prometheus UI logs.

Watch Video