From: Martin Pitt Date: Fri, 9 Jul 2021 07:32:39 +0000 (+0200) Subject: Reorganize configs X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=9faca17bfd6b13cadd14516e33a0e03924e64cc8;p=learn-metrics.git Reorganize configs - 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. --- diff --git a/conf-grafana/datasource.yaml b/conf-grafana/datasource.yaml deleted file mode 100644 index 46eb97e..0000000 --- a/conf-grafana/datasource.yaml +++ /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 index 256888f..0000000 --- a/conf-grafana/grafana.ini +++ /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 index 592ac7a..0000000 --- a/conf-prometheus/prometheus.yml +++ /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 index 0000000..256888f --- /dev/null +++ b/grafana-config/grafana.ini @@ -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 index 0000000..3e04b4b --- /dev/null +++ b/grafana-provisioning/dashboards/all.yml @@ -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 index 0000000..46eb97e --- /dev/null +++ b/grafana-provisioning/datasources/datasource.yaml @@ -0,0 +1,8 @@ +apiVersion: 1 +datasources: +- name: Prometheus + type: prometheus + url: http://localhost:9090 + isDefault: true + access: proxy + editable: true diff --git a/learn-metrics.yaml b/learn-metrics.yaml index 7c1c7ea..3d6c678 100644 --- a/learn-metrics.yaml +++ b/learn-metrics.yaml @@ -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 index 0000000..592ac7a --- /dev/null +++ b/prometheus-config/prometheus.yml @@ -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']