The repository contains a sample Node.js app that integrates the Prometheus client for node.js and exposes metrics on http://localhost:8080/metrics. The metrics are periodically scraped by Prometheus and visualized through a Grafana monitoring dashboard.
Make sure that you have Docker and Docker Compose installed:
Clone the repository:
git clone [email protected]:seb-lean/grafana-dashboard-as-code.git
Navigate into the project directory:
cd grafana-dashboard-as-code
Start the Docker containers:
docker compose up --build
You should now be able to see the generated Grafana dashboards at http://localhost:3000/d/empty_dashboard/my-cool-dashboard
- Prometheus should be accessible via http://localhost:9090. eg query http_request_duration_ms_count
- Grafana should be accessible via http://localhost:3000
- Example Node.js server metrics for monitoring should be accessible via http://localhost:8080/metrics
This demo uses Jsonnet and Grafonnet to programmatically build the JSON used to describe dashboard and panels.
As per the Grafonnet docs, we also use Grizzly to watch for changes and deploy them. Once Docker is running you can even make changes to main.jsonnet
and they'll automatically be reflected on Grafana. Just refresh!