|
| 1 | +# Prometheus Pushgateway |
| 2 | + |
| 3 | +[][circleci] |
| 4 | +[][quay] |
| 5 | +[][hub] |
| 6 | + |
| 7 | +The Prometheus Pushgateway exists to allow ephemeral and batch jobs to |
| 8 | +expose their metrics to Prometheus. Since these kinds of jobs may not |
| 9 | +exist long enough to be scraped, they can instead push their metrics |
| 10 | +to a Pushgateway. The Pushgateway then exposes these metrics to |
| 11 | +Prometheus. |
| 12 | + |
| 13 | +## Non-goals |
| 14 | + |
| 15 | +First of all, the Pushgateway is not capable of turning Prometheus into a |
| 16 | +push-based monitoring system. For a general description of use cases for the |
| 17 | +Pushgateway, please read [When To Use The |
| 18 | +Pushgateway](https://prometheus.io/docs/practices/pushing/). |
| 19 | + |
| 20 | +The Pushgateway is explicitly not an _aggregator or distributed counter_ but |
| 21 | +rather a metrics cache. It does not have |
| 22 | +[statsd](https://github.com/etsy/statsd)-like semantics. The metrics pushed are |
| 23 | +exactly the same as you would present for scraping in a permanently running |
| 24 | +program. If you need distributed counting, you could either use the actual |
| 25 | +statsd in combination with the [Prometheus statsd |
| 26 | +exporter](https://github.com/prometheus/statsd_exporter), or have a look at the |
| 27 | +[prom-aggregation-gateway](https://github.com/zapier/prom-aggregation-gateway). With more |
| 28 | +experience gathered, the Prometheus project might one day be able to provide a |
| 29 | +native solution, separate from or possibly even as part of the Pushgateway. |
| 30 | + |
| 31 | +For machine-level metrics, the |
| 32 | +[textfile](https://github.com/prometheus/node_exporter/blob/master/README.md#textfile-collector) |
| 33 | +collector of the Node exporter is usually more appropriate. The Pushgateway is |
| 34 | +intended for service-level metrics. |
| 35 | + |
| 36 | +The Pushgateway is not an _event store_. While you can use Prometheus as a data |
| 37 | +source for |
| 38 | +[Grafana annotations](http://docs.grafana.org/reference/annotations/), tracking |
| 39 | +something like release events has to happen with some event-logging framework. |
| 40 | + |
| 41 | +A while ago, we |
| 42 | +[decided to not implement a “timeout” or TTL for pushed metrics](https://github.com/prometheus/pushgateway/issues/19) |
| 43 | +because almost all proposed use cases turned out to be anti-patterns we |
| 44 | +strongly discourage. You can follow a more recent discussion on the |
| 45 | +[prometheus-developers mailing list](https://groups.google.com/forum/#!topic/prometheus-developers/9IyUxRvhY7w). |
| 46 | + |
| 47 | +## Run it |
| 48 | + |
| 49 | +Download binary releases for your platform from the |
| 50 | +[release page](https://github.com/prometheus/pushgateway/releases) and unpack |
| 51 | +the tarball. |
| 52 | + |
| 53 | +If you want to compile yourself from the sources, you need a working Go |
| 54 | +setup. Then use the provided Makefile (type `make`). |
| 55 | + |
| 56 | +For the most basic setup, just start the binary. To change the address |
| 57 | +to listen on, use the `--web.listen-address` flag (e.g. "0.0.0.0:9091" or ":9091"). |
| 58 | +By default, Pushgateway does not persist metrics. However, the `--persistence.file` flag |
| 59 | +allows you to specify a file in which the pushed metrics will be |
| 60 | +persisted (so that they survive restarts of the Pushgateway). |
| 61 | + |
| 62 | +### Using Docker |
| 63 | + |
| 64 | +You can deploy the Pushgateway using the [prom/pushgateway](https://hub.docker.com/r/prom/pushgateway) Docker image. |
| 65 | + |
| 66 | +For example: |
| 67 | + |
| 68 | +```bash |
| 69 | +docker pull prom/pushgateway |
| 70 | + |
| 71 | +docker run -d -p 9091:9091 prom/pushgateway |
| 72 | +``` |
| 73 | + |
| 74 | +## More documentation |
| 75 | + |
| 76 | +Please refer to the [full length |
| 77 | +README.md](https://github.com/prometheus/pushgateway/blob/master/README.md) for |
| 78 | +more documentation. |
0 commit comments