Hello, I hope I’ve come to the right spot, if not I’d be glad for any pointers.
I’m setting up a docker-compose including Prometheus and Grafana, this is my docker-compose.yml:
services:
prometheus:
image: prom/prometheus
user: root
ports:
- 9099:9090
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./data/prometheus:/prometheus
command: --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml
restart: unless-stopped
networks:
monitoring:
aliases:
- prometheusgrafana:
build:
context: ./grafana
ports:
- 3030:3000
volumes:
- ./data/grafana:/var/lib/grafana
restart: unless-stopped
user: “472”volumes:
grafana-data:
external: truenetworks:
monitoring:
The Prometheus part seems to work fine, I get my metrics at localhost:9099. I can also access Grafana at localhost:3030, and it does find a default Prometheus datasource, but no metrics and it doesn’t load the dashboards. Here you can take a look at my all.yml file in datasources:
datasources:
- name: ‘Prometheus’
type: ‘prometheus’
access: ‘browser’
url: ‘prometheus:9090’
is_default: true
editable: false
and the all.yml in dashboards:
apiVersion: 1
providers:
- name: ‘default’
org_id: 1
folder: ‘’
type: ‘file’
options:
path: ‘/var/lib/grafana/dashboards’
foldersFromFilesStructure: true
I also have this grafana.ini file:
[paths]
provisioning = /etc/grafana/provisioning
And the file structure is as follows:
Docker
| - data
| | - grafana
| | - prometheus
| - grafana
| | - dashboards
| | | - dashboard1.json
| | | - dashboard2.json
| | - provisioning
| | | - dashboards
| | | | - all.yml
| | | - datasources
| | | | - all.yml
| | - Dockerfile
| | - grafana.ini
| - prometheus
| | - prometheus.yml
| - docker-compose.yml
And, I almost forgot, the Dockerfile for Grafana:
FROM grafana/grafana:8.0.3
ENV GF_AUTH_DISABLE_LOGIN_FORM “true”
ENV GF_AUTH_ANONYMOUS_ENABLED “true”
ENV GF_AUTH_ANONYMOUS_ORG_ROLE “Admin”
ADD ./provisioning /etc/grafana/provisioning
ADD ./grafana.ini /etc/grafana/grafana.ini
ADD ./dashboards /var/lib/grafana/dashboards
I have been working with various articles on the internet and the grafana documentation, but at this point I feel a bit lost. For me it seems like the issue must be in the provisioning part of Grafana, because neither the datasource, nor the dashboards work as intended. But I can’t get it quite right. Any help would be greatly appreciated.
EDIT:
Removed comments in the files to increase readability. Also sorry for the file structure, most of the whitespaces got removed and it makes it hard to read. This also screws with the yml format
Added htm whitespaces