Relution-Monitoring with Grafana (Optional)
Introduction
Relution provides a variety of metrics that can be visualised using Grafana.
Below we have provided a basic configuration for a Docker setup and two dashboards.
These configurations can be adapted according to your own needs.
Configuration
Necessary files and directories
As mentioned, the configurations are available, can be downloaded here →.
Files
- docker-compose.yml
- Contains the configurations of the Docker containers
Prometheus
andGrafana
.
- Contains the configurations of the Docker containers
- prometheus.yml
- Contains the configuration of
Prometheus
.
- Contains the configuration of
- .env
- Contains the variables
GF_SECURITY_ADMIN_USER
andGF_SECURITY_ADMIN_PASSWORD
.
For productive operation it is recommended to change the password.
- Contains the variables
Subfolder
Dashboards
Sample dashboards: The configuration files for two sample dashboards are included. These dashboards are automatically imported into the Grafana Docker container.Provisioning
Base configurations: The configuration files for the Prometheus data source and the two sample dashboards are included. These configurations can be adapted as required.
Integration of the docker-compose.yml
The docker-compose.yml described here can be used in two ways:
Standalone The file can be used as a standalone file.
Content The content of the can be included in an existing docker-compose.yml.
In our example, the content of the file is included in the existing docker-compose.yml
.
In this case, it is important that the files and directories of the volumes are in the appropriate place and have the correct permissions.
In our docker-compose.yml
the containers mariadb, relution and nginx are present, so lines two to four have only been inserted for orientation.
services: # already present
# mariadb: already present
# relution: already present
# nginx: already present
prometheus:
image: prom/prometheus:${DOCKER_PROMETHEUS:-latest}
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
networks:
relution-network:
ports:
- "${PORT_PROMETHEUS:-9090}:9090"
expose:
- "9090"
logging:
driver: "json-file"
options:
max-size: "${DOCKER_PROMETHEUS_LOGSIZE:-8m}"
max-file: "4"
compress: "true"
grafana:
image: grafana/grafana:${DOCKER_GRAFANA:-latest}
volumes:
- ./provisioning:/etc/grafana/provisioning
- ./dashboards:/var/lib/grafana/dashboards
depends_on:
- prometheus
environment:
# set the placeholder in dashboard, to the actual name of datasource
- "DS_PROMETHEUS=Prometheus"
# set grafana default admin user
- "GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER}"
# set grafana default admin password
- "GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}"
networks:
relution-network:
ports:
- "${PORT_GRAFANA:-3000}:3000"
expose:
- "3000"
logging:
driver: "json-file"
options:
max-size: "${DOCKER_GRAFANA_LOGSIZE:-8m}"
max-file: "4"
compress: "true"
In the docker-compose.yml
the ports for Prometheus and Grafana are set to 9090 and 3000 respectively.
This section can be inserted into the existing docker-compose.yml
for the example.
Adjusting the .env file
For security, it is recommended to adjust the password parameter.
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=password
Anpassungen der prometheus.yml Datei
global:
# Default scrape interval
scrape_interval: 15s
scrape_configs:
# Job to scrape Prometheus metrics
- job_name: "prometheus"
scrape_interval: 5s
static_configs:
- targets: ["localhost:9090"]
- job_name: "relution"
# Job to scrape application metrics
metrics_path: "/actuator/prometheus"
scrape_interval: 5s
static_configs:
# Call the docker host inside container
- targets: ["relution:8099"]
In our concrete setup, the last line must contain the name of the container and the port 8099, in this case relution:8099
.
With the command docker ps
, the name and port of the container used can be checked and then adjusted if necessary.
When the containers are downloaded and started with docker compose down
or docker compose up -d
, the Grafana UI is accessible under the IP of the server
and port 3000
.
Two dashboards are now available.
Dashboards
Relution Server Dashboard:
Default Spring Boot Dashboard: