# Copyright 2018 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# configs map used by grafana
apiVersion: v1
kind: ConfigMap
metadata:
  name: agones-status
  namespace: metrics
  labels:
     grafana_dashboard: "1"
data:
  dashboard-agones-status.json: |
    {
      "annotations": {
        "list": [
          {
            "$$hashKey": "object:188",
            "builtIn": 1,
            "datasource": "-- Grafana --",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "type": "dashboard"
          }
        ]
      },
      "description": "Agones CRD controller status",
      "editable": true,
      "gnetId": null,
      "graphTooltip": 0,
      "iteration": 1546913780919,
      "links": [],
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorValue": false,
          "colors": [
            "#299c46",
            "rgba(237, 129, 40, 0.89)",
            "#d44a3a"
          ],
          "datasource": null,
          "format": "dateTimeFromNow",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 8,
            "w": 12,
            "x": 0,
            "y": 0
          },
          "id": 9,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "$$hashKey": "object:335",
              "name": "value to text",
              "value": 1
            },
            {
              "$$hashKey": "object:336",
              "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"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "$$hashKey": "object:818",
              "expr": "(process_start_time_seconds{app=\"agones\",agones_dev_role=\"controller\"}) * 1000",
              "format": "time_series",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "",
              "refId": "A"
            }
          ],
          "thresholds": "",
          "title": "Controller Uptime",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "$$hashKey": "object:338",
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "#d44a3a",
            "#d44a3a",
            "#299c46"
          ],
          "datasource": null,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 8,
            "w": 12,
            "x": 12,
            "y": 0
          },
          "id": 7,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "$$hashKey": "object:390",
              "name": "value to text",
              "value": 1
            },
            {
              "$$hashKey": "object:391",
              "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"
            }
          ],
          "sparkline": {
            "fillColor": "#0a50a1",
            "full": false,
            "lineColor": "#052b51",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "$$hashKey": "object:323",
              "expr": "up{app=\"agones\"} OR on() vector(0)",
              "format": "time_series",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "",
              "refId": "A"
            }
          ],
          "thresholds": "0,1",
          "timeFrom": null,
          "title": "Controller",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "$$hashKey": "object:393",
              "op": "=",
              "text": "UP",
              "value": "1"
            },
            {
              "$$hashKey": "object:786",
              "op": "=",
              "text": "DOWN",
              "value": "0"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "#299c46",
            "#299c46",
            "#d44a3a"
          ],
          "datasource": null,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 9,
            "w": 6,
            "x": 0,
            "y": 8
          },
          "id": 2,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "$$hashKey": "object:982",
              "name": "value to text",
              "value": 1
            },
            {
              "$$hashKey": "object:983",
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "minSpan": 1,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "repeat": "healthcheck",
          "repeatDirection": "h",
          "scopedVars": {
            "healthcheck": {
              "selected": true,
              "text": "fleet-workerqueue",
              "value": "fleet-workerqueue"
            }
          },
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "$$hashKey": "object:930",
              "expr": "agones_healthcheck_status{check=\"$healthcheck\"} OR on() vector(1)",
              "format": "time_series",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "{{check}}",
              "refId": "A"
            }
          ],
          "thresholds": "0,1",
          "title": "health check - $healthcheck",
          "transparent": false,
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "$$hashKey": "object:985",
              "op": "=",
              "text": "OK",
              "value": "0"
            },
            {
              "$$hashKey": "object:986",
              "op": "=",
              "text": "NOK",
              "value": "1"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "#299c46",
            "#299c46",
            "#d44a3a"
          ],
          "datasource": null,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 9,
            "w": 6,
            "x": 6,
            "y": 8
          },
          "id": 15,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "$$hashKey": "object:982",
              "name": "value to text",
              "value": 1
            },
            {
              "$$hashKey": "object:983",
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "minSpan": 1,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "repeat": null,
          "repeatDirection": "h",
          "repeatIteration": 1546913780919,
          "repeatPanelId": 2,
          "scopedVars": {
            "healthcheck": {
              "selected": true,
              "text": "fleetautoscaler-workerqueue",
              "value": "fleetautoscaler-workerqueue"
            }
          },
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "$$hashKey": "object:930",
              "expr": "agones_healthcheck_status{check=\"$healthcheck\"} OR on() vector(1)",
              "format": "time_series",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "{{check}}",
              "refId": "A"
            }
          ],
          "thresholds": "0,1",
          "title": "health check - $healthcheck",
          "transparent": false,
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "$$hashKey": "object:985",
              "op": "=",
              "text": "OK",
              "value": "0"
            },
            {
              "$$hashKey": "object:986",
              "op": "=",
              "text": "NOK",
              "value": "1"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "#299c46",
            "#299c46",
            "#d44a3a"
          ],
          "datasource": null,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 9,
            "w": 6,
            "x": 12,
            "y": 8
          },
          "id": 16,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "$$hashKey": "object:982",
              "name": "value to text",
              "value": 1
            },
            {
              "$$hashKey": "object:983",
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "minSpan": 1,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "repeat": null,
          "repeatDirection": "h",
          "repeatIteration": 1546913780919,
          "repeatPanelId": 2,
          "scopedVars": {
            "healthcheck": {
              "selected": true,
              "text": "gameserver-workerqueue",
              "value": "gameserver-workerqueue"
            }
          },
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "$$hashKey": "object:930",
              "expr": "agones_healthcheck_status{check=\"$healthcheck\"} OR on() vector(1)",
              "format": "time_series",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "{{check}}",
              "refId": "A"
            }
          ],
          "thresholds": "0,1",
          "title": "health check - $healthcheck",
          "transparent": false,
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "$$hashKey": "object:985",
              "op": "=",
              "text": "OK",
              "value": "0"
            },
            {
              "$$hashKey": "object:986",
              "op": "=",
              "text": "NOK",
              "value": "1"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "#299c46",
            "#299c46",
            "#d44a3a"
          ],
          "datasource": null,
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 9,
            "w": 6,
            "x": 18,
            "y": 8
          },
          "id": 17,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "$$hashKey": "object:982",
              "name": "value to text",
              "value": 1
            },
            {
              "$$hashKey": "object:983",
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "minSpan": 1,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "repeat": null,
          "repeatDirection": "h",
          "repeatIteration": 1546913780919,
          "repeatPanelId": 2,
          "scopedVars": {
            "healthcheck": {
              "selected": true,
              "text": "gameserverset-workerqueue",
              "value": "gameserverset-workerqueue"
            }
          },
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "$$hashKey": "object:930",
              "expr": "agones_healthcheck_status{check=\"$healthcheck\"} OR on() vector(1)",
              "format": "time_series",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "{{check}}",
              "refId": "A"
            }
          ],
          "thresholds": "0,1",
          "title": "health check - $healthcheck",
          "transparent": false,
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "$$hashKey": "object:985",
              "op": "=",
              "text": "OK",
              "value": "0"
            },
            {
              "$$hashKey": "object:986",
              "op": "=",
              "text": "NOK",
              "value": "1"
            }
          ],
          "valueName": "current"
        }
      ],
      "refresh": "10s",
      "schemaVersion": 16,
      "style": "dark",
      "tags": [
        "agones",
        "controller"
      ],
      "templating": {
        "list": [
          {
            "allValue": null,
            "current": {
              "text": "fleet-workerqueue + fleetautoscaler-workerqueue + gameserver-workerqueue + gameserverset-workerqueue",
              "value": [
                "fleet-workerqueue",
                "fleetautoscaler-workerqueue",
                "gameserver-workerqueue",
                "gameserverset-workerqueue"
              ]
            },
            "datasource": "Prometheus",
            "hide": 0,
            "includeAll": false,
            "label": null,
            "multi": true,
            "name": "healthcheck",
            "options": [],
            "query": "label_values(agones_healthcheck_status, check)\t",
            "refresh": 2,
            "regex": "",
            "sort": 0,
            "tagValuesQuery": "",
            "tags": [],
            "tagsQuery": "",
            "type": "query",
            "useTags": false
          }
        ]
      },
      "time": {
        "from": "now-5m",
        "to": "now"
      },
      "timepicker": {
        "refresh_intervals": [
          "5s",
          "10s",
          "30s",
          "1m",
          "5m",
          "15m",
          "30m",
          "1h",
          "2h",
          "1d"
        ],
        "time_options": [
          "5m",
          "15m",
          "1h",
          "6h",
          "12h",
          "24h",
          "2d",
          "7d",
          "30d"
        ]
      },
      "timezone": "",
      "title": "Agones Status",
      "uid": "tKtFEN8iz",
      "version": 1
    }