to test / validate your metrics...
Prometheus is configured to "scrape" the node-exporter container. This container is not necessary, but illustrates how you can add your own LOCAL Java/Go service to be scraped as well.
- First download required files: https://github.com/bolcom/local-prometheus-grafana/archive/refs/heads/master.zip
- Unzip contents
- Run
docker-compose up
inside directory. - Then open grafana: http://localhost:3000/.
- Log-in with username
foo
and passwordbar
. - There is already a dashboard
test
created with one graph, fetching data out of the local prometheus instance. Wait a few minutes, then the data will arrive.
- prometheus server: http://localhost:9090/ (see targets here: http://localhost:9090/targets)
- grafana: http://localhost:3000/
- node-exporter: http://localhost:9100/metrics
When all containers are started, open grafana and open the "test" dashboard.
Simple, change the prometheus config file (prometheus.yml
) and add a new target. Since the whole stack is running in docker containers, you should connect to host.docker.internal:<<your-port>>
. An example can be found in the config file, just uncomment it.
See this blogpost: https://techlab.bol.com/how-to-validate-your-apps-metrics-on-a-local-grafana-instance/