From 84f04151bb329e18dc6ec6fcbbcf070d1addca72 Mon Sep 17 00:00:00 2001 From: Shaun Prince Date: Mon, 10 Jun 2024 01:51:44 -0700 Subject: [PATCH] almost grafana --- dashboards/performance_dashboard.json | 91 ++++++++++++++++++++++++ docker-compose.yml | 18 ++++- provisioning/dashboards/dashboards.yml | 11 +++ provisioning/datasources/datasources.yml | 8 +++ 4 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 dashboards/performance_dashboard.json create mode 100644 provisioning/dashboards/dashboards.yml create mode 100644 provisioning/datasources/datasources.yml diff --git a/dashboards/performance_dashboard.json b/dashboards/performance_dashboard.json new file mode 100644 index 0000000..66ea6c9 --- /dev/null +++ b/dashboards/performance_dashboard.json @@ -0,0 +1,91 @@ +{ + "dashboard": { + "id": null, + "title": "Performance Dashboard", + "tags": [], + "timezone": "browser", + "schemaVersion": 16, + "version": 0, + "panels": [ + { + "title": "CPU Usage", + "type": "graph", + "targets": [ + { + "expr": "avg(rate(node_cpu_seconds_total{mode='user'}[1m])) by (instance)", + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1 + }, + { + "title": "Memory Usage", + "type": "graph", + "targets": [ + { + "expr": "node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes", + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 2 + }, + { + "title": "Disk Usage", + "type": "graph", + "targets": [ + { + "expr": "node_filesystem_size_bytes - node_filesystem_free_bytes", + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 3 + }, + { + "title": "Network I/O", + "type": "graph", + "targets": [ + { + "expr": "rate(node_network_receive_bytes_total[1m])", + "legendFormat": "Receive - {{instance}}", + "refId": "A" + }, + { + "expr": "rate(node_network_transmit_bytes_total[1m])", + "legendFormat": "Transmit - {{instance}}", + "refId": "B" + } + ], + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 4 + } + ], + "refresh": "5s" + }, + "overwrite": false +} diff --git a/docker-compose.yml b/docker-compose.yml index ef547ad..91a3a24 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,7 @@ services: build: . ports: - "5000:5000" + - "8000:8000" environment: - VALKEY_HOST=valkey depends_on: @@ -15,7 +16,7 @@ services: valkey: image: docker.io/valkey/valkey:latest environment: - - ALLOW_EMPTY_PASSWORD=yes # Recommended only for development + - ALLOW_EMPTY_PASSWORD=yes - VALKEY_DISABLE_COMMANDS=FLUSHDB,FLUSHALL ports: - "6379:6379" @@ -23,6 +24,21 @@ services: volumes: - valkey_data:/data + grafana: + image: grafana/grafana:latest + ports: + - "3000:3000" + environment: + - GF_SECURITY_ADMIN_PASSWORD=admin + volumes: + - grafana_data:/var/lib/grafana + - ./provisioning:/etc/grafana/provisioning + - ./dashboards:/var/lib/grafana/dashboards + depends_on: + - app + volumes: valkey_data: driver: local + grafana_data: + driver: local diff --git a/provisioning/dashboards/dashboards.yml b/provisioning/dashboards/dashboards.yml new file mode 100644 index 0000000..5cdb885 --- /dev/null +++ b/provisioning/dashboards/dashboards.yml @@ -0,0 +1,11 @@ +apiVersion: 1 + +providers: + - name: 'default' + orgId: 1 + folder: '' + type: file + options: + path: /var/lib/grafana/dashboards + disableDeletion: false + updateIntervalSeconds: 10 diff --git a/provisioning/datasources/datasources.yml b/provisioning/datasources/datasources.yml new file mode 100644 index 0000000..a620a0e --- /dev/null +++ b/provisioning/datasources/datasources.yml @@ -0,0 +1,8 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + url: http://app:8000 + isDefault: true