{
  "tags": [],
  "title": "Horizontal Pod Autoscaler (HPA)",
  "widgets": [
    {
      "layout": {
        "x": 0,
        "y": 0,
        "width": 12,
        "height": 5
      },
      "definition": {
        "type": "group",
        "title": "$hpa",
        "widgets": [
          {
            "layout": {
              "x": 0,
              "y": 0,
              "width": 5,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Target Metric ($hpa)",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": false
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:kubernetes_state.hpa.spec_target_metric{$ns,$hpa} by {metric_name,metric_target_type}",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "display_type": "line",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 5,
              "y": 0,
              "width": 5,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Replicas ($hpa)",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": false
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:kubernetes_state.hpa.max_replicas{$ns,$hpa}",
                      "data_source": "metrics"
                    },
                    {
                      "name": "query2",
                      "query": "avg:kubernetes_state.hpa.desired_replicas{$ns,$hpa}",
                      "data_source": "metrics"
                    },
                    {
                      "name": "query3",
                      "query": "avg:kubernetes_state.hpa.current_replicas{$ns,$hpa}",
                      "data_source": "metrics"
                    },
                    {
                      "name": "query4",
                      "query": "avg:kubernetes_state.hpa.min_replicas{$ns,$hpa}",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "alias": "max",
                      "formula": "query1"
                    },
                    {
                      "alias": "desired",
                      "formula": "query2"
                    },
                    {
                      "alias": "current",
                      "formula": "query3"
                    },
                    {
                      "alias": "min",
                      "formula": "query4"
                    }
                  ],
                  "display_type": "line",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 10,
              "y": 0,
              "width": 2,
              "height": 1
            },
            "definition": {
              "type": "query_value",
              "title": "Max Replicas",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:kubernetes_state.hpa.max_replicas{$ns,$hpa} by {horizontalpodautoscaler,kube_namespace}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar"
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center"
            }
          },
          {
            "layout": {
              "x": 10,
              "y": 1,
              "width": 2,
              "height": 1
            },
            "definition": {
              "type": "query_value",
              "title": "Current Replicas",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:kubernetes_state.hpa.current_replicas{$ns,$hpa} by {horizontalpodautoscaler,kube_namespace}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar"
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center"
            }
          },
          {
            "layout": {
              "x": 10,
              "y": 2,
              "width": 2,
              "height": 1
            },
            "definition": {
              "type": "query_value",
              "title": "Min Replicas",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:kubernetes_state.hpa.min_replicas{$ns,$hpa} by {horizontalpodautoscaler,kube_namespace}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar"
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center"
            }
          },
          {
            "layout": {
              "x": 0,
              "y": 3,
              "width": 12,
              "height": 2
            },
            "definition": {
              "type": "query_value",
              "title": "Status Condition",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:kubernetes_state.hpa.condition{$ns,$hpa} by {condition,status}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar",
                  "conditional_formats": [
                    {
                      "value": 1,
                      "palette": "white_on_gray",
                      "comparator": ">="
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center"
            }
          }
        ],
        "show_title": true,
        "layout_type": "ordered"
      }
    }
  ],
  "description": "Converted from Grafana dashboard https://grafana.com/grafana/dashboards/22128 (by andrii29). Kubernetes (k8s) Horizontal Pod Autoscaler (HPA)",
  "layout_type": "ordered",
  "reflow_type": "fixed",
  "template_variables": [
    {
      "name": "ns",
      "prefix": "kube_namespace",
      "default": "*",
      "available_values": []
    },
    {
      "name": "hpa",
      "prefix": "horizontalpodautoscaler",
      "default": "*",
      "available_values": []
    }
  ]
}