From 32877a10f79f469dbe5e8cd9f3c8cc242c6e7b04 Mon Sep 17 00:00:00 2001 From: marcel-dempers Date: Tue, 27 Aug 2019 19:37:34 +1000 Subject: [PATCH] container to import grafana dashboards --- prometheus-monitoring/docker-compose.yaml | 16 ++++++++++++- .../{ => grafana-data}/dashboard.json | 23 +++++++++++-------- .../grafana-data/datasources.json | 6 +++++ 3 files changed, 35 insertions(+), 10 deletions(-) rename prometheus-monitoring/{ => grafana-data}/dashboard.json (94%) create mode 100644 prometheus-monitoring/grafana-data/datasources.json diff --git a/prometheus-monitoring/docker-compose.yaml b/prometheus-monitoring/docker-compose.yaml index 9ee4cd9..5a9efd0 100644 --- a/prometheus-monitoring/docker-compose.yaml +++ b/prometheus-monitoring/docker-compose.yaml @@ -32,7 +32,7 @@ services: container_name: prometheus-svc image: prom/prometheus ports: - - "9090:9090" + - "9091:9090" command: --config.file=/etc/prometheus/prometheus.yaml volumes: - ./prometheus.yaml:/etc/prometheus/prometheus.yaml @@ -44,3 +44,17 @@ services: - GF_AUTH_BASIC_ENABLED=false - GF_AUTH_ANONYMOUS_ENABLED=true - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + grafana-dashboards: + image: alpine:3.10 + depends_on: + - grafana + volumes: + - ./grafana-data:/grafana + command: > + /bin/sh -c " + apk add --no-cache curl + echo 'waiting for grafana' + sleep 5s + cd /grafana + curl --request POST http://grafana:3000/api/datasources --header 'Content-Type: application/json' -d @datasources.json + curl --request POST http://grafana:3000/api/dashboards/db --header 'Content-Type: application/json' -d @dashboard.json" \ No newline at end of file diff --git a/prometheus-monitoring/dashboard.json b/prometheus-monitoring/grafana-data/dashboard.json similarity index 94% rename from prometheus-monitoring/dashboard.json rename to prometheus-monitoring/grafana-data/dashboard.json index 58a070a..67ea2a6 100644 --- a/prometheus-monitoring/dashboard.json +++ b/prometheus-monitoring/grafana-data/dashboard.json @@ -1,3 +1,8 @@ + +{ + "overwrite": true, + "dashboard" : + { "__inputs": [], "__requires": [ @@ -42,7 +47,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "prometheus", "fill": 1, "gridPos": { "h": 9, @@ -121,7 +126,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "prometheus", "fill": 1, "gridPos": { "h": 9, @@ -214,7 +219,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "prometheus", "fill": 1, "gridPos": { "h": 9, @@ -293,7 +298,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "prometheus", "fill": 1, "gridPos": { "h": 9, @@ -386,7 +391,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "prometheus", "fill": 1, "gridPos": { "h": 9, @@ -465,7 +470,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "prometheus", "fill": 1, "gridPos": { "h": 9, @@ -558,7 +563,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "prometheus", "fill": 1, "gridPos": { "h": 8, @@ -637,7 +642,7 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "Prometheus", + "datasource": "prometheus", "fill": 1, "gridPos": { "h": 8, @@ -755,4 +760,4 @@ "title": "Application Telemetry (Prometheus)", "uid": "pvXvovKWz", "version": 2 - } \ No newline at end of file + }} \ No newline at end of file diff --git a/prometheus-monitoring/grafana-data/datasources.json b/prometheus-monitoring/grafana-data/datasources.json new file mode 100644 index 0000000..960fe55 --- /dev/null +++ b/prometheus-monitoring/grafana-data/datasources.json @@ -0,0 +1,6 @@ +{ + "name": "prometheus", + "type": "prometheus", + "url": "http://prometheus:9090", + "access": "proxy" +} \ No newline at end of file