From 17ba5680c5bec23648a487e6fc0c961afa0189ea Mon Sep 17 00:00:00 2001 From: lza_menace Date: Wed, 30 Dec 2020 14:44:36 -0800 Subject: [PATCH] add graf container w/ pre-built dashboard --- docker-compose.yaml | 19 +++ files/dashboards.yaml | 13 ++ files/wowstash_ops.json | 311 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 343 insertions(+) create mode 100644 files/dashboards.yaml create mode 100644 files/wowstash_ops.json diff --git a/docker-compose.yaml b/docker-compose.yaml index f482f6d..070328f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -18,3 +18,22 @@ services: container_name: wowstash_cache ports: - 6379:6379 + grafana: + image: grafana/grafana:6.5.0 + container_name: grafana + restart: unless-stopped + ports: + - 127.0.0.1:3001:3000 + environment: + HOSTNAME: grafana + GF_SECURITY_ADMIN_USER: admin + GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD} + GF_SERVER_ROOT_URL: ${GRAFANA_URL} + GF_ANALYTICS_REPORTING_ENABLED: "false" + GF_ANALYTICS_CHECK_FOR_UPDATES: "false" + GF_USERS_ALLOW_SIGN_UP: "false" + GF_USERS_ALLOW_ORG_CREATE: "false" + volumes: + - ./files/dashboards.yaml:/etc/grafana/provisioning/dashboards/default.yaml:ro + - ./files/wowstash_ops.json:/var/lib/grafana/dashboards/wowstash_ops.json:ro + - grafana:/var/lib/grafana diff --git a/files/dashboards.yaml b/files/dashboards.yaml new file mode 100644 index 0000000..ce46f5a --- /dev/null +++ b/files/dashboards.yaml @@ -0,0 +1,13 @@ +apiVersion: 1 + +providers: +- name: 'default' + orgId: 1 + folder: '' + type: file + disableDeletion: true + editable: true + updateIntervalSeconds: 60 + allowUiUpdates: true + options: + path: /var/lib/grafana/dashboards diff --git a/files/wowstash_ops.json b/files/wowstash_ops.json new file mode 100644 index 0000000..d30c5bc --- /dev/null +++ b/files/wowstash_ops.json @@ -0,0 +1,311 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 1, + "links": [], + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 1, + "points": true, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "format": "time_series", + "group": [ + { + "params": [ + "$__interval", + "none" + ], + "type": "time" + } + ], + "metricColumn": "none", + "rawQuery": false, + "rawSql": "SELECT\n $__timeGroupAlias(register_date,$__interval),\n avg(id) AS \"id\"\nFROM users\nWHERE\n $__timeFilter(register_date)\nGROUP BY 1\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "id" + ], + "type": "column" + }, + { + "params": [ + "avg" + ], + "type": "aggregate" + }, + { + "params": [ + "id" + ], + "type": "alias" + } + ] + ], + "table": "users", + "timeColumn": "register_date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "User Registrations", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 0, + "fillGradient": 0, + "gridPos": { + "h": 11, + "w": 24, + "x": 0, + "y": 9 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "format": "time_series", + "group": [ + { + "params": [ + "$__interval", + "0" + ], + "type": "time" + } + ], + "metricColumn": "type", + "rawQuery": false, + "rawSql": "SELECT\n $__timeGroupAlias(date,$__interval,0),\n type AS metric,\n count(\"user\") AS \"id\"\nFROM events\nWHERE\n $__timeFilter(date)\nGROUP BY 1,2\nORDER BY 1,2", + "refId": "A", + "select": [ + [ + { + "params": [ + "\"user\"" + ], + "type": "column" + }, + { + "params": [ + "count" + ], + "type": "aggregate" + }, + { + "params": [ + "id" + ], + "type": "alias" + } + ] + ], + "table": "events", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Event Activity", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": true, + "alignLevel": null + } + } + ], + "refresh": false, + "schemaVersion": 21, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "Wowstash Ops", + "uid": "zvTlfCbGz", + "version": 1 +}