diff --git a/brian_dashboard_manager/config.py b/brian_dashboard_manager/config.py index dab824b939eb34c7d1b0915c99c2113f85290ad2..88cc6cbf1dff45b1378ed61f3dae895cba31e40f 100644 --- a/brian_dashboard_manager/config.py +++ b/brian_dashboard_manager/config.py @@ -29,8 +29,10 @@ If the value is a list, dashboard titles within the list should be excluded. import json import jsonschema +import tempfile -STATE_PATH = '/tmp/briandashboardmanager-state.json' + +STATE_PATH = tempfile.gettempdir() + '/briandashboardmanager-state.json' DEFAULT_ORGANIZATIONS = [ { diff --git a/brian_dashboard_manager/templating/templates/homedashboard.json.j2 b/brian_dashboard_manager/templating/templates/homedashboard.json.j2 index c23ae3a192e84721cc06ddeeb26000f00b4329b6..5ea3a44c78a7341092b4ddd1eb396d47ca600f04 100644 --- a/brian_dashboard_manager/templating/templates/homedashboard.json.j2 +++ b/brian_dashboard_manager/templating/templates/homedashboard.json.j2 @@ -640,66 +640,676 @@ } {% else %} { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, "datasource": null, "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "defaults": { + "custom": {} + }, + "overrides": [] }, + "fill": 1, + "fillGradient": 0, "gridPos": { - "h": 10, - "w": 24, - "x": 0, - "y": 0 + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false }, - "id": 4, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", "options": { - "content": "<center><img src=\"https://connect.geant.org/wp-content/uploads/2021/04/geant_logo.png\" alt=\"GEANT Logo\" height=\"308\" width=\"616\"></center>", - "mode": "html" + "alertThreshold": true }, - "pluginVersion": "7.1.0", + "percentage": false, + "pluginVersion": "7.2.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, "targets": [ - { - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "null" - ], - "type": "fill" - } + { + "alias": "Customer", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "linear" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT mean(\"ingress\") *8 FROM \"interface_rates\" WHERE (\"interface_name\" = 'PHY_CUSTOMER') AND $timeFilter GROUP BY time($__interval) fill(linear)", + "rawQuery": false, + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "ingress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "*8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_CUSTOMER" + } + ] + }, + { + "alias": "Private", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "linear" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "ingress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "*8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_PRIVATE" + } + ] + }, + { + "alias": "R&E Interconnect", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "refId": "C", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "ingress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "* 8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_RE_INTERCONNECT" + } + ] + }, + { + "alias": "Public", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "refId": "D", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "ingress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "* 8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_PUBLIC" + } + ] + }, + { + "alias": "Upstream", + "groupBy": [ + { + "params": [ + "15m" ], - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "value" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] + "type": "time" + }, + { + "params": [ + "null" ], - "tags": [] - } + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "refId": "E", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "ingress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "* 8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_UPSTREAM" + } + ] + } ], + "thresholds": [], "timeFrom": null, + "timeRegions": [], "timeShift": null, - "title": "BRIAN", - "type": "text" + "title": "Network Aggregate (Ingress)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bps", + "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, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "hiddenSeries": false, + "id": 7, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.2.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "alias": "Customer", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "linear" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "query": "SELECT mean(\"ingress\") *8 FROM \"interface_rates\" WHERE (\"interface_name\" = 'PHY_CUSTOMER') AND $timeFilter GROUP BY time($__interval) fill(linear)", + "rawQuery": false, + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "egress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "*8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_CUSTOMER" + } + ] + }, + { + "alias": "Private", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "linear" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "egress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "*8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_PRIVATE" + } + ] + }, + { + "alias": "R&E Interconnect", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "refId": "C", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "egress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "* 8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_RE_INTERCONNECT" + } + ] + }, + { + "alias": "Public", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "refId": "D", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "egress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "* 8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_PUBLIC" + } + ] + }, + { + "alias": "Upstream", + "groupBy": [ + { + "params": [ + "15m" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "interface_rates", + "orderByTime": "ASC", + "policy": "default", + "refId": "E", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "egress" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + }, + { + "params": [ + "* 8" + ], + "type": "math" + } + ] + ], + "tags": [ + { + "key": "interface_name", + "operator": "=", + "value": "PHY_UPSTREAM" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Network Aggregate (Egress)", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bps", + "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 + } } {% endif %} ], diff --git a/changelog.md b/changelog.md index 320d466e138958dcd45fe59c665506c1c89fe712..34fc385d94809b15052b4f82c273e8283e03dbf4 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## [0.33] - 2022-01-26 +- POL1-520: Change home dashboard to show network aggregate ingress and egress rates + ## [0.32] - 2021-12-14 - Fix bug with field *8 multiplier introduced for aggregate graphs diff --git a/docker-setup/config/grafana.ini b/docker-setup/config/grafana.ini index 68694ff76167204004b4176d6b029e98ebf36900..438a5432605ddf6ca76843df97b0360f80727594 100644 --- a/docker-setup/config/grafana.ini +++ b/docker-setup/config/grafana.ini @@ -57,8 +57,7 @@ logging = true [database] # Either "mysql", "postgres" or "sqlite3", it's your choice -type = postgres -host = postgres +type = sqlite3 name = grafana user = grafana password = grafana diff --git a/docker-setup/docker-compose.yaml b/docker-setup/docker-compose.yaml index 5847a3c0bc31faabd55368a991a41d2ca5eb565e..a4512b0181f4c67469955a8a4dc7290d4001daa2 100644 --- a/docker-setup/docker-compose.yaml +++ b/docker-setup/docker-compose.yaml @@ -10,17 +10,4 @@ services: - ./config:/etc/grafana/ environment: - GF_INSTALL_PLUGINS=grafana-simple-json-datasource - postgres: - restart: always - build: - context: . - args: - DBUSER: grafana - DBPASS: grafana - DBNAME: grafana - hostname: postgres - ports: - - "5432:5432" - volumes: - - ./postgresdata:/var/lib/postgresql:z diff --git a/docker-setup/entrypoint.sh b/docker-setup/entrypoint.sh deleted file mode 100755 index e85d1e5e753e8bf2d83f74c71d77073d15330c75..0000000000000000000000000000000000000000 --- a/docker-setup/entrypoint.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -# Entrypoint for the containerized database -# Ensures the required setup is performed on the share before -# starting the database - -if [ "$PGDATA" = "" ] -then - echo "Environment variable PGDATA is not set" - exit 1 -fi - -if [ ! -d "$PGDATA" ] -then - echo "Directory $PGDATA does not exist - no volume mounted?" - exit 2 -fi - -# Postgres will refuse to work on a non-empty folder when initializing and the -# mount point might have a dotfile -PGDATA="$PGDATA/9.6" - -echo $PGDATA -echo $DBNAME -echo $DBUSER - -if [ ! -d "$PGDATA" ] -then - echo "Database seems to be uninitialized - doing so" - mkdir $PGDATA - initdb --pgdata=$PGDATA && \ - pg_ctl start && \ - sleep 4 && \ - createuser -d -l -s $DBUSER && \ - createdb -O $DBUSER $DBNAME && \ - psql -c "ALTER ROLE $DBUSER WITH PASSWORD '$DBPASS'" && \ - psql -a $DBNAME -c 'CREATE EXTENSION "uuid-ossp" WITH SCHEMA pg_catalog' && \ - echo "host all all all md5" >> $PGDATA/pg_hba.conf && \ - echo "listen_addresses = '0.0.0.0'" >> $PGDATA/postgresql.conf && \ - pg_ctl stop -fi - -exec /usr/bin/postgres diff --git a/setup.py b/setup.py index 73e45a1d0c97b42515dd02f5cac93500d12c095a..8c03dbf10d055f59dfbd012b2c4b571fab2c1d92 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='brian-dashboard-manager', - version="0.32", + version="0.33", author='GEANT', author_email='swd@geant.org', description='',