Skip to content

ramesh-lingappan/prometheus-pushgateway-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Prometheus PushGateway Demo

This is a demo console app using Spring Boot 2.2 with Micrometer to publish metrics to Prometheus using Prometheus Push Gateway.

The Prometheus Pushgateway exists to allow ephemeral and batch jobs to expose their metrics to Prometheus. Since these kinds of jobs may not exist long enough to be scraped, they can instead push their metrics to a Pushgateway. The Pushgateway then exposes these metrics to Prometheus.

Setup

Prometheus Push Gateway (without basic authentication)

Using the docker-compose command setup the necessary services

cd setup
docker-compose up

Prometheus Push Gateway (with basic authentication)

Using the docker-compose command setup the necessary services

cd setup-security
docker-compose up

This will setup Prometheus & PushGateway instances

Second, open the browser and access the address

  • Prometheus : http://localhost:9090
  • PushGateway : http://localhost:9091 (9092 incase basic auth is enabled)

Application

Start the application

mvn spring-boot:run

with security enabled, this will use basic authentication to connect to push-gateway

mvn spring-boot:run -Drun.profiles=secure

NOTE: make you the basic auth credentials used in htpasswd and application.yml are same.

Testing

Once the application has completed running,

Open the Prometheus Push Gateway http://localhost:9091 and see the metrics, mainly the hello_counter

You can also open Prometheus dashboard http://localhost:9090 to check the metrics

About

Sample demo app for Prometheus PushGateway

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages