Reorganize configs main
authorMartin Pitt <martin@piware.de>
Fri, 9 Jul 2021 07:32:39 +0000 (09:32 +0200)
committerMartin Pitt <martin@piware.de>
Fri, 9 Jul 2021 07:32:39 +0000 (09:32 +0200)
- Rename directories like the volumes.
- Add Grafana dashboard provisioning, and split off config. It was weird
  to mount the same directory under two different paths.
- Now arbitrary dashboards can be put into
  grafana-provisioning/dashboards/*.json and they will be automatically
  deployed.

conf-grafana/datasource.yaml [deleted file]
conf-grafana/grafana.ini [deleted file]
conf-prometheus/prometheus.yml [deleted file]
grafana-config/grafana.ini [new file with mode: 0644]
grafana-provisioning/dashboards/all.yml [new file with mode: 0644]
grafana-provisioning/datasources/datasource.yaml [new file with mode: 0644]
learn-metrics.yaml
prometheus-config/prometheus.yml [new file with mode: 0644]

diff --git a/conf-grafana/datasource.yaml b/conf-grafana/datasource.yaml
deleted file mode 100644 (file)
index 46eb97e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-apiVersion: 1
-datasources:
-- name: Prometheus
-  type: prometheus
-  url: http://localhost:9090
-  isDefault: true
-  access: proxy
-  editable: true
diff --git a/conf-grafana/grafana.ini b/conf-grafana/grafana.ini
deleted file mode 100644 (file)
index 256888f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[auth.anonymous]
-# enable anonymous access
-enabled = true
diff --git a/conf-prometheus/prometheus.yml b/conf-prometheus/prometheus.yml
deleted file mode 100644 (file)
index 592ac7a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-global:
-  scrape_interval: 5s
-  scrape_timeout: 5s
-  evaluation_interval: 15s
-alerting:
-  alertmanagers:
-  - static_configs:
-    - targets: []
-    scheme: http
-    timeout: 10s
-    api_version: v1
-scrape_configs:
-- job_name: 'prometheus'
-  static_configs:
-  - targets: ['localhost:9090']
-
-- job_name: host-http
-  honor_timestamps: true
-  metrics_path: /metrics
-  scheme: http
-  static_configs:
-  - targets: ['localhost:8080']
diff --git a/grafana-config/grafana.ini b/grafana-config/grafana.ini
new file mode 100644 (file)
index 0000000..256888f
--- /dev/null
@@ -0,0 +1,3 @@
+[auth.anonymous]
+# enable anonymous access
+enabled = true
diff --git a/grafana-provisioning/dashboards/all.yml b/grafana-provisioning/dashboards/all.yml
new file mode 100644 (file)
index 0000000..3e04b4b
--- /dev/null
@@ -0,0 +1,5 @@
+apiVersion: 1
+providers:
+  - name: default
+    options:
+      path: /etc/grafana/provisioning
diff --git a/grafana-provisioning/datasources/datasource.yaml b/grafana-provisioning/datasources/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 7c1c7ea563403d001bfec83d51e3b165bb50c801..3d6c678c4e75a0bacf92f7dcd7112c646119d788 100644 (file)
@@ -21,8 +21,8 @@ spec:
     - name: grafana-config
       mountPath: /grafana-config
       readOnly: true
-    - name: grafana-datasource
-      mountPath: /etc/grafana/provisioning/datasources/datasource.yaml
+    - name: grafana-provisioning
+      mountPath: /etc/grafana/provisioning
       readOnly: true
 
   - image: quay.io/prometheus/prometheus:latest
@@ -45,14 +45,13 @@ spec:
 
   volumes:
   - hostPath:
-      path: ./conf-grafana/datasource.yaml
-      type: File
-    name: grafana-datasource
+      path: ./grafana-provisioning
+    name: grafana-provisioning
   - hostPath:
-      path: ./conf-grafana
+      path: ./grafana-config
     name: grafana-config
   - hostPath:
-      path: ./conf-prometheus
+      path: ./prometheus-config
     name: prometheus-config
   - hostPath:
       path: ./http
diff --git a/prometheus-config/prometheus.yml b/prometheus-config/prometheus.yml
new file mode 100644 (file)
index 0000000..592ac7a
--- /dev/null
@@ -0,0 +1,22 @@
+global:
+  scrape_interval: 5s
+  scrape_timeout: 5s
+  evaluation_interval: 15s
+alerting:
+  alertmanagers:
+  - static_configs:
+    - targets: []
+    scheme: http
+    timeout: 10s
+    api_version: v1
+scrape_configs:
+- job_name: 'prometheus'
+  static_configs:
+  - targets: ['localhost:9090']
+
+- job_name: host-http
+  honor_timestamps: true
+  metrics_path: /metrics
+  scheme: http
+  static_configs:
+  - targets: ['localhost:8080']