Add cluster status to Grafana dashboard
diff --git a/glusterfs/files/grafana_dashboards/glusterfs_influxdb.json b/glusterfs/files/grafana_dashboards/glusterfs_influxdb.json
index fb1b9cc..31c05a7 100644
--- a/glusterfs/files/grafana_dashboards/glusterfs_influxdb.json
+++ b/glusterfs/files/grafana_dashboards/glusterfs_influxdb.json
@@ -1,6 +1,19 @@
 {
   "annotations": {
-    "list": []
+    "list": [
+      {
+        "datasource": "lma",
+        "enable": true,
+        "iconColor": "rgb(255, 255, 255)",
+        "limit": 100,
+        "name": "Status",
+        "query": "select title,tags,text from annotations where $timeFilter and cluster =~ /^glusterfs$/",
+        "tagsColumn": "tags",
+        "textColumn": "text",
+        "titleColumn": "title",
+        "type": "alert"
+      }
+    ]
   },
   "editable": true,
   "gnetId": null,
@@ -11,7 +24,6 @@
   "rows": [
     {
       "collapse": false,
-      "editable": true,
       "height": "250px",
       "panels": [
         {
@@ -19,9 +31,9 @@
           "colorBackground": true,
           "colorValue": false,
           "colors": [
-            "rgba(225, 40, 40, 0.59)",
+            "rgba(71, 212, 59, 0.4)",
             "rgba(241, 181, 37, 0.73)",
-            "rgba(71, 212, 59, 0.4)"
+            "rgba(225, 40, 40, 0.59)"
           ],
           "datasource": null,
           "editable": true,
@@ -62,7 +74,7 @@
               "to": "null"
             }
           ],
-          "span": 3,
+          "span": 2,
           "sparkline": {
             "fillColor": "rgba(31, 118, 189, 0.18)",
             "full": false,
@@ -76,20 +88,146 @@
               "dsType": "influxdb",
               "fill": "",
               "function": "last",
-              "groupBy": [
+              "groupBy": [],
+              "groupby_field": "",
+              "interval": "",
+              "measurement": "cluster_status",
+              "policy": "default",
+              "query": "SELECT last(\"value\") FROM \"cluster_status\" WHERE \"environment_label\" =~ /^$environment$/ AND \"cluster_name\" = 'glusterfs' AND $timeFilter",
+              "rawQuery": false,
+              "refId": "A",
+              "resultFormat": "time_series",
+              "select": [
+                [
+                  {
+                    "params": [
+                      "value"
+                    ],
+                    "type": "field"
+                  },
+                  {
+                    "params": [],
+                    "type": "last"
+                  }
+                ]
+              ],
+              "tags": [
                 {
-                  "params": [
-                    "$interval"
-                  ],
-                  "type": "time"
+                  "key": "environment_label",
+                  "operator": "=~",
+                  "value": "/^$environment$/"
                 },
                 {
-                  "params": [
-                    "null"
-                  ],
-                  "type": "fill"
+                  "condition": "AND",
+                  "key": "cluster_name",
+                  "operator": "=",
+                  "value": "glusterfs"
                 }
-              ],
+              ]
+            }
+          ],
+          "thresholds": "1,3",
+          "title": "cluster",
+          "transparent": false,
+          "type": "singlestat",
+          "valueFontSize": "80%",
+          "valueMaps": [
+            {
+              "op": "=",
+              "text": "no data",
+              "value": "null"
+            },
+            {
+              "op": "=",
+              "text": "OKAY",
+              "value": "0"
+            },
+            {
+              "op": "=",
+              "text": "WARN",
+              "value": "1"
+            },
+            {
+              "op": "=",
+              "text": "UNKN",
+              "value": "2"
+            },
+            {
+              "op": "=",
+              "text": "CRIT",
+              "value": "3"
+            },
+            {
+              "op": "=",
+              "text": "DOWN",
+              "value": "4"
+            }
+          ],
+          "valueName": "current"
+        },
+        {
+          "cacheTimeout": null,
+          "colorBackground": true,
+          "colorValue": false,
+          "colors": [
+            "rgba(225, 40, 40, 0.59)",
+            "rgba(241, 181, 37, 0.73)",
+            "rgba(71, 212, 59, 0.4)"
+          ],
+          "datasource": null,
+          "editable": true,
+          "error": false,
+          "format": "none",
+          "gauge": {
+            "maxValue": 100,
+            "minValue": 0,
+            "show": false,
+            "thresholdLabels": false,
+            "thresholdMarkers": true
+          },
+          "id": 20,
+          "interval": "> 60s",
+          "links": [],
+          "mappingType": 1,
+          "mappingTypes": [
+            {
+              "name": "value to text",
+              "value": 1
+            },
+            {
+              "name": "range to text",
+              "value": 2
+            }
+          ],
+          "maxDataPoints": 100,
+          "nullPointMode": "connected",
+          "nullText": null,
+          "postfix": "",
+          "postfixFontSize": "50%",
+          "prefix": "",
+          "prefixFontSize": "50%",
+          "rangeMaps": [
+            {
+              "from": "null",
+              "text": "N/A",
+              "to": "null"
+            }
+          ],
+          "span": 2,
+          "sparkline": {
+            "fillColor": "rgba(31, 118, 189, 0.18)",
+            "full": false,
+            "lineColor": "rgb(31, 120, 193)",
+            "show": false
+          },
+          "targets": [
+            {
+              "column": "value",
+              "condition": "",
+              "dsType": "influxdb",
+              "fill": "",
+              "function": "last",
+              "groupBy": [],
               "groupByTags": [],
               "groupby_field": "",
               "interval": "",
@@ -129,7 +267,7 @@
             }
           ],
           "thresholds": "0,1",
-          "title": "$server status",
+          "title": "$server",
           "type": "singlestat",
           "valueFontSize": "80%",
           "valueMaps": [
@@ -169,11 +307,10 @@
             "minValue": 0,
             "show": false,
             "thresholdLabels": false,
-            "thresholdMarkers": true
+            "thresholdMarkers": false
           },
           "id": 14,
           "interval": null,
-          "isNew": true,
           "links": [],
           "mappingType": 1,
           "mappingTypes": [
@@ -200,7 +337,7 @@
               "to": "null"
             }
           ],
-          "span": 3,
+          "span": 2,
           "sparkline": {
             "fillColor": "rgba(31, 118, 189, 0.18)",
             "full": false,
@@ -210,20 +347,7 @@
           "targets": [
             {
               "dsType": "influxdb",
-              "groupBy": [
-                {
-                  "params": [
-                    "$interval"
-                  ],
-                  "type": "time"
-                },
-                {
-                  "params": [
-                    "null"
-                  ],
-                  "type": "fill"
-                }
-              ],
+              "groupBy": [],
               "measurement": "glusterfs_peers_percent",
               "policy": "default",
               "refId": "A",
@@ -238,7 +362,7 @@
                   },
                   {
                     "params": [],
-                    "type": "mean"
+                    "type": "last"
                   }
                 ]
               ],
@@ -284,15 +408,8 @@
           "editable": true,
           "error": false,
           "fill": 0,
-          "grid": {
-            "threshold1": null,
-            "threshold1Color": "rgba(216, 200, 27, 0.27)",
-            "threshold2": null,
-            "threshold2Color": "rgb(249, 24, 24)",
-            "thresholdLine": false
-          },
+          "grid": {},
           "id": 15,
-          "isNew": true,
           "legend": {
             "avg": false,
             "current": false,
@@ -371,6 +488,7 @@
               ]
             }
           ],
