From bce8c661b0aed4aa856121a80311513c9fb4640c Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Fri, 15 Apr 2022 11:27:56 +0200
Subject: [PATCH] L2S-731: Improved SDP dashboard

---
 docker-compose/grafana/dashboards/sdp.json | 550 +++++++++++++--------
 1 file changed, 331 insertions(+), 219 deletions(-)

diff --git a/docker-compose/grafana/dashboards/sdp.json b/docker-compose/grafana/dashboards/sdp.json
index cd59c60c4..fdec4eb15 100644
--- a/docker-compose/grafana/dashboards/sdp.json
+++ b/docker-compose/grafana/dashboards/sdp.json
@@ -678,11 +678,11 @@
             "mode": "absolute",
             "steps": [
               {
-                "color": "green",
+                "color": "transparent",
                 "value": null
               },
               {
-                "color": "red",
+                "color": "green",
                 "value": 1
               }
             ]
@@ -696,6 +696,76 @@
         "x": 0,
         "y": 12
       },
+      "id": 65,
+      "options": {
+        "colorMode": "background",
+        "graphMode": "none",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "textMode": "name"
+      },
+      "pluginVersion": "8.4.5",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "6W2nM-Vnz"
+          },
+          "exemplar": true,
+          "expr": "device_attribute{device=\"stat/unb2/1\",name=\"UNB2_mask_RW\"}",
+          "interval": "",
+          "legendFormat": "{{x}}",
+          "refId": "A"
+        }
+      ],
+      "title": "UNB2 Mask",
+      "type": "stat"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "6W2nM-Vnz"
+      },
+      "description": "Is there any I2C bus error?",
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "transparent",
+                "value": null
+              },
+              {
+                "color": "green",
+                "value": 10
+              },
+              {
+                "color": "red",
+                "value": 11
+              }
+            ]
+          }
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 2,
+        "w": 3,
+        "x": 3,
+        "y": 12
+      },
       "id": 31,
       "options": {
         "colorMode": "background",
@@ -719,13 +789,13 @@
             "uid": "6W2nM-Vnz"
           },
           "exemplar": true,
-          "expr": "device_attribute{device=\"stat/unb2/1\",name=\"UNB2_error_R\"}",
+          "expr": "device_attribute{device=\"stat/unb2/1\",name=\"UNB2_error_R\"}\r\n+ on(x) (10 * device_attribute{device=\"stat/unb2/1\",name=\"UNB2_mask_RW\"})",
           "interval": "",
           "legendFormat": "{{x}}",
           "refId": "A"
         }
       ],
-      "title": "Translator <-> Uniboard Communication",
+      "title": "Bus Status",
       "type": "stat"
     },
     {
@@ -752,19 +822,19 @@
                 "value": 1
               },
               {
-                "color": "green",
+                "color": "blue",
                 "value": 2
               },
               {
-                "color": "#EAB839",
+                "color": "purple",
                 "value": 3
               },
               {
-                "color": "blue",
+                "color": "green",
                 "value": 4
               },
               {
-                "color": "purple",
+                "color": "yellow",
                 "value": 5
               },
               {
@@ -783,7 +853,7 @@
       "gridPos": {
         "h": 2,
         "w": 3,
-        "x": 3,
+        "x": 6,
         "y": 12
       },
       "id": 35,
@@ -849,7 +919,7 @@
       "gridPos": {
         "h": 2,
         "w": 3,
-        "x": 6,
+        "x": 9,
         "y": 12
       },
       "id": 32,
@@ -915,7 +985,7 @@
       "gridPos": {
         "h": 2,
         "w": 3,
-        "x": 9,
+        "x": 12,
         "y": 12
       },
       "id": 33,
@@ -981,7 +1051,7 @@
       "gridPos": {
         "h": 2,
         "w": 3,
-        "x": 12,
+        "x": 15,
         "y": 12
       },
       "id": 34,
@@ -1034,7 +1104,7 @@
         "type": "prometheus",
         "uid": "6W2nM-Vnz"
       },
