What is Pushgateway?

What is Pushgateway?

Table of Contents


Prometheus is an amazing tool, but it has limitations. Some of your applications, including batch jobs and ephemeral jobs, may not live long enough for it to find and scrape them.


Since Prometheus cannot scrape all jobs, the company developed Pushgateway as a bridge tool. Because you usually cannot push metrics directly to the Prometheus application, you can sometimes use a Pushgateway to deliver the necessary data. 


When you need monitoring solutions, try Metricfire. You’ll learn about the best open-source applications around. Visit the website today for a free trial and demo.



Key Takeaways

  1. Prometheus limitations: Prometheus struggles with scraping metrics from short-lived applications like batch jobs and ephemeral jobs.
  2. Introduction to Pushgateway: Pushgateway acts as a bridge tool, allowing these short-lived jobs to push their metrics to a cache that Prometheus can access.
  3. Use cases and limitations: Pushgateway is suitable for service-level batch jobs but not all short-lived jobs. Node exporter is recommended for jobs tied to long-living subjects.
  4. Pushgateway functionality: Pushgateway enables metric sending, scraping, deletion, and alerts, but has some consistency issues with metric exposure.


What is Pushgateway?

Pushgateway is a feature of Prometheus that allows ephemeral and batch jobs to expose their metrics to the application. Often, these types of jobs do not have a long enough lifecycle for software programs to scrape them and pull the vast amount of metrics necessary for effective network monitoring.


Instead, you can push your metrics to a Pushgateway that, in turn, exposes the metrics to Prometheus. Consider Pushgateway the middleman in metrics collection. You can push your short-lived batch and ephemeral jobs onto Pushgateway, using it as a metrics cache that then allows Prometheus to scrape them, even when the monitored subjects no longer exist.


This process differs from Prometheus' pull metrics application. With Pushgateway, your metrics series is continually exposed to Prometheus unless someone manually deletes it using Pushgateway's API. When Prometheus uses pull model metrics, it only has access to those instances that still exist. This application has client libraries for Go, Java, Scala, Python, and Ruby, making it useful for a wide audience.




What Are the Use-Cases of Pushgateway?

Pushgateway is not the answer for all your short-lifecycle jobs. Prometheus warns users that Pushgateway only works well in specific circumstances, particularly for service-level batch jobs such as deleting users' data that have requested to be deleted (the right to be forgotten).


Jobs that delete temporary files are not serviced batch jobs because they are tied to a long-living subject - the machine they run on. Exposing metrics for those jobs is best done by a node exporter or another method. 


For the node exporter, use:


tar -xzvf node_exporter-*.*.tar.gz cd node_exporter-*.* # Start 3 example targets in separate terminals: ./node_exporter --web.listen-address ./node_exporter --web.listen-address ./node_exporter --web.listen-address


Reminder: the file pattern can be a path ending in j.son, yaml and yml.


Curious about how MetricFire can help? Sign up for a free trial and demo and learn firsthand how we can benefit your business by providing sophisticated monitoring help.


Pushgateway Benefits and Challenges

Prometheus offers alternative strategies for when an inbound firewall or NAT prevents you from pulling metrics. For instance, you can move the Prometheus server behind the network barrier. Pushgateway is a valuable tool that is effective in limited situations. You cannot use it for all jobs whose metrics Prometheus cannot scrape. You can perform the following tasks with a Pushgateway:


  • Send metrics - Through a program that can perform web requests or by using a client library.
  • Scrape metrics - Often by statistically defining a Pushgateway target with scrape-configs.
  • Delete metrics - By clicking near the group of metrics in the UI, By the wipe end-point on the admin API, and by making an HTTP request with the verb DELETE.
  • Alert on metrics - informing you when someone tries to push inconsistent metrics, the Pushgateway has been pushing metrics in the expected timeframe, and when there is a Pushgateway shutdown.


Although Pushgateway has some consistency issues, exposing all pushed metrics together with its own metrics by using the same /metrics endpoint, it can save your metrics to disk for a defined time period by using the parameters "persistence.file= and --persistence.interval=. 


You will need to have some mounted-storage writable by one now to serve the traffic and the other that have persistent storage mounted as read-only. For those using Kubernetes, you can manage this task with a persistent volume claim with the mode ReadWriteOnce. You do have several options for making Pushgateway your metrics cache.


Pushgateway Metrics

By using the configured --web.telemetry-path (default: /metrics, you will expose the following metrics: 


  • Pushed metrics
  • Metric push-time-seconds and push-failure-time-second
  • Metrics provided by Prometheus Go client library
  • Specific metrics for Pushgateway such as # HELP pushgateway_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which pushgateway was built, and # TYPE pushgateway_build_info gauge.


Although this application has a very specific purpose, it can be an invaluable tool for a wide range of companies. To get started, just download the latest version of Prometheus and then extract it and run it using tar xvfz prometheus-*.tar.gz cd prometheus-*



How Can MetricFire Help?

Pushing metrics through this application can solve your metrics exposure problem with minimum effort. Their team can also help you with Pushgateway authentication, Prometheus static-configs, job labels and other factors that can make metric exposure challenging. You will have access to hosted Graphite monitoring and Grafana dashboards.


Reach out to us today for a MetricFire free trial and demo to see how we can meet your metric gathering needs.

You might also like other posts...
metricfire May 22, 2024 · 8 min read

How to Monitor Your Apache Tomcat Servers Using Telegraf and MetricFire

Monitoring your Apache Tomcat servers is crucial for your business because it ensures the... Continue Reading

metricfire May 17, 2024 · 8 min read

Step By Step Guide to Monitoring Your Apache HTTP Servers

Monitoring the performance of your Apache servers is vital for maintaining optimal operation and... Continue Reading

metricfire Apr 10, 2024 · 9 min read

Step-by-Step Guide to Monitoring Your SNMP Devices With Telegraf

Monitoring SNMP devices is crucial for maintaining network health and security, enabling early detection... Continue Reading

header image

We strive for
99.999% uptime

Because our system is your system.

14-day trial 14-day trial
No Credit Card Required No Credit Card Required