+          "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
           "title": "Peer state",
@@ -383,7 +501,10 @@
           "transparent": false,
           "type": "graph",
           "xaxis": {
-            "show": true
+            "mode": "time",
+            "name": null,
+            "show": true,
+            "values": []
           },
           "yaxes": [
             {
@@ -405,11 +526,15 @@
           ]
         }
       ],
-      "title": "Peers"
+      "repeat": null,
+      "repeatIteration": null,
+      "repeatRowId": null,
+      "showTitle": false,
+      "title": "Peers",
+      "titleSize": "h6"
     },
     {
       "collapse": false,
-      "editable": true,
       "height": "250px",
       "panels": [
         {
@@ -420,15 +545,8 @@
           "editable": true,
           "error": false,
           "fill": 0,
-          "grid": {
-            "threshold1": null,
-            "threshold1Color": "rgba(216, 200, 27, 0.27)",
-            "threshold2": null,
-            "threshold2Color": "rgb(249, 24, 24)",
-            "thresholdLine": false
-          },
+          "grid": {},
           "id": 16,
-          "isNew": true,
           "legend": {
             "avg": false,
             "current": false,
@@ -582,6 +700,7 @@
               ]
             }
           ],
+          "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
           "title": "Disk space",
@@ -594,7 +713,10 @@
           "transparent": false,
           "type": "graph",
           "xaxis": {
-            "show": true
+            "mode": "time",
+            "name": null,
+            "show": true,
+            "values": []
           },
           "yaxes": [
             {
@@ -623,15 +745,8 @@
           "editable": true,
           "error": false,
           "fill": 0,
-          "grid": {
-            "threshold1": null,
-            "threshold1Color": "rgba(216, 200, 27, 0.27)",
-            "threshold2": null,
-            "threshold2Color": "rgb(249, 24, 24)",
-            "thresholdLine": false
-          },
+          "grid": {},
           "id": 17,
-          "isNew": true,
           "legend": {
             "avg": false,
             "current": false,
@@ -785,6 +900,7 @@
               ]
             }
           ],
+          "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
           "title": "Inodes",
@@ -797,7 +913,10 @@
           "transparent": false,
           "type": "graph",
           "xaxis": {
-            "show": true
+            "mode": "time",
+            "name": null,
+            "show": true,
+            "values": []
           },
           "yaxes": [
             {
@@ -820,19 +939,14 @@
         }
       ],
       "repeat": "volume",
-      "scopedVars": {
-        "volume": {
-          "selected": false,
-          "text": "glance",
-          "value": "glance"
-        }
-      },
+      "repeatIteration": null,
+      "repeatRowId": null,
       "showTitle": true,
-      "title": "$volume volume"
+      "title": "$volume volume on $peer",
+      "titleSize": "h6"
     },
     {
       "collapse": false,
-      "editable": true,
       "height": "250px",
       "panels": [
         {
@@ -843,15 +957,8 @@
           "editable": true,
           "error": false,
           "fill": 0,
-          "grid": {
-            "threshold1": null,
-            "threshold1Color": "rgba(216, 200, 27, 0.27)",
-            "threshold2": null,
-            "threshold2Color": "rgb(249, 24, 24)",
-            "thresholdLine": false
-          },
+          "grid": {},
           "id": 18,
-          "isNew": true,
           "legend": {
             "avg": false,
             "current": false,
@@ -1005,6 +1112,7 @@
               ]
             }
           ],
+          "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
           "title": "Disk space",
@@ -1017,7 +1125,10 @@
           "transparent": false,
           "type": "graph",
           "xaxis": {
-            "show": true
+            "mode": "time",
+            "name": null,
+            "show": true,
+            "values": []
           },
           "yaxes": [
             {
@@ -1046,15 +1157,8 @@
           "editable": true,
           "error": false,
           "fill": 0,
-          "grid": {
-            "threshold1": null,
-            "threshold1Color": "rgba(216, 200, 27, 0.27)",
-            "threshold2": null,
-            "threshold2Color": "rgb(249, 24, 24)",
-            "thresholdLine": false
-          },
+          "grid": {},
           "id": 19,
-          "isNew": true,
           "legend": {
             "avg": false,
             "current": false,
@@ -1208,6 +1312,7 @@
               ]
             }
           ],
+          "thresholds": [],
           "timeFrom": null,
           "timeShift": null,
           "title": "Inodes",
@@ -1220,7 +1325,10 @@
           "transparent": false,
           "type": "graph",
           "xaxis": {
-            "show": true
+            "mode": "time",
+            "name": null,
+            "show": true,
+            "values": []
           },
           "yaxes": [
             {
@@ -1243,20 +1351,14 @@
         }
       ],
       "repeat": null,
-      "repeatIteration": 1479736313733,
+      "repeatIteration": 1481016468403,
       "repeatRowId": 2,
-      "scopedVars": {
-        "volume": {
-          "selected": false,
-          "text": "keystone-keys",
-          "value": "keystone-keys"
-        }
-      },
       "showTitle": true,
-      "title": "$volume volume"
+      "title": "$volume volume on $peer",
+      "titleSize": "h6"
     }
   ],
