Skip to content

rajesh-agrawal/PrometheusClient

Repository files navigation

👋 Getting Started with Prometheus, Grafana

How to Run?

  1. Create a docker network interface for prometheus,grafana and Java application to talk to each other.
docker network create grafana-prometheus
  1. Run the prometheus container with prometheus.yaml, I am exposing it the port to be 9095 instead of 9090 as its already occupied on my machine
docker run --name my-prometheus  --network grafana-prometheus --network-alias prometheus   --mount type=bind,source=C:/work/setup/prometheus/prometheus.yml,destination=/etc/prometheus/prometheus.yml -p 9095:9090 prom/prometheus

PROMETHEUS SCRAPES metrics from application by polling

  1. Confirm if prometheus runs and shows docker metrics Prometheus local setup
  2. Run the grafana container to persist data across multiple restarts of docker. You need to create a C:/work/setup/prometheus/grafana directory to persist data on main machine.
docker run --rm --name grafana2 --network grafana-prometheus --network-alias grafana --publish 3000:3000 -v C:/work/setup/prometheus/grafana:/var/lib/grafana  --detach grafana/grafana-oss:latest
  1. Confirm if Grafana is running Grafana local setup

  2. To display Prometheus metrics in Grafana:

    • Log into Grafana (default username "admin" and password "admin").
    • Go to Configuration > Data sources
    • Click Add data source
    • Pick Prometheus as the data type
    • Set the URL as http://prometheus:9090 and click Save & test down the bottom.
    • We use "prometheus" instead of "localhost" because that's the internal network name for our Prometheus container (within the network "grafana-prometheus").
  3. Run The spring Boot app

  4. Grafana Screenshots for built in ☕ JVM metrics JVM Dashboard - Grafana

  5. Grafana Screenshots for custom visitor count Visitor Count

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages