From 0de2953f87afb1bd3182120ef84cc391fcd6797b Mon Sep 17 00:00:00 2001 From: lza_menace Date: Wed, 2 Sep 2020 15:21:17 -0700 Subject: [PATCH] drop that traefik shit and setup a badass stats exporter with pre-populated grafana dashboard and prometheus scraper --- wownero/docker-compose.local.yaml | 41 -- wownero/docker-compose.yaml | 71 +-- wownero/files/grafana/daemon_metrics.json | 506 ++++++++++++++++++++++ wownero/files/grafana/dashboards.yaml | 13 + wownero/files/grafana/prometheus.yaml | 9 + wownero/files/prometheus/prometheus.yml | 17 + 6 files changed, 589 insertions(+), 68 deletions(-) delete mode 100644 wownero/docker-compose.local.yaml create mode 100644 wownero/files/grafana/daemon_metrics.json create mode 100644 wownero/files/grafana/dashboards.yaml create mode 100644 wownero/files/grafana/prometheus.yaml create mode 100644 wownero/files/prometheus/prometheus.yml diff --git a/wownero/docker-compose.local.yaml b/wownero/docker-compose.local.yaml deleted file mode 100644 index b0b4390..0000000 --- a/wownero/docker-compose.local.yaml +++ /dev/null @@ -1,41 +0,0 @@ -version: '3' -services: - reverse-proxy: - image: traefik:v2.2 - command: - # Try to enable this if something isn't working. Chances are, Traefik will tell you why - # Be careful on production as it exposes the traffic you might not want to expose - #--log.level=DEBUG - # --api.dashboard=true - # --api.insecure=true - - --entrypoints.http.address=:80 - --entrypoints.https.address=:443 - --providers.docker=true - --api=false - --certificatesresolvers.letsencrypt.acme.httpchallenge=true - --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http - --certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL} - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json - ports: - - 80:80 - - 443:443 - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ./data/letsencrypt:/letsencrypt - wownerod: - build: - context: . - volumes: - - ./data/daemon:/data - command: - wownerod --data-dir=/data --rpc-bind-ip=0.0.0.0 --confirm-external-bind --non-interactive --public-node --restricted-rpc - ports: - - 34568:34568 - labels: - - "traefik.http.routers.https.rule=Host(`${DAEMON_HOSTNAME}`)" - - "traefik.http.routers.http.rule=Host(`${DAEMON_HOSTNAME}`)" - - "traefik.http.routers.https.entrypoints=https" - - "traefik.http.routers.http.entrypoints=http" - - "traefik.http.routers.https.tls=true" - - "traefik.http.routers.https.tls.certresolver=letsencrypt" diff --git a/wownero/docker-compose.yaml b/wownero/docker-compose.yaml index aec52aa..05cba70 100644 --- a/wownero/docker-compose.yaml +++ b/wownero/docker-compose.yaml @@ -1,28 +1,51 @@ version: '3' +volumes: + grafana: + prometheus: services: - reverse-proxy: - image: traefik:v2.2 + prometheus: + image: prom/prometheus:v2.18.0 + container_name: prometheus + restart: unless-stopped command: - # Try to enable this if something isn't working. Chances are, Traefik will tell you why - # Be careful on production as it exposes the traffic you might not want to expose - #--log.level=DEBUG - # --api.dashboard=true - # --api.insecure=true - - --entrypoints.http.address=:80 - --entrypoints.https.address=:443 - --providers.docker=true - --api=false - --certificatesresolvers.letsencrypt.acme.httpchallenge=true - --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http - --certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL} - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json + - --config.file=/etc/prometheus/prometheus.yml + - --storage.tsdb.path=/prometheus + - --web.console.libraries=/usr/share/prometheus/console_libraries + - --web.console.templates=/usr/share/prometheus/consoles + - --web.enable-admin-api + volumes: + - prometheus:/prometheus + - ./files/prometheus:/etc/prometheus + ports: + - 127.0.0.1:9090:9090 + grafana: + image: grafana/grafana:6.5.0 + container_name: grafana ports: - - 80:80 - - 443:443 + - 127.0.0.1:3000: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" + GF_LOG_LEVEL: "debug" volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ./data/letsencrypt:/letsencrypt + - ./files/grafana/dashboards.yaml:/etc/grafana/provisioning/dashboards/default.yaml:ro + - ./files/grafana/prometheus.yaml:/etc/grafana/provisioning/datasources/prometheus.yaml:ro + - ./files/grafana/daemon_metrics.json:/var/lib/grafana/dashboards/daemon_metrics.json:ro + - grafana:/var/lib/grafana + exporter: + build: + context: ../../wownerod_exporter + environment: + DAEMON_HOST: http://wownerod:34568 + PORT: 8080 + ports: + - 127.0.0.1:8080:8080 wownerod: image: lalanza808/wownero:latest volumes: @@ -30,11 +53,5 @@ services: command: wownerod --data-dir=/data --rpc-bind-ip=0.0.0.0 --confirm-external-bind --non-interactive --public-node --restricted-rpc ports: + - 34567:34567 - 34568:34568 - labels: - - "traefik.http.routers.https.rule=Host(`${DAEMON_HOSTNAME}`)" - - "traefik.http.routers.http.rule=Host(`${DAEMON_HOSTNAME}`)" - - "traefik.http.routers.https.entrypoints=https" - - "traefik.http.routers.http.entrypoints=http" - - "traefik.http.routers.https.tls=true" - - "traefik.http.routers.https.tls.certresolver=letsencrypt" diff --git a/wownero/files/grafana/daemon_metrics.json b/wownero/files/grafana/daemon_metrics.json new file mode 100644 index 0000000..2310936 --- /dev/null +++ b/wownero/files/grafana/daemon_metrics.json @@ -0,0 +1,506 @@ +{ + "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": 2, + "links": [], + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 12, + "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": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg(monerod_connections_incoming)", + "legendFormat": "Incoming", + "refId": "A" + }, + { + "expr": "avg(monerod_connections_outgoing)", + "legendFormat": "Outgoing", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Connections", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "none", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "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": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 0 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/.*/", + "color": "#C4162A" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg(monerod_block_difficulty)", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Difficulty", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "sci", + "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": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "hiddenSeries": false, + "id": 6, + "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": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/.*/", + "color": "#8F3BB8" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg(monerod_tx_mempool)", + "legendFormat": "Pool Transactions", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Mempool", + "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": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "hiddenSeries": false, + "id": 8, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/.*/", + "color": "#FADE2A" + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "avg(monerod_block_reward)", + "legendFormat": "Block Reward (WOW)", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Block Reward (WOW)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "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 + } + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorPostfix": false, + "colorPrefix": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": null, + "format": "none", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 5, + "w": 5, + "x": 9, + "y": 17 + }, + "id": 10, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "options": {}, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": true, + "lineColor": "rgb(31, 120, 193)", + "show": true, + "ymax": null, + "ymin": null + }, + "tableColumn": "", + "targets": [ + { + "expr": "monerod_tx_chain", + "instant": true, + "refId": "A" + } + ], + "thresholds": "", + "timeFrom": null, + "timeShift": null, + "title": "Transactions", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + } + ], + "refresh": "30s", + "schemaVersion": 21, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "Daemon Stats", + "uid": "0ktA4KDGk", + "version": 2 +} diff --git a/wownero/files/grafana/dashboards.yaml b/wownero/files/grafana/dashboards.yaml new file mode 100644 index 0000000..ce46f5a --- /dev/null +++ b/wownero/files/grafana/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/wownero/files/grafana/prometheus.yaml b/wownero/files/grafana/prometheus.yaml new file mode 100644 index 0000000..c80e238 --- /dev/null +++ b/wownero/files/grafana/prometheus.yaml @@ -0,0 +1,9 @@ +apiVersion: 1 + +datasources: +- name: Prometheus + type: prometheus + url: http://prometheus:9090 + access: proxy + isDefault: true + timeInterval: 10s diff --git a/wownero/files/prometheus/prometheus.yml b/wownero/files/prometheus/prometheus.yml new file mode 100644 index 0000000..59f3d83 --- /dev/null +++ b/wownero/files/prometheus/prometheus.yml @@ -0,0 +1,17 @@ +global: + scrape_interval: 30s + evaluation_interval: 60s + + external_labels: + monitor: wownerod-exporter + +scrape_configs: + - job_name: "wownerod-exporter" + static_configs: + - targets: ["exporter:8080"] + +alerting: + alertmanagers: + - static_configs: + - targets: + # - alertmanager:9093