Skip to content
Snippets Groups Projects
Commit e76d0be2 authored by Carlos Natalino Da Silva's avatar Carlos Natalino Da Silva
Browse files

Latest changes to the dashboard.

parent 3dc40639
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!127Improvements to the optical cybersecurity component addressing previous issues
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import logging, os, time import logging, os, time
from typing import List from typing import List, Dict
from common.Constants import ( from common.Constants import (
DEFAULT_GRPC_BIND_ADDRESS, DEFAULT_GRPC_GRACE_PERIOD, DEFAULT_GRPC_MAX_WORKERS, DEFAULT_HTTP_BIND_ADDRESS, DEFAULT_GRPC_BIND_ADDRESS, DEFAULT_GRPC_GRACE_PERIOD, DEFAULT_GRPC_MAX_WORKERS, DEFAULT_HTTP_BIND_ADDRESS,
DEFAULT_LOG_LEVEL, DEFAULT_METRICS_PORT, DEFAULT_SERVICE_GRPC_PORTS, DEFAULT_SERVICE_HTTP_BASEURLS, DEFAULT_LOG_LEVEL, DEFAULT_METRICS_PORT, DEFAULT_SERVICE_GRPC_PORTS, DEFAULT_SERVICE_HTTP_BASEURLS,
...@@ -37,23 +37,24 @@ ENVVAR_SUFIX_SERVICE_HOST = 'SERVICE_HOST' ...@@ -37,23 +37,24 @@ ENVVAR_SUFIX_SERVICE_HOST = 'SERVICE_HOST'
ENVVAR_SUFIX_SERVICE_PORT_GRPC = 'SERVICE_PORT_GRPC' ENVVAR_SUFIX_SERVICE_PORT_GRPC = 'SERVICE_PORT_GRPC'
ENVVAR_SUFIX_SERVICE_PORT_HTTP = 'SERVICE_PORT_HTTP' ENVVAR_SUFIX_SERVICE_PORT_HTTP = 'SERVICE_PORT_HTTP'
def find_missing_environment_variables( def find_environment_variables(
required_environment_variables : List[str] = [] environment_variable_names : List[str] = []
) -> List[str]: ) -> Dict[str, str]:
if ENVVAR_KUBERNETES_PORT in os.environ: environment_variable : Dict[str, str] = dict()
missing_variables = set(required_environment_variables).difference(set(os.environ.keys())) for name in environment_variable_names:
else: if name not in os.environ: continue
# We're not running in Kubernetes, nothing to wait for environment_variable[name] = os.environ[name]
missing_variables = required_environment_variables return environment_variable
return missing_variables
def wait_for_environment_variables( def wait_for_environment_variables(
required_environment_variables : List[str] = [], wait_delay_seconds : float = DEFAULT_RESTART_DELAY required_environment_variables : List[str] = [], wait_delay_seconds : float = DEFAULT_RESTART_DELAY
): ):
missing_variables = find_missing_environment_variables(required_environment_variables) if ENVVAR_KUBERNETES_PORT not in os.environ: return # Not running in Kubernetes
if len(missing_variables) == 0: return # We have all environment variables defined found = find_environment_variables(required_environment_variables)
msg = 'Variables({:s}) are missing in Environment({:s}), restarting in {:f} seconds...' missing = set(required_environment_variables).difference(set(found.keys()))
LOGGER.error(msg.format(str(missing_variables), str(os.environ), wait_delay_seconds)) if len(missing) == 0: return # We have all environment variables defined
MSG = 'Variables({:s}) are missing in Environment({:s}), restarting in {:f} seconds...'
LOGGER.error(MSG.format(str(missing), str(os.environ), wait_delay_seconds))
time.sleep(wait_delay_seconds) time.sleep(wait_delay_seconds)
raise Exception('Restarting...') # pylint: disable=broad-exception-raised raise Exception('Restarting...') # pylint: disable=broad-exception-raised
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
"liveNow": false, "liveNow": false,
"panels": [ "panels": [
{ {
"collapsed": false,
"gridPos": { "gridPos": {
"h": 1, "h": 1,
"w": 24, "w": 24,
...@@ -73,6 +74,7 @@ ...@@ -73,6 +74,7 @@
"y": 0 "y": 0
}, },
"id": 12, "id": 12,
"panels": [],
"title": "General status", "title": "General status",
"type": "row" "type": "row"
}, },
...@@ -216,7 +218,7 @@ ...@@ -216,7 +218,7 @@
"options": { "options": {
"legend": { "legend": {
"calcs": [], "calcs": [],
"displayMode": "list", "displayMode": "hidden",
"placement": "bottom" "placement": "bottom"
}, },
"tooltip": { "tooltip": {
...@@ -230,7 +232,11 @@ ...@@ -230,7 +232,11 @@
"type": "prometheus", "type": "prometheus",
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"expr": "tfs_opticalattackmanager_dropped_assessments_created", "editorMode": "code",
"exemplar": false,
"expr": "rate(tfs_opticalattackmanager_dropped_assessments_created[1m])",
"instant": false,
"range": true,
"refId": "A" "refId": "A"
} }
], ],
...@@ -238,6 +244,7 @@ ...@@ -238,6 +244,7 @@
"type": "timeseries" "type": "timeseries"
}, },
{ {
"collapsed": false,
"gridPos": { "gridPos": {
"h": 1, "h": 1,
"w": 24, "w": 24,
...@@ -245,6 +252,7 @@ ...@@ -245,6 +252,7 @@
"y": 9 "y": 9
}, },
"id": 10, "id": 10,
"panels": [],
"title": "Pipeline", "title": "Pipeline",
"type": "row" "type": "row"
}, },
...@@ -253,6 +261,7 @@ ...@@ -253,6 +261,7 @@
"type": "prometheus", "type": "prometheus",
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
...@@ -309,11 +318,11 @@ ...@@ -309,11 +318,11 @@
"x": 0, "x": 0,
"y": 10 "y": 10
}, },
"id": 16, "id": 14,
"options": { "options": {
"legend": { "legend": {
"calcs": [], "calcs": [],
"displayMode": "list", "displayMode": "hidden",
"placement": "bottom" "placement": "bottom"
}, },
"tooltip": { "tooltip": {
...@@ -328,25 +337,13 @@ ...@@ -328,25 +337,13 @@
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "histogram_quantile(0.95, sum(rate(tfs_opticalattackmanager_loop_seconds_bucket[$__rate_interval])) by (le))", "expr": "tfs_opticalattackmanager_active_services",
"legendFormat": "Measured", "legendFormat": "Active services",
"range": true, "range": true,
"refId": "A" "refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "tfs_opticalattackmanager_desired_monitoring_interval",
"hide": false,
"legendFormat": "Desired",
"range": true,
"refId": "B"
} }
], ],
"title": "Loop time", "title": "Number of active optical services",
"type": "timeseries" "type": "timeseries"
}, },
{ {
...@@ -354,7 +351,6 @@ ...@@ -354,7 +351,6 @@
"type": "prometheus", "type": "prometheus",
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"description": "",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "color": {
...@@ -411,7 +407,7 @@ ...@@ -411,7 +407,7 @@
"x": 12, "x": 12,
"y": 10 "y": 10
}, },
"id": 14, "id": 16,
"options": { "options": {
"legend": { "legend": {
"calcs": [], "calcs": [],
...@@ -430,13 +426,25 @@ ...@@ -430,13 +426,25 @@
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "tfs_opticalattackmanager_active_services", "expr": "histogram_quantile(0.95, sum(rate(tfs_opticalattackmanager_loop_seconds_bucket[$__rate_interval])) by (le))",
"legendFormat": "Active services", "legendFormat": "Measured",
"range": true, "range": true,
"refId": "A" "refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "tfs_opticalattackmanager_desired_monitoring_interval",
"hide": false,
"legendFormat": "Desired",
"range": true,
"refId": "B"
} }
], ],
"title": "Number of active optical services", "title": "Loop time",
"type": "timeseries" "type": "timeseries"
}, },
{ {
...@@ -543,7 +551,7 @@ ...@@ -543,7 +551,7 @@
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "histogram_quantile(0.95, sum(rate(tfs_opticalattackdetector_inference_response_time_bucket[$__rate_interval])) by (le))", "expr": "histogram_quantile(0.95, sum(rate(tfs_opticalattackdetector_execution_details_histogram_duration_bucket{step=\"uldetection\"}[$__rate_interval])) by (le))",
"hide": false, "hide": false,
"legendFormat": "UL Inference", "legendFormat": "UL Inference",
"range": true, "range": true,
...@@ -555,7 +563,7 @@ ...@@ -555,7 +563,7 @@
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "histogram_quantile(0.95, sum(rate(tfs_opticalattackdetector_cache_response_time_bucket[$__rate_interval])) by (le))", "expr": "histogram_quantile(0.95, sum(rate(tfs_opticalattackdetector_execution_details_histogram_duration_bucket{step=\"cachefetch\"}[$__rate_interval])) by (le))",
"hide": false, "hide": false,
"interval": "", "interval": "",
"legendFormat": "Cache", "legendFormat": "Cache",
...@@ -568,7 +576,7 @@ ...@@ -568,7 +576,7 @@
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "histogram_quantile(0.95, sum(rate(tfs_opticalattackdetector_mitigation_response_time_bucket[$__rate_interval])) by (le))", "expr": "histogram_quantile(0.95, sum(rate(tfs_opticalattackdetector_execution_details_histogram_duration_bucket{step=\"mitigation\"}[$__rate_interval])) by (le))",
"hide": false, "hide": false,
"interval": "", "interval": "",
"legendFormat": "Mitigator", "legendFormat": "Mitigator",
...@@ -1353,7 +1361,7 @@ ...@@ -1353,7 +1361,7 @@
"type": "timeseries" "type": "timeseries"
}, },
{ {
"collapsed": false, "collapsed": true,
"gridPos": { "gridPos": {
"h": 1, "h": 1,
"w": 24, "w": 24,
...@@ -1361,163 +1369,164 @@ ...@@ -1361,163 +1369,164 @@
"y": 44 "y": 44
}, },
"id": 2, "id": 2,
"panels": [], "panels": [
"title": "General status",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 29,
"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": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "mwatt"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 45
},
"id": 33,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\".+opticalattackmanager.+\"})/1000",
"instant": false,
"legendFormat": "Manager",
"range": true,
"refId": "A"
},
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "${DS_PROMETHEUS}" "uid": "${DS_PROMETHEUS}"
}, },
"editorMode": "code", "fieldConfig": {
"exemplar": false, "defaults": {
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\".+opticalattackdetector.+\"})/1000", "color": {
"hide": false, "mode": "palette-classic"
"instant": false, },
"legendFormat": "Detector", "custom": {
"range": true, "axisLabel": "",
"refId": "B" "axisPlacement": "auto",
}, "barAlignment": 0,
{ "drawStyle": "line",
"datasource": { "fillOpacity": 29,
"type": "prometheus", "gradientMode": "none",
"uid": "${DS_PROMETHEUS}" "hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "mwatt"
},
"overrides": []
}, },
"editorMode": "code", "gridPos": {
"exemplar": false, "h": 8,
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\".+dbscan.+\"})/1000", "w": 12,
"hide": false, "x": 0,
"instant": false, "y": 45
"interval": "",
"legendFormat": "UL Inference",
"range": true,
"refId": "C"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
}, },
"editorMode": "code", "id": 33,
"exemplar": false, "options": {
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\"redis-server.+\"})/1000", "legend": {
"hide": false, "calcs": [],
"instant": false, "displayMode": "list",
"interval": "", "placement": "right"
"legendFormat": "Cache", },
"range": true, "tooltip": {
"refId": "D" "mode": "single",
}, "sort": "none"
{ }
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
}, },
"editorMode": "code", "targets": [
"exemplar": false, {
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\".+opticalattackmitigator.+\"})/1000", "datasource": {
"hide": false, "type": "prometheus",
"instant": false, "uid": "${DS_PROMETHEUS}"
"interval": "", },
"legendFormat": "Mitigator", "editorMode": "code",
"range": true, "exemplar": false,
"refId": "E" "expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\".+opticalattackmanager.+\"})/1000",
"instant": false,
"legendFormat": "Manager",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\".+opticalattackdetector.+\"})/1000",
"hide": false,
"instant": false,
"legendFormat": "Detector",
"range": true,
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\".+dbscan.+\"})/1000",
"hide": false,
"instant": false,
"interval": "",
"legendFormat": "UL Inference",
"range": true,
"refId": "C"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\"redis-server.+\"})/1000",
"hide": false,
"instant": false,
"interval": "",
"legendFormat": "Cache",
"range": true,
"refId": "D"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(scaph_process_power_consumption_microwatts{namespace=\"tfs\", cmdline=~\".+opticalattackmitigator.+\"})/1000",
"hide": false,
"instant": false,
"interval": "",
"legendFormat": "Mitigator",
"range": true,
"refId": "E"
}
],
"title": "Energy consumption",
"type": "timeseries"
} }
], ],
"title": "Energy consumption", "title": "General status",
"type": "timeseries" "type": "row"
} }
], ],
"refresh": "5s", "refresh": "",
"schemaVersion": 36, "schemaVersion": 36,
"style": "dark", "style": "dark",
"tags": [], "tags": [],
...@@ -1525,13 +1534,13 @@ ...@@ -1525,13 +1534,13 @@
"list": [] "list": []
}, },
"time": { "time": {
"from": "now-5m", "from": "now-30m",
"to": "now" "to": "now"
}, },
"timepicker": {}, "timepicker": {},
"timezone": "", "timezone": "",
"title": "TFS / Optical cybersecurity", "title": "TFS / Optical cybersecurity",
"uid": "-Q-B-AsVk", "uid": "-Q-B-AsVk",
"version": 1, "version": 5,
"weekStart": "" "weekStart": ""
} }
\ No newline at end of file
...@@ -725,7 +725,7 @@ ...@@ -725,7 +725,7 @@
}, },
"timepicker": {}, "timepicker": {},
"timezone": "", "timezone": "",
"title": "Scalable and Efficient Pipeline for ML-based Optical Network Monitoring", "title": "Scalable and Efficient Pipeline for ML-based Optical Network Monitoring - No longer maintained!",
"uid": "IYQSZX0Vk", "uid": "IYQSZX0Vk",
"version": 4, "version": 4,
"weekStart": "" "weekStart": ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment