diff --git a/docker-compose/grafana/dashboards/archiver_mariadb.json b/docker-compose/grafana/dashboards/archiver_mariadb.json new file mode 100644 index 0000000000000000000000000000000000000000..73b4aa07650e9c8cac3a4bcf12537cd2fe381c6a --- /dev/null +++ b/docker-compose/grafana/dashboards/archiver_mariadb.json @@ -0,0 +1,799 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": null, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 4, + "options": { + "showHeader": true + }, + "pluginVersion": "8.2.3", + "targets": [ + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "select name as \"Attribute\"\r\nfrom att_conf ac \r\nwhere ac.domain ='stat' and ac.family = 'sdp' and ac.member ='1'\r\norder by ac.name", + "refId": "A", + "select": [ + [ + { + "params": [ + "name" + ], + "type": "column" + } + ] + ], + "table": "att_conf", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [] + } + ], + "title": "STAT/SDP/1 archived attributes", + "type": "table" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 6, + "options": { + "showHeader": true + }, + "pluginVersion": "8.2.3", + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "select name as \"Attribute\" \r\nfrom att_conf \r\nwhere domain ='stat' and family = 'recv' and member ='1'\r\norder by name", + "refId": "A", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "STAT/RECV/1 archived attributes", + "type": "table" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "points", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 4, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "temperature [1]" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "pluginVersion": "8.2.1", + "targets": [ + { + "format": "time_series", + "group": [], + "hide": true, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\ndata_time as \"time\",\nvalue_r as \"value\"\nFROM att_array_devdouble_ro\nJOIN att_conf\nON att_array_devdouble_ro.att_conf_id = att_conf.att_conf_id \nWHERE\natt_conf.domain = 'lts'\nand att_conf.family = 'sdp'\nand att_conf.member = 1\nand att_conf.name = 'fpga_temp_r'\nORDER BY data_time,idx\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": true, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\ndata_time as \"time\",\nvalue_r as \"mask\"\nFROM att_array_devboolean_ro\nJOIN att_conf\nON att_array_devboolean_ro.att_conf_id = att_conf.att_conf_id \nWHERE\natt_conf.domain = 'lts'\nand att_conf.family = 'sdp'\nand att_conf.member = 1\nand att_conf.name = 'tr_fpga_mask_r'\nORDER BY data_time,idx\n", + "refId": "B", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [0]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 0\r\nORDER BY t.`time`, t.`index`", + "refId": "Masked Values", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [1]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 1\r\nORDER BY t.`time`, t.`index`", + "refId": "C", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [2]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 2\r\nORDER BY t.`time`, t.`index`", + "refId": "D", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [3]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 3\r\nORDER BY t.`time`, t.`index`", + "refId": "E", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [4]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 4\r\nORDER BY t.`time`, t.`index`", + "refId": "F", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [5]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 5\r\nORDER BY t.`time`, t.`index`", + "refId": "G", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [6]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 6\r\nORDER BY t.`time`, t.`index`", + "refId": "H", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [7]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 7\r\nORDER BY t.`time`, t.`index`", + "refId": "I", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [8]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 8\r\nORDER BY t.`time`, t.`index`", + "refId": "J", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [9]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 9\r\nORDER BY t.`time`, t.`index`", + "refId": "K", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [10]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 10\r\nORDER BY t.`time`, t.`index`", + "refId": "L", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [11]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 11\r\nORDER BY t.`time`, t.`index`", + "refId": "M", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [12]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 12\r\nORDER BY t.`time`, t.`index`", + "refId": "N", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [13]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 13\r\nORDER BY t.`time`, t.`index`", + "refId": "O", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [14]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 14\r\nORDER BY t.`time`, t.`index`", + "refId": "P", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT t.`time` as \"time\",\r\nt.value as \"temperature [15]\"\r\nFROM SDP_FPGA_temp as t INNER JOIN SDP_TR_FPGA_mask as m\r\nON t.`time`=m.`time` and t.`index`=m.`index`\r\nWHERE m.value = 1\r\nAND t.`time` > $__timeFrom()\r\nAND t.`time` < $__timeTo()\r\nAND t.`index` = 15\r\nORDER BY t.`time`, t.`index`", + "refId": "Q", + "select": [ + [ + { + "params": [ + "att_conf_id" + ], + "type": "column" + } + ] + ], + "table": "att_array_devfloat_rw", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "SDP - FPGA Temperature", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 31, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-24h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Archiver-MariaDB", + "uid": "2zuNvev7z", + "version": 1 +} diff --git a/docker-compose/grafana/dashboards/archiver_timescale.json b/docker-compose/grafana/dashboards/archiver_timescale.json new file mode 100644 index 0000000000000000000000000000000000000000..bec06ef691e2a89e8e75e264a7f3d9f120a82ea4 --- /dev/null +++ b/docker-compose/grafana/dashboards/archiver_timescale.json @@ -0,0 +1,273 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": null, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": "TimescaleDB", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 6, + "options": { + "showHeader": true + }, + "pluginVersion": "8.2.5", + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "select name as \"Attribute\",\r\ntable_name as \"Type\"\r\nfrom att_conf ac \r\nwhere \"domain\" ='stat' and \"family\" = 'sdp' and \"member\" ='1'\r\norder by name", + "refId": "A", + "select": [ + [ + { + "params": [ + "value_r" + ], + "type": "column" + } + ] + ], + "table": "att_scalar_devdouble", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "STAT/SDP/1 archived attributes", + "type": "table" + }, + { + "datasource": "TimescaleDB", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 8, + "options": { + "showHeader": true + }, + "pluginVersion": "8.2.5", + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "select name as \"Attribute\",\r\ntable_name as \"Type\" \r\nfrom att_conf ac \r\nwhere \"domain\" ='stat' and \"family\" = 'recv' and \"member\" ='1'\r\norder by name", + "refId": "A", + "select": [ + [ + { + "params": [ + "value_r" + ], + "type": "column" + } + ] + ], + "table": "att_scalar_devdouble", + "timeColumn": "data_time", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "LTS/RECV/1 archived attributes", + "type": "table" + }, + { + "datasource": "TimescaleDB", + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-BlYlRd" + }, + "custom": { + "fillOpacity": 70, + "lineWidth": 1 + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 9, + "interval": "10s", + "maxDataPoints": 1000, + "options": { + "colWidth": 0.3, + "legend": { + "displayMode": "list", + "placement": "bottom" + }, + "rowHeight": 0.78, + "showValue": "auto", + "tooltip": { + "mode": "single" + } + }, + "pluginVersion": "8.2.4", + "targets": [ + { + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT time_bucket('00:00:01'::interval, q1.\"time\") AS time,\r\n mask(array[q1.value[1]], array[q2.\"value\"[1]]) AS \"temperature[1]\",\r\n mask(array[q1.value[2]], array[q2.\"value\"[2]]) AS \"temperature[2]\",\r\n mask(array[q1.value[3]], array[q2.\"value\"[3]]) AS \"temperature[3]\",\r\n mask(array[q1.value[4]], array[q2.\"value\"[4]]) AS \"temperature[4]\",\r\n mask(array[q1.value[5]], array[q2.\"value\"[5]]) AS \"temperature[5]\",\r\n mask(array[q1.value[6]], array[q2.\"value\"[6]]) AS \"temperature[6]\",\r\n mask(array[q1.value[7]], array[q2.\"value\"[7]]) AS \"temperature[7]\",\r\n mask(array[q1.value[8]], array[q2.\"value\"[8]]) AS \"temperature[8]\",\r\n mask(array[q1.value[9]], array[q2.\"value\"[9]]) AS \"temperature[9]\",\r\n mask(array[q1.value[10]], array[q2.\"value\"[10]]) AS \"temperature[10]\",\r\n mask(array[q1.value[11]], array[q2.\"value\"[11]]) AS \"temperature[11]\",\r\n mask(array[q1.value[12]], array[q2.\"value\"[12]]) AS \"temperature[12]\",\r\n mask(array[q1.value[13]], array[q2.\"value\"[13]]) AS \"temperature[13]\",\r\n mask(array[q1.value[14]], array[q2.\"value\"[14]]) AS \"temperature[14]\",\r\n mask(array[q1.value[15]], array[q2.\"value\"[15]]) AS \"temperature[15]\"\r\n FROM ( SELECT aad.data_time AS \"time\",\r\n aad.value_r AS value\r\n FROM att_array_devdouble aad\r\n JOIN att_conf ac ON aad.att_conf_id = ac.att_conf_id\r\n WHERE aad.value_r IS NOT NULL AND ac.domain = 'stat'::text AND ac.family = 'sdp'::text AND ac.member = '1'::text AND ac.name = 'fpga_temp_r'::text\r\n ORDER BY aad.data_time) q1\r\n JOIN ( SELECT aab.data_time AS \"time\",\r\n aab.value_r AS value\r\n FROM att_array_devboolean aab\r\n JOIN att_conf ac ON aab.att_conf_id = ac.att_conf_id\r\n WHERE aab.value_r IS NOT NULL AND ac.domain = 'stat'::text AND ac.family = 'sdp'::text AND ac.member = '1'::text AND ac.name = 'tr_fpga_mask_r'::text\r\n ORDER BY aab.data_time) q2 ON time_bucket('00:00:01'::interval, q1.\"time\") = time_bucket('00:00:01'::interval, q2.\"time\")\r\n WHERE $__timeFilter(q1.\"time\")\r\n ORDER BY q1.\"time\";", + "refId": "B", + "select": [ + [ + { + "params": [ + "temperature[1]" + ], + "type": "column" + } + ] + ], + "table": "sdp_masked_temp_values", + "timeColumn": "temp_time", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "SDP - FPGA Temperature", + "type": "status-history" + } + ], + "refresh": "", + "schemaVersion": 32, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-5m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Archiver-Timescale", + "uid": "M7zA7Hc7k", + "version": 1 +} diff --git a/docker-compose/grafana/datasources/archiver-timescale.yaml b/docker-compose/grafana/datasources/archiver-timescale.yaml new file mode 100644 index 0000000000000000000000000000000000000000..69a896dae776283d41283c33688088700f85cadf --- /dev/null +++ b/docker-compose/grafana/datasources/archiver-timescale.yaml @@ -0,0 +1,45 @@ +apiVersion: 1 + +datasources: + # <string, required> name of the datasource. Required + - name: TimescaleDB + # <string, required> datasource type. Required + type: postgres + # <string, required> access mode. proxy or direct (Server or Browser in the UI). Required + access: proxy + # <int> org id. will default to orgId 1 if not specified + orgId: 1 + # <string> custom UID which can be used to reference this datasource in other parts of the configuration, if not specified will be generated automatically + uid: ZqArtG97z + # <string> url + url: archiver-timescale + # <string> Deprecated, use secureJsonData.password + password: + # <string> database user, if used + user: postgres + # <string> database name, if used + database: hdb + # <bool> enable/disable basic auth + basicAuth: false + # <string> basic auth username + basicAuthUser: + # <string> Deprecated, use secureJsonData.basicAuthPassword + basicAuthPassword: + # <bool> enable/disable with credentials headers + withCredentials: + # <bool> mark as default datasource. Max one per org + isDefault: false + # <map> fields that will be converted to json and stored in jsonData + jsonData: + # <string> determines whether or with what priority a secure TLS/SSL TCP/IP connection will be negotiated with the server. + sslmode: "disable" + # <bool> enable TimescaleDB + timescaledb: true + # <string> json object of data that will be encrypted. + secureJsonData: + # <string> database password, if used + password: password + version: 1 + # <bool> allow users to edit datasources from the UI. + editable: false + diff --git a/docker-compose/tango-prometheus-exporter/ska-tango-grafana-exporter b/docker-compose/tango-prometheus-exporter/ska-tango-grafana-exporter index 774d39a40ca19c9d979ad22565e57b4af3e9a831..dddb23ff587f6e9c837cdb77e7955e94272eca6f 160000 --- a/docker-compose/tango-prometheus-exporter/ska-tango-grafana-exporter +++ b/docker-compose/tango-prometheus-exporter/ska-tango-grafana-exporter @@ -1 +1 @@ -Subproject commit 774d39a40ca19c9d979ad22565e57b4af3e9a831 +Subproject commit dddb23ff587f6e9c837cdb77e7955e94272eca6f diff --git a/docker-compose/timescaledb/Dockerfile b/docker-compose/timescaledb/Dockerfile index 86e7a820c3fc4e4ba0eaa8edaa9c7e421c87231f..4ca5dd07826a14bc17d7d982cdd1198fbe657980 100644 --- a/docker-compose/timescaledb/Dockerfile +++ b/docker-compose/timescaledb/Dockerfile @@ -5,5 +5,5 @@ COPY resources/01_admin.sh docker-entrypoint-initdb.d/002_admin.sh COPY resources/02_hdb_schema.sql docker-entrypoint-initdb.d/003_hdb_schema.sql COPY resources/03_hdb_roles.sql docker-entrypoint-initdb.d/004_hdb_roles.sql COPY resources/04_hdb_ext_aggregates.sql docker-entrypoint-initdb.d/005_hdb_ext_aggregates.sql -COPY resources/05_lofar_views.sql docker-entrypoint-initdb.d/006_lofar_views.sql +COPY resources/05_lofar_func.sh docker-entrypoint-initdb.d/006_lofar_func.sh COPY resources/06_cleanup.sql docker-entrypoint-initdb.d/007_cleanup.sql diff --git a/docker-compose/timescaledb/resources/05_lofar_func.sh b/docker-compose/timescaledb/resources/05_lofar_func.sh new file mode 100644 index 0000000000000000000000000000000000000000..4797c7a6df2acf11e3709221a9bd4fd335128264 --- /dev/null +++ b/docker-compose/timescaledb/resources/05_lofar_func.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +psql << EOF +\c hdb +CREATE OR REPLACE FUNCTION mask(double precision[], boolean[]) +RETURNS double precision[] LANGUAGE sql +AS \$function\$ SELECT ARRAY(SELECT +case when \$2[i] then \$1[i] +else '0'::double precision end +FROM generate_subscripts(\$1,1) g(i)) \$function\$; +EOF diff --git a/docker-compose/timescaledb/resources/05_lofar_views.sql b/docker-compose/timescaledb/resources/05_lofar_views.sql deleted file mode 100644 index 82aa8e5de360b434ecf081d1b02c000dff5d50f7..0000000000000000000000000000000000000000 --- a/docker-compose/timescaledb/resources/05_lofar_views.sql +++ /dev/null @@ -1,54 +0,0 @@ --- LOFAR 2.0 CUSTOMIZED VIEWS - -\c hdb --- SDP FPGA Temperature -create or replace view "sdp_fpga_temp" as -select - ac.att_name as "attribute", - aad.data_time AS "time", - aad.value_r -FROM att_array_devdouble aad join att_conf ac -on aad.att_conf_id = ac.att_conf_id -where aad.value_R is not null -and ac."domain" ='stat' and ac."family" ='sdp' and ac."member" ='1' -ORDER BY aad.data_time; - --- SDP FPGA Mask -create or replace view "sdp_tr_fpga_mask" as -select - ac.att_name as "attribute", - aab.data_time AS "time", - aab.value_r -FROM att_array_devboolean aab join att_conf ac -on aab.att_conf_id = ac.att_conf_id -where aab.value_R is not null -and ac."domain" ='stat' and ac."family" ='sdp' and ac."member" ='1' -ORDER BY aab.data_time; - --- SDP Masked values (rounded to 1 second) -create or replace view "sdp_masked_temp_values" as -select time_bucket('1 second',t.time) as "temp_time", -time_bucket('1 second',m.time) as "mask_time", -t.value_r as "temperature", -m.value_r as "mask" -from sdp_fpga_temp as t -inner join sdp_tr_fpga_mask as m -on time_bucket('1 second',t.time) = time_bucket('1 second',m.time) -/* Replace if possible with SQL loop */ -where m.value_r[1]=true and -m.value_r[2]=true and -m.value_r[3]=true and -m.value_r[4]=true and -m.value_r[5]=true and -m.value_r[6]=true and -m.value_r[7]=true and -m.value_r[8]=true and -m.value_r[9]=true and -m.value_r[10]=true and -m.value_r[11]=true and -m.value_r[12]=true and -m.value_r[13]=true and -m.value_r[14]=true and -m.value_r[15]=true and -m.value_r[16]=true -order by t."time" ; diff --git a/tangostationcontrol/tangostationcontrol/toolkit/archiver.py b/tangostationcontrol/tangostationcontrol/toolkit/archiver.py index 771fab87a0431defec19ce755b07a5eaa22ca2d6..6c0cd3baa8e2c708d39858191bc56e73e84a9eff 100644 --- a/tangostationcontrol/tangostationcontrol/toolkit/archiver.py +++ b/tangostationcontrol/tangostationcontrol/toolkit/archiver.py @@ -578,11 +578,11 @@ class Retriever(): return result def get_attribute_value_by_interval(self,attribute_fqname: str, start_time: datetime, stop_time: datetime): - ''' + """ Takes as input the attribute name and a certain starting and ending point-time. The datetime format is pretty flexible (e.g. "YYYY-MM-dd hh:mm:ss"). Returns a list of timestamps and a list of values - ''' + """ attr_id = self.get_attribute_id(attribute_fqname) attr_datatype = self.get_attribute_datatype(attribute_fqname) attr_table_name = 'att_'+str(attr_datatype) @@ -596,4 +596,33 @@ class Retriever(): except AttributeError as e: raise Exception(f"Empty result! Attribute {attribute_fqname} not found") from e return result - + + def get_masked_fpga_temp(self,start_time: datetime, stop_time: datetime,temp_attr_name:str='LTS/SDP/1/fpga_temp_r', + mask_attr_name:str='LTS/SDP/1/tr_fpga_mask_r'): + """ + Returns a list of SDP/fpga_temp_r values, but only if SDP/tr_fpga_mask_r values are TRUE + """ + mask_values = self.get_attribute_value_by_interval(mask_attr_name,start_time,stop_time) + temp_values = self.get_attribute_value_by_interval(temp_attr_name,start_time,stop_time) + # Since timestamps can be not syncrhonized, remove first or last element from arrays + if len(mask_values)==len(temp_values): + first_mask_datatime = mask_values[0].data_time + first_temp_datatime = temp_values[0].data_time + if (first_mask_datatime>first_temp_datatime): + mask_values = mask_values[:-int(mask_values[0].dim_x_r)] + temp_values = temp_values[int(temp_values[0].dim_x_r):] + elif (first_mask_datatime<first_temp_datatime): + mask_values = mask_values[int(mask_values[0].dim_x_r)] + temp_values = temp_values[:-int(temp_values[0].dim_x_r):] + else: + raise Exception + # Convert DB Array records into Python lists + mask_data = build_array_from_record(mask_values,mask_values[0].dim_x_r) + temp_data = build_array_from_record(temp_values,temp_values[0].dim_x_r) + # Extract only the value from the array + mask_array_values = get_values_from_record(mask_data) + temp_array_values = get_values_from_record(temp_data) + # Multiply the matrix + #masked_values = np.multiply(temp_array_values,mask_array_values) + masked_values = np.ma.masked_array(temp_array_values,mask=np.invert(mask_array_values.astype(bool))) + return masked_values, mask_values, temp_values diff --git a/tangostationcontrol/tangostationcontrol/toolkit/archiver_config/lofar2.json b/tangostationcontrol/tangostationcontrol/toolkit/archiver_config/lofar2.json index 90533e18a0fd28b26286cff70be8d5f190b14a6e..6c30be0698175ef914841fa165a4f2a97543d12a 100644 --- a/tangostationcontrol/tangostationcontrol/toolkit/archiver_config/lofar2.json +++ b/tangostationcontrol/tangostationcontrol/toolkit/archiver_config/lofar2.json @@ -11,7 +11,7 @@ }, "STAT/SDP/1": { "environment": "development", - "include": [], + "include": ["FPGA_temp_R","TR_fpga_mask_R"], "exclude": ["FPGA_scrap_R","FPGA_scrap_RW"] }, "STAT/SST/1": {