-      "description": "Whether the FPGA is being controlled",
+      "description": "Is the FPGA being controlled?",
       "fieldConfig": {
         "defaults": {
           "color": {
@@ -1100,7 +1170,7 @@
         "type": "prometheus",
         "uid": "6W2nM-Vnz"
       },
-      "description": "",
+      "description": "Can the FPGA be reached, and does it report a firmware version?",
       "fieldConfig": {
         "defaults": {
           "color": {
@@ -1111,12 +1181,16 @@
             "mode": "absolute",
             "steps": [
               {
-                "color": "green",
+                "color": "transparent",
                 "value": null
               },
+              {
+                "color": "green",
+                "value": 10
+              },
               {
                 "color": "red",
-                "value": 1
+                "value": 11
               }
             ]
           }
@@ -1152,7 +1226,7 @@
             "uid": "6W2nM-Vnz"
           },
           "exemplar": true,
-          "expr": "device_attribute{device=\"stat/sdp/1\",name=\"FPGA_error_R\"}",
+          "expr": "device_attribute{device=\"stat/sdp/1\",name=\"TR_fpga_communication_error_R\"}\r\n+ on(x) (device_attribute{device=\"stat/sdp/1\",name=\"FPGA_firmware_version_R\"} == bool 0)\r\n+ on(x) (10 * device_attribute{device=\"stat/sdp/1\",name=\"TR_fpga_mask_R\"})",
           "interval": "",
           "legendFormat": "{{x}}",
           "refId": "A"
@@ -1262,7 +1336,7 @@
         "type": "prometheus",
         "uid": "6W2nM-Vnz"
       },
-      "description": "",
+      "description": "Is the PPS present?",
       "fieldConfig": {
         "defaults": {
           "color": {
@@ -1273,12 +1347,16 @@
             "mode": "absolute",
             "steps": [
               {
-                "color": "red",
+                "color": "transparent",
                 "value": null
               },
+              {
+                "color": "red",
+                "value": 10
+              },
               {
                 "color": "green",
-                "value": 1
+                "value": 11
               }
             ]
           }
@@ -1314,7 +1392,7 @@
             "uid": "6W2nM-Vnz"
           },
           "exemplar": true,
-          "expr": "device_attribute{device=\"stat/sdp/1\",name=\"FPGA_pps_present_R\"}",
+          "expr": "device_attribute{device=\"stat/sdp/1\",name=\"FPGA_pps_present_R\"}\r\n+ on(x) (10 * device_attribute{device=\"stat/sdp/1\",name=\"TR_fpga_mask_R\"})",
           "interval": "",
           "legendFormat": "{{x}}",
           "refId": "A"
@@ -1328,7 +1406,7 @@
         "type": "prometheus",
         "uid": "6W2nM-Vnz"
       },
-      "description": "",
+      "description": "Is the WG turned on, replacing any antenna signal?",
       "fieldConfig": {
         "defaults": {
           "color": {
@@ -1380,7 +1458,7 @@
             "uid": "6W2nM-Vnz"
           },
           "exemplar": true,
-          "expr": "sum by (y) (device_attribute{device=\"stat/sdp/1\",name=\"FPGA_wg_enable_R\"})",
+          "expr": "sum by (x) (device_attribute{device=\"stat/sdp/1\",name=\"FPGA_wg_enable_R\"})",
           "interval": "",
           "legendFormat": "{{x}}",
           "refId": "A"
@@ -1469,7 +1547,7 @@
         "type": "prometheus",
         "uid": "6W2nM-Vnz"
       },
-      "description": "",
+      "description": "Is the FPGA receiving a signal on all of its inputs?",
       "fieldConfig": {
         "defaults": {
           "color": {
@@ -1480,12 +1558,16 @@
             "mode": "absolute",
             "steps": [
               {
-                "color": "green",
+                "color": "transparent",
                 "value": null
               },
+              {
+                "color": "green",
+                "value": 10
+              },
               {
                 "color": "red",
-                "value": 1
+                "value": 11
               }
             ]
           }
@@ -1521,7 +1603,8 @@
             "uid": "6W2nM-Vnz"
           },
           "exemplar": true,
-          "expr": "device_attribute{device=\"stat/sdp/1\",name=\"FPGA_input_error_R\"}",
+          "expr": "(sum by (x) (device_attribute{device=\"stat/sdp/1\", name=\"FPGA_signal_input_rms_R\"}) == bool 0)\r\n+ on(x) (10 * device_attribute{device=\"stat/sdp/1\", name=\"TR_fpga_mask_R\"})\r\n",
+          "instant": false,
           "interval": "",
           "legendFormat": "{{x}}",
           "refId": "A"
@@ -1535,7 +1618,7 @@
         "type": "prometheus",
         "uid": "6W2nM-Vnz"
       },
-      "description": "",
+      "description": "Is the signal processing enabled?",
       "fieldConfig": {
         "defaults": {
           "color": {
@@ -1546,12 +1629,16 @@
             "mode": "absolute",
             "steps": [
               {
-                "color": "green",
+                "color": "transparent",
                 "value": null
               },
+              {
+                "color": "green",
+                "value": 10
+              },
               {
                 "color": "red",
-                "value": 1
+                "value": 11
               }
             ]
           }
@@ -1587,13 +1674,16 @@
             "uid": "6W2nM-Vnz"
           },
           "exemplar": true,
-          "expr": "device_attribute{device=\"stat/sdp/1\",name=\"FPGA_processing_error_R\"}",
+          "expr": "(1 - device_attribute{device=\"stat/sdp/1\",   name=\"FPGA_processing_enable_R\"})\r\n+ on(x) (device_attribute{device=\"stat/sdp/1\", name=\"FPGA_boot_image_R\"} != bool 1)\r\n+ on(x) (10 * device_attribute{device=\"stat/sdp/1\", name=\"TR_fpga_mask_R\"})",
+          "hide": false,
+          "instant": false,
           "interval": "",
           "legendFormat": "{{x}}",
           "refId": "A"
         }
       ],
       "title": "FPGA Processing",
+      "transformations": [],
       "type": "stat"
     },
     {
@@ -1601,7 +1691,7 @@
         "type": "prometheus",
         "uid": "6W2nM-Vnz"
       },
-      "description": "",
+      "description": "Offset between the Translator local time and the FPGA PPS.",
       "fieldConfig": {
         "defaults": {
           "color": {
@@ -1748,7 +1838,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -1839,7 +1930,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -1930,7 +2022,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2021,7 +2114,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2112,7 +2206,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2202,7 +2297,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2292,7 +2388,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2382,7 +2479,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2472,7 +2570,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2563,7 +2662,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2654,7 +2754,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2745,7 +2846,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2836,7 +2938,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -2927,7 +3030,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -3018,7 +3122,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -3109,7 +3214,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -3200,7 +3306,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -3291,7 +3398,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -3382,7 +3490,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -3472,7 +3581,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -3562,7 +3672,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -3614,7 +3725,7 @@
       "type": "row"
     },
     {
-      "collapsed": true,
+      "collapsed": false,
       "gridPos": {
         "h": 1,
         "w": 24,
@@ -3622,189 +3733,190 @@
         "y": 28
       },
       "id": 61,
-      "panels": [
-        {
-          "datasource": {
-            "type": "prometheus",
-            "uid": "6W2nM-Vnz"
+      "panels": [],
+      "title": "Temperatures",
+      "type": "row"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "6W2nM-Vnz"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
           },
-          "fieldConfig": {
-            "defaults": {
-              "color": {
-                "mode": "palette-classic"
-              },
-              "custom": {
-                "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"
-                  },
-                  {
-                    "color": "red",
-                    "value": 80
-                  }
-                ]
-              },
-              "unit": "celsius"
+          "custom": {
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "drawStyle": "line",
+            "fillOpacity": 0,
+            "gradientMode": "none",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
             },
-            "overrides": []
-          },
-          "gridPos": {
-            "h": 8,
-            "w": 11,
-            "x": 0,
-            "y": 29
-          },
-          "id": 63,
-          "options": {
-            "legend": {
-              "calcs": [],
-              "displayMode": "hidden",
-              "placement": "bottom"
+            "lineInterpolation": "linear",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
             },
-            "tooltip": {
-              "mode": "multi",
-              "sort": "desc"
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
             }
           },
-          "targets": [
-            {
-              "datasource": {
-                "type": "prometheus",
-                "uid": "6W2nM-Vnz"
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": null
               },
-              "exemplar": true,
-              "expr": "device_attribute{device=\"stat/unb2/1\",name=~\".*_TEMP_R\"} > 0",
-              "interval": "",
-              "legendFormat": "Uniboard {{x}} - {{name}}",
-              "refId": "A"
-            }
-          ],
-          "title": "Uniboard Sensors",
-          "type": "timeseries"
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          },
+          "unit": "celsius"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 11,
+        "x": 0,
+        "y": 29
+      },
+      "id": 63,
+      "options": {
+        "legend": {
+          "calcs": [],
+          "displayMode": "hidden",
+          "placement": "bottom"
         },
+        "tooltip": {
+          "mode": "multi",
+          "sort": "desc"
+        }
+      },
+      "targets": [
         {
           "datasource": {
             "type": "prometheus",
             "uid": "6W2nM-Vnz"
           },
-          "description": "",
-          "fieldConfig": {
-            "defaults": {
-              "color": {
-                "mode": "palette-classic"
-              },
-              "custom": {
-                "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"
-                  },
-                  {
-                    "color": "red",
-                    "value": 80
-                  }
-                ]
-              },
-              "unit": "celsius"
-            },
-            "overrides": []
-          },
-          "gridPos": {
-            "h": 8,
-            "w": 12,
-            "x": 11,
-            "y": 29
+          "exemplar": true,
+          "expr": "device_attribute{device=\"stat/unb2/1\",name=~\".*_TEMP_R\"} > 0",
+          "interval": "",
+          "legendFormat": "Uniboard {{x}} - {{name}}",
+          "refId": "A"
+        }
+      ],
+      "title": "Uniboard Sensors",
+      "type": "timeseries"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "6W2nM-Vnz"
+      },
+      "description": "",
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
           },
