A VERY simple PHP, Prometheus & Grafana setup to get started with business metrics
Assuming you have installed docker
and docker-compose
on your machine, go to the root directory of this project and run
docker-compose up -d
to fire up the following service setup.
-
nginx
will provide three URLs: -
http://127.0.0.1:8080 - The php script that provides metrics to the prometheus instance
-
http://127.0.0.1:9090 - The prometheus instance web frontend
-
http://127.0.0.1:3000 - The grafana instance web frontend
-
php
will provide the PHP-FPM to run your PHP script under/public/metrics.php
-
prometheus
will collect metrics from your PHP script unter http://127.0.0.1:8080/metrics.php -
grafana
will visualize metrics with the prometheus instance as its data source
- openmetrics-php/exposition-text to produce metrics in the OpenMetrics format that prometheus understands.
- You can find the config for the nginx:latest docker image here.
- The default configuration from the php:7.3-fpm-alpine docker image is used.
- You can find the config for the prom/prometheus docker image here.
- The default configuration from the grafana/grafana:latest docker image is used.