-  "schemaVersion": 12,
+  "schemaVersion": 13,
   "sharedCrosshair": true,
   "style": "dark",
   "tags": [],
@@ -1265,52 +1367,72 @@
     "list": [
       {
         "allFormat": "regex values",
+        "allValue": null,
         "current": {},
         "datasource": null,
         "hide": 0,
         "includeAll": false,
+        "label": null,
+        "multi": false,
         "name": "environment",
         "options": [],
         "query": "show tag values from glusterfs_check with key = environment_label",
         "refresh": 1,
         "refresh_on_load": true,
         "regex": "",
+        "sort": 0,
+        "tagValuesQuery": null,
+        "tagsQuery": null,
         "type": "query"
       },
       {
         "allFormat": "glob",
+        "allValue": null,
         "current": {},
         "datasource": null,
         "hide": 0,
         "includeAll": false,
+        "label": null,
+        "multi": false,
         "name": "server",
         "options": [],
         "query": "show tag values from glusterfs_check with key = hostname where environment_label =~ /^$environment$/",
         "refresh": 1,
         "refresh_on_load": true,
         "regex": "",
+        "sort": 0,
+        "tagValuesQuery": null,
+        "tagsQuery": null,
         "type": "query"
       },
       {
         "allFormat": "glob",
+        "allValue": null,
         "current": {},
         "datasource": null,
         "hide": 0,
         "includeAll": false,
+        "label": null,
+        "multi": false,
         "name": "peer",
         "options": [],
         "query": "show tag values from glusterfs_inodes_free with key = peer where environment_label =~ /^$environment$/ and hostname =~ /^$server$/",
         "refresh": 1,
         "refresh_on_load": true,
         "regex": "",
+        "sort": 0,
+        "tagValuesQuery": null,
+        "tagsQuery": null,
         "type": "query"
       },
       {
         "allFormat": "glob",
+        "allValue": null,
         "current": {},
         "datasource": null,
         "hide": 0,
         "includeAll": true,
+        "label": null,
         "multi": true,
         "name": "volume",
         "options": [],
@@ -1318,6 +1440,9 @@
         "refresh": 1,
         "refresh_on_load": true,
         "regex": "",
+        "sort": 0,
+        "tagValuesQuery": null,
+        "tagsQuery": null,
         "type": "query"
       }
     ]
@@ -1359,5 +1484,5 @@
   },
   "timezone": "browser",
   "title": "GlusterFS",
-  "version": 30
-}
\ No newline at end of file
+  "version": 31
+}