Pre-configure prometheus data source in Grafana
authorMartin Pitt <martin@piware.de>
Fri, 21 May 2021 06:34:06 +0000 (08:34 +0200)
committerMartin Pitt <martin@piware.de>
Fri, 21 May 2021 06:54:53 +0000 (08:54 +0200)
This mysteriously fixes the data source test "not found" error.

conf-grafana/datasource.yaml [new file with mode: 0644]
launch.sh

diff --git a/conf-grafana/datasource.yaml b/conf-grafana/datasource.yaml
new file mode 100644 (file)
index 0000000..46eb97e
--- /dev/null
@@ -0,0 +1,8 @@
+apiVersion: 1
+datasources:
+- name: Prometheus
+  type: prometheus
+  url: http://localhost:9090
+  isDefault: true
+  access: proxy
+  editable: true
index 8f0dc7979ad9f9f2ccc59673ae751e5a18be360e..14eaeec35bc4685ad5016efbdd4b6674b34c1d01 100755 (executable)
--- a/launch.sh
+++ b/launch.sh
@@ -1,4 +1,9 @@
 #!/bin/sh
 set -eux
-podman run -d --pod new:learn-metrics --name metrics-grafana -p 3000:3000 -p 3001:9090 -e GF_SECURITY_ADMIN_PASSWORD=foobar quay.io/bitnami/grafana
+podman run -d --pod new:learn-metrics --name metrics-grafana \
+    -p 3000:3000 -p 3001:9090 \
+    -e GF_SECURITY_ADMIN_PASSWORD=foobar \
+    -v ./conf-grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml:ro \
+    quay.io/bitnami/grafana
+
 podman run -d --pod learn-metrics --name metrics-prometheus docker.io/prom/prometheus