diff --git a/grafana/.gitignore b/grafana/.gitignore new file mode 100644 index 0000000..7b8ab1a --- /dev/null +++ b/grafana/.gitignore @@ -0,0 +1,2 @@ +grafana/data +graphite diff --git a/grafana/docker-compose.yml b/grafana/docker-compose.yml new file mode 100644 index 0000000..6149512 --- /dev/null +++ b/grafana/docker-compose.yml @@ -0,0 +1,36 @@ +services: + graphite: + image: graphiteapp/graphite-statsd:1.1.10-5 + restart: unless-stopped + networks: + - metrics_network + healthcheck: + test: [ "CMD", "nc", "-zv", "localhost", "8126" ] + interval: 30s + timeout: 5s + retries: 3 + start_period: 1m + volumes: + - ./graphite/storage:/opt/graphite/storage + ports: + - '8125:8125/udp' # statsd udp + + grafana: + image: grafana/grafana:10.0.3 + restart: unless-stopped + networks: + - metrics_network + healthcheck: + test: [ "CMD", "curl", "-f", "localhost:3000/api/health" ] + interval: 30s + timeout: 5s + retries: 3 + start_period: 1m + volumes: + - ./grafana:/etc/grafana + - ./grafana/data:/var/lib/grafana + ports: + - '3000:3000' # grafana web + +networks: + metrics_network: diff --git a/grafana/grafana/grafana.ini b/grafana/grafana/grafana.ini new file mode 100644 index 0000000..3c9ef0d --- /dev/null +++ b/grafana/grafana/grafana.ini @@ -0,0 +1,6 @@ +[auth.anonymous] +enabled = true +org_role = Editor # TODO: Viewer? + +[dashboards] +default_home_dashboard_path = /etc/grafana/provisioning/dashboards/default-snapchain-dashboard.json \ No newline at end of file diff --git a/grafana/grafana/provisioning/dashboards/dashboards.yaml b/grafana/grafana/provisioning/dashboards/dashboards.yaml new file mode 100644 index 0000000..92d2308 --- /dev/null +++ b/grafana/grafana/provisioning/dashboards/dashboards.yaml @@ -0,0 +1,10 @@ +apiVersion: 1 +providers: + - name: "Default Dashboards" + orgId: 1 + folder: "" + type: file + disableDeletion: false + editable: true + options: + path: /etc/grafana/provisioning/dashboards diff --git a/grafana/grafana/provisioning/dashboards/default-snapchain-dashboard.json b/grafana/grafana/provisioning/dashboards/default-snapchain-dashboard.json new file mode 100644 index 0000000..9f52870 --- /dev/null +++ b/grafana/grafana/provisioning/dashboards/default-snapchain-dashboard.json @@ -0,0 +1,428 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 2, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 6, + "panels": [], + "title": "Main", + "type": "row" + }, + { + "datasource": { + "type": "graphite", + "uid": "P1D261A8554D2DA69" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 1 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "graphite", + "uid": "P1D261A8554D2DA69" + }, + "refId": "A", + "target": "stats.gauges.snapchain*.shard*.block_height" + } + ], + "title": "Block Height", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 5, + "panels": [], + "title": "Consensus", + "type": "row" + }, + { + "datasource": { + "type": "graphite", + "uid": "P1D261A8554D2DA69" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 0, + "y": 10 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "graphite", + "uid": "P1D261A8554D2DA69" + }, + "refId": "A", + "target": "stats_counts.snapchain*.shard*.propose" + } + ], + "title": "Propose", + "type": "timeseries" + }, + { + "datasource": { + "type": "graphite", + "uid": "P1D261A8554D2DA69" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 8, + "y": 10 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "graphite", + "uid": "P1D261A8554D2DA69" + }, + "refId": "A", + "target": "stats_counts.snapchain*.shard*.validate.false" + } + ], + "title": "Validate False", + "type": "timeseries" + }, + { + "datasource": { + "type": "graphite", + "uid": "P1D261A8554D2DA69" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 8, + "x": 16, + "y": 10 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "graphite", + "uid": "P1D261A8554D2DA69" + }, + "refId": "A", + "target": "stats_counts.snapchain*.shard*.validate.true" + } + ], + "title": "Validate True", + "type": "timeseries" + } + ], + "refresh": "5s", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Snapchain", + "uid": "cf760674-32b5-40a8-ad78-6b6188b9e848", + "version": 7, + "weekStart": "" +} \ No newline at end of file diff --git a/grafana/grafana/provisioning/datasources/graphite.yaml b/grafana/grafana/provisioning/datasources/graphite.yaml new file mode 100644 index 0000000..56c31ca --- /dev/null +++ b/grafana/grafana/provisioning/datasources/graphite.yaml @@ -0,0 +1,12 @@ +apiVersion: 1 + +datasources: + - name: Graphite + type: graphite + access: proxy + url: http://graphite + isDefault: true + jsonData: + graphiteVersion: "1.1" + tlsAuth: false + tlsAuthWithCACert: false