-          "id": 64,
-          "options": {
-            "legend": {
-              "calcs": [],
-              "displayMode": "hidden",
-              "placement": "bottom"
+          "custom": {
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "drawStyle": "line",
+            "fillOpacity": 0,
+            "gradientMode": "none",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
             },
-            "tooltip": {
-              "mode": "multi",
-              "sort": "desc"
+            "lineInterpolation": "linear",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
             }
           },
-          "targets": [
-            {
-              "datasource": {
-                "type": "prometheus",
-                "uid": "6W2nM-Vnz"
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": null
               },
-              "exemplar": true,
-              "expr": "device_attribute{device=\"stat/sdp/1\",name=\"FPGA_temp_R\"} > 0",
-              "interval": "",
-              "legendFormat": "FPGA {{x}}",
-              "refId": "A"
-            }
-          ],
-          "title": "FPGA",
-          "type": "timeseries"
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          },
+          "unit": "celsius"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 12,
+        "x": 11,
+        "y": 29
+      },
+      "id": 64,
+      "options": {
+        "legend": {
+          "calcs": [],
+          "displayMode": "hidden",
+          "placement": "bottom"
+        },
+        "tooltip": {
+          "mode": "multi",
+          "sort": "desc"
+        }
+      },
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "6W2nM-Vnz"
+          },
+          "exemplar": true,
+          "expr": "device_attribute{device=\"stat/sdp/1\",name=\"FPGA_temp_R\"} > 0",
+          "interval": "",
+          "legendFormat": "FPGA {{x}}",
+          "refId": "A"
         }
       ],
-      "title": "Temperatures",
-      "type": "row"
+      "title": "FPGA",
+      "type": "timeseries"
     }
   ],
   "refresh": false,
@@ -3822,6 +3934,6 @@
   "timezone": "",
   "title": "SDP",
   "uid": "sdp",
-  "version": 11,
+  "version": 20,
   "weekStart": ""
 }
-- 
GitLab