From 954eaace5ba05a6060f906d02f24d23aa5b90c02 Mon Sep 17 00:00:00 2001
From: GentlemenValidators
 <161212534+GentlemenValidators@users.noreply.github.com>
Date: Tue, 14 May 2024 00:16:29 +0200
Subject: [PATCH] Add monitoring

---
 docker-compose-monitoring.yml.yaml | 25 +++++++++++++++++++++++++
 grafana/datasource.yml             |  9 +++++++++
 prometheus/prometheus.yml          | 21 +++++++++++++++++++++
 3 files changed, 55 insertions(+)
 create mode 100644 docker-compose-monitoring.yml.yaml
 create mode 100644 grafana/datasource.yml
 create mode 100644 prometheus/prometheus.yml

diff --git a/docker-compose-monitoring.yml.yaml b/docker-compose-monitoring.yml.yaml
new file mode 100644
index 00000000..85a6b82a
--- /dev/null
+++ b/docker-compose-monitoring.yml.yaml
@@ -0,0 +1,25 @@
+services:
+  prometheus:
+    image: prom/prometheus:latest
+    container_name: prometheus
+    command:
+      - '--config.file=/etc/prometheus/prometheus.yml'
+    ports:
+      - 9090:9090
+    restart: unless-stopped
+    volumes:
+      - ./prometheus:/etc/prometheus
+      - prom_data:/prometheus
+  grafana:
+    image: grafana/grafana:latest
+    container_name: grafana
+    ports:
+      - 3000:3000
+    restart: unless-stopped
+    environment:
+      - GF_SECURITY_ADMIN_USER=admin
+      - GF_SECURITY_ADMIN_PASSWORD=grafana
+    volumes:
+      - ./grafana:/etc/grafana/provisioning/datasources
+volumes:
+  prom_data:
diff --git a/grafana/datasource.yml b/grafana/datasource.yml
new file mode 100644
index 00000000..d7b82868
--- /dev/null
+++ b/grafana/datasource.yml
@@ -0,0 +1,9 @@
+apiVersion: 1
+
+datasources:
+- name: Prometheus
+  type: prometheus
+  url: http://prometheus:9090 
+  isDefault: true
+  access: proxy
+  editable: true
diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml
new file mode 100644
index 00000000..18c44da7
--- /dev/null
+++ b/prometheus/prometheus.yml
@@ -0,0 +1,21 @@
+global:
+  scrape_interval: 15s
+  scrape_timeout: 10s
+  evaluation_interval: 15s
+alerting:
+  alertmanagers:
+  - static_configs:
+    - targets: []
+    scheme: http
+    timeout: 10s
+    api_version: v1
+scrape_configs:
+- job_name: prometheus
+  honor_timestamps: true
+  scrape_interval: 15s
+  scrape_timeout: 10s
+  metrics_path: /metrics
+  scheme: http
+  static_configs:
+  - targets:
+    - localhost:9090
\ No newline at end of file