Grafana dashboard: EKS cost
Description: EKS cost visualization.


{
  "__inputs": [
    {
      "name": "DS_AMAZON_TIMESTREAM",
      "label": "Amazon Timestream",
      "description": "",
      "type": "datasource",
      "pluginId": "grafana-timestream-datasource",
      "pluginName": "Amazon Timestream"
    },
    {
      "name": "VAR_TABLE_NODE_INFO",
      "type": "constant",
      "label": "table_node_info",
      "value": "node_info",
      "description": ""
    },
    {
      "name": "VAR_TABLE_POD_INFO",
      "type": "constant",
      "label": "table_pod_info",
      "value": "pod_info",
      "description": ""
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "panel",
      "id": "bargauge",
      "name": "Bar gauge",
      "version": ""
    },
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.0.4"
    },
    {
      "type": "datasource",
      "id": "grafana-timestream-datasource",
      "name": "Amazon Timestream",
      "version": "2.1.0"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "EKS cost visualization.",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "gnetId": 16609,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 62,
      "title": "Overview",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 0,
        "y": 1
      },
      "id": 24,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.0.4",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "WITH a AS (\n\t\tWITH node_cost_day AS (\n\t\t\t\tWITH node_cost_per_hour AS (\n\t\t\t\t\t\tSELECT measure_name, avg(node_price) AS avg_price\n\t\t\t\t\t\t\t, bin(time, 1h) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\tWHERE time > ago(31d)\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 1h)\n\t\t\t\t\t\tORDER BY bin(time, 1h)\n\t\t\t\t\t)\n\t\t\t\tSELECT date_trunc('month', binned_timestamp) AS one_month, measure_name\n\t\t\t\t\t, sum(avg_price) AS sum_price\n\t\t\t\tFROM node_cost_per_hour\n\t\t\t\tGROUP BY date_trunc('month', binned_timestamp), measure_name\n\t\t\t\tORDER BY measure_name\n\t\t\t)\n\t\tSELECT one_month, measure_name, sum(sum_price) AS node_cost_per_day\n\t\tFROM node_cost_day\n\t\tGROUP BY one_month, measure_name\n\t\tORDER BY one_month\n\t)\nSELECT one_month, sum(node_cost_per_day)\nFROM a\nGROUP BY one_month\nORDER BY one_month DESC\nLIMIT 1",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "MONTH",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 6,
        "y": 1
      },
      "id": 26,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.0.4",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "WITH a AS (\n\t\tWITH node_cost_day AS (\n\t\t\t\tWITH node_cost_per_hour AS (\n\t\t\t\t\t\tSELECT measure_name, avg(node_price) AS avg_price\n\t\t\t\t\t\t\t, bin(time, 1h) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\tWHERE time > ago(7d)\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 1h)\n\t\t\t\t\t\tORDER BY bin(time, 1h)\n\t\t\t\t\t)\n\t\t\t\tSELECT date_trunc('week', binned_timestamp) AS one_week, measure_name\n\t\t\t\t\t, sum(avg_price) AS sum_price\n\t\t\t\tFROM node_cost_per_hour\n\t\t\t\tGROUP BY date_trunc('week', binned_timestamp), measure_name\n\t\t\t\tORDER BY measure_name\n\t\t\t)\n\t\tSELECT one_week, measure_name, sum(sum_price) AS node_cost_per_day\n\t\tFROM node_cost_day\n\t\tGROUP BY one_week, measure_name\n\t\tORDER BY one_week\n\t)\nSELECT one_week, sum(node_cost_per_day)\nFROM a\nGROUP BY one_week\nORDER BY one_week DESC\nLIMIT 1",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "WEEK",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "AZ"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 131
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "PRICE"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 112
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "NODE_NAME"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 200
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "TYPE"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "CapacityType"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 109
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 12,
        "w": 12,
        "x": 12,
        "y": 1
      },
      "id": 18,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.0.4",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-10-0-15-86.ec2.internal",
          "rawQuery": "SELECT distinct(measure_name)AS NODE_NAME, node_instance_type AS TYPE, upper(node_capacityType) AS CapacityType, node_zone AS AZ, node_price AS PRICE\nFROM $__database.$table_node_info\nWHERE time > ago(3m)\nGROUP BY distinct(measure_name), node_zone, node_instance_type, upper(node_capacityType), node_price\nORDER BY NODE_NAME\n",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Node List",
      "type": "table"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 0,
        "y": 7
      },
      "id": 22,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.0.4",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "WITH a AS (\n\t\tWITH node_cost_day AS (\n\t\t\t\tWITH node_cost_per_hour AS (\n\t\t\t\t\t\tSELECT measure_name, avg(node_price) AS avg_price\n\t\t\t\t\t\t\t, bin(time, 1h) AS binned_timestamp\n\t\t\t\t\t\tFROM  $__database.$table_node_info\n\t\t\t\t\t\tWHERE time >ago(24h)\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 1h)\n\t\t\t\t\t\tORDER BY bin(time, 1h)\n\t\t\t\t\t)\n\t\t\t\tSELECT date_trunc('day', binned_timestamp) AS one_day, measure_name\n\t\t\t\t\t, sum(avg_price) AS sum_price\n\t\t\t\tFROM node_cost_per_hour\n\t\t\t\tGROUP BY date_trunc('day', binned_timestamp), measure_name\n\t\t\t\tORDER BY measure_name\n\t\t\t)\n\t\tSELECT one_day, measure_name, sum(sum_price) AS node_cost_per_day\n\t\tFROM node_cost_day\n\t\tGROUP BY one_day, measure_name\n\t\tORDER BY one_day\n\t)\nSELECT one_day, sum(node_cost_per_day)\nFROM a\nGROUP BY one_day\nORDER BY one_day DESC\nLIMIT 1",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "TODAY",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 6,
        "y": 7
      },
      "id": 12,
      "options": {
        "displayLabels": [
          "percent"
        ],
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "values": []
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "aws-load-balancer-controller-5674bcb96d-cz9sb",
          "rawQuery": "SELECT count(DISTINCT measure_name), upper(node_capacityType)\nFROM $__database.$table_node_info\nWHERE time > ago(3m)\nGROUP BY upper(node_capacityType)",
          "refId": "A",
          "table": "\"pod_info\""
        }
      ],
      "title": "SPOT/ON_DEMAND",
      "type": "piechart"
    },
    {
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 13
      },
      "id": 60,
      "title": "Period Cost",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-GrYlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 18,
        "x": 0,
        "y": 14
      },
      "id": 30,
      "options": {
        "displayMode": "lcd",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [],
          "fields": "",
          "values": true
        },
        "showUnfilled": true
      },
      "pluginVersion": "9.0.4",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "WITH node_cost_per_hour AS (\n\t\tSELECT measure_name, avg(node_price) AS avg_price\n\t\t\t, bin(time, 1h) AS binned_timestamp\n\t\tFROM $__database.$table_node_info\n\t\tWHERE $__timeFilter\n\t\tGROUP BY measure_name, bin(time, 1h)\n\t\tORDER BY bin(time, 1h)\n\t)\nSELECT measure_name, sum(avg_price) AS sum_cost\nFROM node_cost_per_hour\nGROUP BY measure_name",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Node Cost",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "mappings": [],
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 70
              },
              {
                "color": "red",
                "value": 85
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 5,
        "x": 18,
        "y": 14
      },
      "id": 28,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true
      },
      "pluginVersion": "9.0.4",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "WITH node_cost_per_hour AS (\n\t\tSELECT measure_name, avg(node_price) AS avg_price\n\t\t\t, bin(time, 1h) AS binned_timestamp\n\t\tFROM $__database.$table_node_info\n\t\twhere $__timeFilter\n\n\t\tGROUP BY measure_name, bin(time, 1h)\n\t\tORDER BY bin(time, 1h)\n\t)\nSELECT sum(avg_price) as ekscost_by_timefileter\nFROM node_cost_per_hour\n-- GROUP BY 1\n-- order by 1 ",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Cluster Cost",
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 22
      },
      "id": 52,
      "options": {
        "displayLabels": [
          "percent"
        ],
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "values": []
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-10-0-16-75.ec2.internal",
          "rawQuery": "WITH namespace_cost AS (\n\t\tWITH cpu AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, namespace, measure_name, avg(pod_utilization_cpu) AS pod_utilization_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, namespace, measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_cpu) AS node_allocatable_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT a.namespace, a.binned_timestamp\n\t\t\t\t\t, sum(a.pod_utilization_cpu / b.node_allocatable_cpu * b.node_price) AS cpu_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t\tGROUP BY a.namespace, a.binned_timestamp\n\t\t\t), \n\t\t\tmem AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, namespace, measure_name, avg(pod_utilization_memory) AS pod_utilization_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, namespace, measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_memory) AS node_allocatable_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT a.namespace, a.binned_timestamp\n\t\t\t\t\t, sum(a.pod_utilization_memory / b.node_allocatable_memory * b.node_price) AS memory_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t\tGROUP BY a.namespace, a.binned_timestamp\n\t\t\t)\n\t\tSELECT cpu.namespace, cpu.binned_timestamp, (cpu.cpu_cost + mem.memory_cost) / 2 AS namespace_cost\n\t\tFROM cpu\n\t\t\tJOIN mem\n\t\t\tON cpu.namespace = mem.namespace\n\t\t\t\tAND cpu.binned_timestamp = mem.binned_timestamp\n\t)\nSELECT namespace, sum(namespace_cost)\nFROM namespace_cost\nGROUP BY namespace\nORDER BY namespace",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Namespace Cost",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": []
        },
        "overrides": [
          {
            "__systemRef": "hideSeriesFrom",
            "matcher": {
              "id": "byNames",
              "options": {
                "mode": "exclude",
                "names": [
                  "pod_cost_by_filter"
                ],
                "prefix": "All except:",
                "readOnly": true
              }
            },
            "properties": [
              {
                "id": "custom.hideFrom",
                "value": {
                  "legend": false,
                  "tooltip": false,
                  "viz": true
                }
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 22
      },
      "id": 46,
      "options": {
        "displayLabels": [
          "percent"
        ],
        "legend": {
          "displayMode": "list",
          "placement": "right",
          "values": []
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "WITH pod_cost AS (\n\t\tWITH cpu AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, measure_name, avg(pod_utilization_cpu) AS pod_utilization_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_cpu) AS node_allocatable_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT a.measure_name, a.binned_timestamp, a.pod_utilization_cpu / b.node_allocatable_cpu * b.node_price AS cpu_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t), \n\t\t\tmem AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, measure_name, avg(pod_utilization_memory) AS pod_utilization_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_memory) AS node_allocatable_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT a.measure_name, a.binned_timestamp, a.pod_utilization_memory / b.node_allocatable_memory * b.node_price AS memory_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t)\n\t\tSELECT cpu.measure_name, cpu.binned_timestamp, (cpu.cpu_cost + mem.memory_cost) / 2 AS pod_cost\n\t\tFROM cpu\n\t\t\tJOIN mem\n\t\t\tON cpu.measure_name = mem.measure_name\n\t\t\t\tAND cpu.binned_timestamp = mem.binned_timestamp\n\t)\nSELECT measure_name, sum(pod_cost) AS pod_cost_by_filter\nFROM pod_cost\nGROUP BY measure_name\nORDER BY measure_name",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Pod Cost",
      "type": "piechart"
    },
    {
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 31
      },
      "id": 58,
      "title": "Trends",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 100,
            "gradientMode": "hue",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "normal"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 32
      },
      "id": 36,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "WITH pod_day_cost AS (\n\t\tWITH pod_cost AS (\n\t\t\t\tWITH cpu AS (\n\t\t\t\t\t\tWITH a AS (\n\t\t\t\t\t\t\t\tSELECT node_name, measure_name, avg(pod_utilization_cpu) AS pod_utilization_cpu\n\t\t\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\t\t\tGROUP BY node_name, measure_name, bin(time, 3600s)\n\t\t\t\t\t\t\t), \n\t\t\t\t\t\t\tb AS (\n\t\t\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_cpu) AS node_allocatable_cpu\n\t\t\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tSELECT a.measure_name, a.binned_timestamp, a.pod_utilization_cpu / b.node_allocatable_cpu * b.node_price AS cpu_cost\n\t\t\t\t\t\tFROM a\n\t\t\t\t\t\t\tJOIN b\n\t\t\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t\t\t), \n\t\t\t\t\tmem AS (\n\t\t\t\t\t\tWITH a AS (\n\t\t\t\t\t\t\t\tSELECT node_name, measure_name, avg(pod_utilization_memory) AS pod_utilization_memory\n\t\t\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\t\t\tGROUP BY node_name, measure_name, bin(time, 3600s)\n\t\t\t\t\t\t\t), \n\t\t\t\t\t\t\tb AS (\n\t\t\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_memory) AS node_allocatable_memory\n\t\t\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tSELECT a.measure_name, a.binned_timestamp, a.pod_utilization_memory / b.node_allocatable_memory * b.node_price AS memory_cost\n\t\t\t\t\t\tFROM a\n\t\t\t\t\t\t\tJOIN b\n\t\t\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t\t\t)\n\t\t\t\tSELECT cpu.measure_name, cpu.binned_timestamp, (cpu.cpu_cost + mem.memory_cost) / 2 AS pod_cost\n\t\t\t\tFROM cpu\n\t\t\t\t\tJOIN mem\n\t\t\t\t\tON cpu.measure_name = mem.measure_name\n\t\t\t\t\t\tAND cpu.binned_timestamp = mem.binned_timestamp\n\t\t\t)\n\t\tSELECT measure_name, bin(binned_timestamp, 1d) AS one_day\n\t\t\t, sum(pod_cost) AS pod_cost_one_day\n\t\tFROM pod_cost\n\t\tGROUP BY measure_name, 2\n\t)\nSELECT measure_name, CREATE_TIME_SERIES(one_day, pod_cost_one_day) AS \" \"\nFROM pod_day_cost\nGROUP BY measure_name",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Pod Cost by DAY",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 100,
            "gradientMode": "hue",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "normal"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 32
      },
      "id": 16,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "aws-load-balancer-controller-68d5b9f54c-bmppj",
          "rawQuery": "WITH pod_cost AS (\n\t\tWITH cpu AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, measure_name, avg(pod_utilization_cpu) AS pod_utilization_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_cpu) AS node_allocatable_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT a.measure_name, a.binned_timestamp, a.pod_utilization_cpu / b.node_allocatable_cpu * b.node_price AS cpu_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t), \n\t\t\tmem AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, measure_name, avg(pod_utilization_memory) AS pod_utilization_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_memory) AS node_allocatable_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT a.measure_name, a.binned_timestamp, a.pod_utilization_memory / b.node_allocatable_memory * b.node_price AS memory_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t)\n\t\tSELECT cpu.measure_name, cpu.binned_timestamp, (cpu.cpu_cost + mem.memory_cost) / 2 AS pod_cost\n\t\tFROM cpu\n\t\t\tJOIN mem\n\t\t\tON cpu.measure_name = mem.measure_name\n\t\t\t\tAND cpu.binned_timestamp = mem.binned_timestamp\n\t)\nSELECT measure_name, CREATE_TIME_SERIES(binned_timestamp, pod_cost) AS \" \"\nFROM pod_cost\nGROUP BY measure_name",
          "refId": "A",
          "table": "\"pod_info\""
        }
      ],
      "title": "Pod Cost by HOUR",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 100,
            "gradientMode": "hue",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "normal"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 40
      },
      "id": 50,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "\nWITH namespace_cost_one_day as(\nWITH namespace_cost AS (\n\t\tWITH cpu AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, namespace,measure_name, avg(pod_utilization_cpu) AS pod_utilization_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, namespace,measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_cpu) AS node_allocatable_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\n\t\t\t\tSELECT a.namespace,a.binned_timestamp,sum(a.pod_utilization_cpu / b.node_allocatable_cpu * b.node_price) AS cpu_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t\t\tgroup by a.namespace,a.binned_timestamp\n\t\t\t), \n\t\t\tmem AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, namespace,measure_name, avg(pod_utilization_memory) AS pod_utilization_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, namespace,measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_memory) AS node_allocatable_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT a.namespace, a.binned_timestamp, sum(a.pod_utilization_memory / b.node_allocatable_memory * b.node_price) AS memory_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t\t\t\t\t\t\t\t\tgroup by a.namespace,a.binned_timestamp\n\n\t\t\t)\n\t\tSELECT cpu.namespace, cpu.binned_timestamp, (cpu.cpu_cost + mem.memory_cost) / 2 AS namespace_cost\n\t\tFROM cpu\n\t\t\tJOIN mem\n\t\t\tON cpu.namespace = mem.namespace\n\t\t\t\tAND cpu.binned_timestamp = mem.binned_timestamp\n\t)\nSELECT namespace,bin(binned_timestamp, 1d) AS one_day,sum(namespace_cost) as namespace_cost_one_day\nFROM namespace_cost\nGROUP BY namespace,2)\nSELECT namespace, CREATE_TIME_SERIES(one_day, namespace_cost_one_day) AS \" \"\n\nfrom namespace_cost_one_day\ngroup by namespace",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Namespace Cost by DAY",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 100,
            "gradientMode": "hue",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "normal"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 40
      },
      "id": 48,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "\n\nWITH namespace_cost AS (\n\t\tWITH cpu AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, namespace,measure_name, avg(pod_utilization_cpu) AS pod_utilization_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, namespace,measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_cpu) AS node_allocatable_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\n\t\t\t\tSELECT a.namespace,a.binned_timestamp,sum(a.pod_utilization_cpu / b.node_allocatable_cpu * b.node_price) AS cpu_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t\t\tgroup by a.namespace,a.binned_timestamp\n\t\t\t), \n\t\t\tmem AS (\n\t\t\t\tWITH a AS (\n\t\t\t\t\t\tSELECT node_name, namespace,measure_name, avg(pod_utilization_memory) AS pod_utilization_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, namespace,measure_name, bin(time, 3600s)\n\t\t\t\t\t), \n\t\t\t\t\tb AS (\n\t\t\t\t\t\tSELECT measure_name AS node_name, avg(node_price) AS node_price, avg(node_allocatable_memory) AS node_allocatable_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\t\t\twhere $__timeFilter\n\t\t\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT a.namespace, a.binned_timestamp, sum(a.pod_utilization_memory / b.node_allocatable_memory * b.node_price) AS memory_cost\n\t\t\t\tFROM a\n\t\t\t\t\tJOIN b\n\t\t\t\t\tON a.node_name = b.node_name\n\t\t\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t\t\t\t\t\t\t\t\t\t\tgroup by a.namespace,a.binned_timestamp\n\n\t\t\t)\n\t\tSELECT cpu.namespace, cpu.binned_timestamp, (cpu.cpu_cost + mem.memory_cost) / 2 AS namespace_cost\n\t\tFROM cpu\n\t\t\tJOIN mem\n\t\t\tON cpu.namespace = mem.namespace\n\t\t\t\tAND cpu.binned_timestamp = mem.binned_timestamp\n\t)\nSELECT namespace, CREATE_TIME_SERIES(binned_timestamp, namespace_cost) AS \" \"\nFROM namespace_cost\n GROUP BY namespace",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Namespace Cost by HOUR",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 100,
            "gradientMode": "hue",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "normal"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 48
      },
      "id": 4,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-10-0-15-86.ec2.internal",
          "rawQuery": "WITH b AS (\n\t\tWITH a AS (\n\t\t\t\tSELECT measure_name, avg(node_price) AS avg_price\n\t\t\t\t\t, bin(time, 1h) AS binned_timestamp\n\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\tWHERE $__timeFilter\n\t\t\t\tGROUP BY measure_name, bin(time, 1h)\n\t\t\t\tORDER BY bin(time, 1h) ASC\n\t\t\t)\n\t\tSELECT measure_name, sum(avg_price) AS sum_price\n\t\t\t, bin(binned_timestamp, 1d) AS binned_timestamp_day\n\t\tFROM a\n\t\tGROUP BY measure_name, bin(binned_timestamp, 1d)\n\t)\nSELECT measure_name, CREATE_TIME_SERIES(binned_timestamp_day, sum_price) AS  \" \"\nFROM b\nGROUP BY measure_name",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Node Cost by DAY",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 100,
            "gradientMode": "hue",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "normal"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 48
      },
      "id": 54,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-172-31-12-153.ap-northeast-1.compute.internal",
          "rawQuery": "WITH node_cost_per_hour AS (\n\t\tSELECT measure_name, avg(node_price) AS avg_price\n\t\t\t, bin(time, 1h) AS binned_timestamp\n\t\tFROM $__database.$table_node_info\n\t\tWHERE $__timeFilter\n\t\tGROUP BY measure_name, bin(time, 1h)\n\t\tORDER BY bin(time, 1h) ASC\n\t)\nSELECT measure_name, CREATE_TIME_SERIES(binned_timestamp, avg_price) AS \" \"\nFROM node_cost_per_hour\nGROUP BY measure_name",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Node Cost by HOUR",
      "type": "timeseries"
    },
    {
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 56
      },
      "id": 56,
      "title": "Effective",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "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",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 57
      },
      "id": 6,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.0.2",
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "aws-load-balancer-controller-68d5b9f54c-bmppj",
          "rawQuery": "WITH a AS (\n\t\tSELECT measure_name, BIN(time, 1h) AS binned_timestamp\n\t\t\t, AVG(pod_utilization_cpu) / avg(pod_request_cpu) * 100 AS pod_utilization_cpu\n\t\tFROM $__database.$table_pod_info\n\t\tWHERE $__timeFilter\n\t\tGROUP BY measure_name, BIN(time, 1h)\n\t)\nSELECT measure_name, CREATE_TIME_SERIES(binned_timestamp, pod_utilization_cpu) AS \" \"\nFROM a\nGROUP BY measure_name",
          "refId": "A",
          "table": "\"pod_info\""
        }
      ],
      "title": "Effective CPU Request",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "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",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 57
      },
      "id": 34,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-10-0-19-143.ec2.internal",
          "rawQuery": "WITH a AS (\n\t\tSELECT measure_name, BIN(time, 1h) AS binned_timestamp\n\t\t\t, AVG(pod_utilization_memory) / avg(pod_request_memory) * 100 AS pod_utilization_memory\n\t\tFROM $__database.$table_pod_info\n\t\tWHERE $__timeFilter\n\t\tGROUP BY measure_name, BIN(time, 1h)\n\t)\nSELECT measure_name, CREATE_TIME_SERIES(binned_timestamp, pod_utilization_memory) AS \" \"\nFROM a\nGROUP BY measure_name",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Effective MEMORY Request",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "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",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 65
      },
      "id": 66,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-10-0-16-75.ec2.internal",
          "rawQuery": "WITH effective_cpu AS (\n\t\tWITH a AS (\n\t\t\t\tWITH cpu AS (\n\t\t\t\t\t\tSELECT node_name, measure_name, avg(pod_utilization_cpu) AS pod_utilization_cpu\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT node_name, binned_timestamp, sum(pod_utilization_cpu) AS node_utilization_cpu\n\t\t\t\tFROM cpu\n\t\t\t\tGROUP BY node_name, binned_timestamp\n\t\t\t), \n\t\t\tb AS (\n\t\t\t\tSELECT measure_name AS node_name, avg(node_allocatable_cpu) AS node_allocatable_cpu\n\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\tWHERE $__timeFilter\n\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t)\n\t\tSELECT a.node_name, a.binned_timestamp, a.node_utilization_cpu / b.node_allocatable_cpu * 100 AS node_effective_cpu\n\t\tFROM a\n\t\t\tJOIN b\n\t\t\tON a.node_name = b.node_name\n\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t)\nSELECT node_name, CREATE_TIME_SERIES(binned_timestamp, node_effective_cpu) AS \" \"\nFROM effective_cpu\nGROUP BY node_name",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Node Effective CPU",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-timestream-datasource",
        "uid": "${DS_AMAZON_TIMESTREAM}"
      },
      "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",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 65
      },
      "id": 64,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "grafana-timestream-datasource",
            "uid": "${DS_AMAZON_TIMESTREAM}"
          },
          "measure": "ip-10-0-16-75.ec2.internal",
          "rawQuery": "WITH effective_memory AS (\n\t\tWITH a AS (\n\t\t\t\tWITH memory AS (\n\t\t\t\t\t\tSELECT node_name, measure_name, avg(pod_utilization_memory) AS pod_utilization_memory\n\t\t\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\t\t\tFROM $__database.$table_pod_info\n\t\t\t\t\t\tWHERE $__timeFilter\n\t\t\t\t\t\tGROUP BY node_name, measure_name, bin(time, 3600s)\n\t\t\t\t\t)\n\t\t\t\tSELECT node_name, binned_timestamp, sum(pod_utilization_memory) AS node_utilization_memory\n\t\t\t\tFROM memory\n\t\t\t\tGROUP BY node_name, binned_timestamp\n\t\t\t), \n\t\t\tb AS (\n\t\t\t\tSELECT measure_name AS node_name, avg(node_allocatable_memory) AS node_allocatable_memory\n\t\t\t\t\t, bin(time, 3600s) AS binned_timestamp\n\t\t\t\tFROM $__database.$table_node_info\n\t\t\t\tWHERE $__timeFilter\n\t\t\t\tGROUP BY measure_name, bin(time, 3600s)\n\t\t\t)\n\t\tSELECT a.node_name, a.binned_timestamp, a.node_utilization_memory / b.node_allocatable_memory * 100 AS node_effective_memory\n\t\tFROM a\n\t\t\tJOIN b\n\t\t\tON a.node_name = b.node_name\n\t\t\t\tAND a.binned_timestamp = b.binned_timestamp\n\t)\nSELECT node_name, CREATE_TIME_SERIES(binned_timestamp, node_effective_memory) AS \" \"\nFROM effective_memory\nGROUP BY node_name",
          "refId": "A",
          "table": "\"node_info\""
        }
      ],
      "title": "Node Effective MEMORY",
      "type": "timeseries"
    }
  ],
  "refresh": false,
  "schemaVersion": 36,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "hide": 2,
        "name": "table_node_info",
        "query": "${VAR_TABLE_NODE_INFO}",
        "skipUrlSync": false,
        "type": "constant",
        "current": {
          "value": "${VAR_TABLE_NODE_INFO}",
          "text": "${VAR_TABLE_NODE_INFO}",
          "selected": false
        },
        "options": [
          {
            "value": "${VAR_TABLE_NODE_INFO}",
            "text": "${VAR_TABLE_NODE_INFO}",
            "selected": false
          }
        ]
      },
      {
        "hide": 2,
        "name": "table_pod_info",
        "query": "${VAR_TABLE_POD_INFO}",
        "skipUrlSync": false,
        "type": "constant",
        "current": {
          "value": "${VAR_TABLE_POD_INFO}",
          "text": "${VAR_TABLE_POD_INFO}",
          "selected": false
        },
        "options": [
          {
            "value": "${VAR_TABLE_POD_INFO}",
            "text": "${VAR_TABLE_POD_INFO}",
            "selected": false
          }
        ]
      }
    ]
  },
  "time": {
    "from": "now-7d",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "EKS cost",
  "uid": "W-5LDk6nz",
  "version": 6,
  "weekStart": ""
}