Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjvi/007a757773d51c236af3df192aa89d07 to your computer and use it in GitHub Desktop.
Save benjvi/007a757773d51c236af3df192aa89d07 to your computer and use it in GitHub Desktop.
Apps in Namespace Basic Health Dashboard
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "7.5.4"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "table",
"name": "Table",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1643195212711,
"links": [],
"panels": [
{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Not Ready"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
{
"id": "custom.width",
"value": 106
}
]
},
{
"matcher": {
"id": "byName",
"options": "Ready"
},
"properties": [
{
"id": "custom.width",
"value": 75
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total"
},
"properties": [
{
"id": "custom.width",
"value": 68
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 11,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Not Ready"
}
]
},
"pluginVersion": "7.5.4",
"targets": [
{
"exemplar": true,
"expr": "sum(kube_replicaset_status_ready_replicas{namespace=~\"$namespaces\"}) by (replicaset,namespace)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"refId": "A"
},
{
"exemplar": true,
"expr": "sum(kube_replicaset_spec_replicas{namespace=~\"$namespaces\"} > 0) by (replicaset, namespace) - sum(kube_replicaset_status_ready_replicas{namespace=~\"$namespaces\"}) by (replicaset,namespace)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "C"
},
{
"exemplar": true,
"expr": "sum(kube_replicaset_spec_replicas{namespace=~\"$namespaces\"} > 0) by (replicaset, namespace)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "B"
}
],
"title": "Replicaset Health",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"replicaset",
"Value #A",
"Value #B",
"Value #C"
]
}
}
},
{
"id": "merge",
"options": {}
},
{
"id": "filterByValue",
"options": {
"filters": [
{
"config": {
"id": "greater",
"options": {
"value": 0
}
},
"fieldName": "Value #B"
}
],
"match": "all",
"type": "include"
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Value #C": false,
"Value #D": false
},
"indexByName": {
"Value #A": 2,
"Value #B": 3,
"Value #C": 1,
"replicaset": 0
},
"renameByName": {
"Value #A": "Ready",
"Value #B": "Total",
"Value #C": "Not Ready",
"Value #D": "Pod Age (days)"
}
}
}
],
"type": "table"
},
{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Not Ready"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
{
"id": "custom.width",
"value": 106
}
]
},
{
"matcher": {
"id": "byName",
"options": "Ready"
},
"properties": [
{
"id": "custom.width",
"value": 75
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total"
},
"properties": [
{
"id": "custom.width",
"value": 68
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 11,
"x": 11,
"y": 0
},
"id": 4,
"options": {
"frameIndex": 0,
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Not Ready"
}
]
},
"pluginVersion": "7.5.4",
"targets": [
{
"exemplar": true,
"expr": "sum(kube_statefulset_status_replicas_ready{namespace=~\"$namespaces\"}) by (statefulset,namespace)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"refId": "A"
},
{
"exemplar": true,
"expr": "sum(kube_statefulset_status_replicas{namespace=~\"$namespaces\"} > 0) by (statefulset, namespace) - sum(kube_statefulset_status_replicas_ready{namespace=~\"$namespaces\"}) by (statefulset,namespace)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "C"
},
{
"exemplar": true,
"expr": "sum(kube_statefulset_status_replicas{namespace=~\"$namespaces\"} > 0) by (statefulset, namespace)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "B"
}
],
"title": "StatefulSet Health",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"Value #A",
"Value #C",
"Value #B",
"statefulset"
]
}
}
},
{
"id": "merge",
"options": {}
},
{
"id": "filterByValue",
"options": {
"filters": [
{
"config": {
"id": "greater",
"options": {
"value": 0
}
},
"fieldName": "Value #B"
}
],
"match": "all",
"type": "include"
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Value #C": false,
"Value #D": false
},
"indexByName": {
"Value #A": 2,
"Value #B": 3,
"Value #C": 1,
"statefulset": 0
},
"renameByName": {
"Value #A": "Ready",
"Value #B": "Total",
"Value #C": "Not Ready",
"Value #D": "Pod Age (days)"
}
}
}
],
"type": "table"
},
{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Not Ready"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
{
"id": "custom.width",
"value": 106
}
]
},
{
"matcher": {
"id": "byName",
"options": "Ready"
},
"properties": [
{
"id": "custom.width",
"value": 75
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total"
},
"properties": [
{
"id": "custom.width",
"value": 68
}
]
}
]
},
"gridPos": {
"h": 9,
"w": 11,
"x": 0,
"y": 9
},
"id": 3,
"options": {
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Not Ready"
}
]
},
"pluginVersion": "7.5.4",
"targets": [
{
"exemplar": true,
"expr": "sum(kube_daemonset_status_number_ready{namespace=~\"$namespaces\"}) by (daemonset,namespace)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"refId": "A"
},
{
"exemplar": true,
"expr": "sum(kube_daemonset_status_desired_number_scheduled{namespace=~\"$namespaces\"} > 0) by (daemonset, namespace) - sum(kube_daemonset_status_number_ready{namespace=~\"$namespaces\"}) by (daemonset,namespace)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "C"
},
{
"exemplar": true,
"expr": "sum(kube_daemonset_status_desired_number_scheduled{namespace=~\"$namespaces\"} > 0) by (daemonset, namespace)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "B"
}
],
"title": "Daemonset Health",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"Value #B",
"daemonset",
"Value #A",
"Value #C"
]
}
}
},
{
"id": "merge",
"options": {}
},
{
"id": "filterByValue",
"options": {
"filters": [
{
"config": {
"id": "greater",
"options": {
"value": 0
}
},
"fieldName": "Value #B"
}
],
"match": "all",
"type": "include"
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Value #C": false,
"Value #D": false
},
"indexByName": {
"Value #A": 2,
"Value #B": 3,
"Value #C": 1,
"daemonset": 0
},
"renameByName": {
"Value #A": "Ready",
"Value #B": "Total",
"Value #C": "Not Ready",
"Value #D": "Pod Age (days)"
}
}
}
],
"type": "table"
},
{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Restart Rate (per day)"
},
"properties": [
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 0.5
}
]
}
},
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "custom.width",
"value": 93
}
]
},
{
"matcher": {
"id": "byName",
"options": "Uptime (hours)"
},
"properties": [
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 48
}
]
}
},
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "custom.width",
"value": 172
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 11,
"x": 11,
"y": 9
},
"id": 7,
"options": {
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Restart Rate (per day)"
}
]
},
"pluginVersion": "7.5.4",
"targets": [
{
"exemplar": true,
"expr": "sum(kube_pod_container_status_restarts_total{namespace=~\"$namespaces\"}) by (namespace,pod) / on (namespace,pod) group_right(container) ((time() - kube_pod_created) / 86400)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"refId": "A"
},
{
"exemplar": true,
"expr": "sum(time() - kube_pod_container_state_started{namespace=~\"$namespaces\"}) by (namespace,pod) / (3600)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "B"
},
{
"exemplar": true,
"expr": "sum(kube_pod_container_status_restarts_total{namespace=~\"$namespaces\"}) by (namespace,pod)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "C"
},
{
"exemplar": true,
"expr": "sum(kube_pod_container_status_restarts_total{namespace=~\"$namespaces\"} * 0 + 1) by (namespace,pod) * on (namespace,pod) group_right(container) ((time() - kube_pod_created) / 86400)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "D"
}
],
"title": "Container Stability",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"pod",
"Value #A",
"Value #B",
"Value #C",
"Value #D",
"container"
]
}
}
},
{
"id": "merge",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Value #C": false,
"Value #D": false
},
"indexByName": {
"Value #A": 4,
"Value #B": 5,
"Value #C": 3,
"Value #D": 2,
"container": 1,
"pod": 0
},
"renameByName": {
"Value #A": "Restart Rate (per day)",
"Value #B": "Uptime (hours)",
"Value #C": "Restarts (total)",
"Value #D": "Pod Age (days)"
}
}
}
],
"type": "table"
},
{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Up"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-text"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 1
}
]
}
},
{
"id": "custom.width",
"value": 106
}
]
},
{
"matcher": {
"id": "byName",
"options": "app"
},
"properties": [
{
"id": "custom.width",
"value": 100
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total"
},
"properties": [
{
"id": "custom.width",
"value": 68
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 11,
"x": 11,
"y": 16
},
"id": 5,
"options": {
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Not Ready"
}
]
},
"pluginVersion": "7.5.4",
"targets": [
{
"exemplar": true,
"expr": "min(\n label_replace(\n up{kubernetes_namespace=~\"$namespaces\"}, \"namespace\", \"$1\", \"kubernetes_namespace\", \"(.+)\"\n ) \n or\n up{namespace=~\"$namespaces\"}\n or\n up{instance=~\"(.*)($namespaces)(.*)\"}\n) by (namespace,job,app,target,instance)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"refId": "A"
}
],
"title": "Metrics Being Scraped",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"app",
"instance",
"job",
"namespace",
"Value"
]
}
}
},
{
"id": "merge",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Value #C": false,
"Value #D": false
},
"indexByName": {
"Value": 4,
"app": 1,
"instance": 2,
"job": 0,
"namespace": 3
},
"renameByName": {
"Value": "Up",
"Value #A": "Ready",
"Value #B": "Total",
"Value #C": "Not Ready",
"Value #D": "Pod Age (days)"
}
}
}
],
"type": "table"
},
{
"datasource": "${DS_PROMETHEUS}",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "left",
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Up"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "green",
"value": 1
}
]
}
},
{
"id": "custom.width",
"value": 106
}
]
},
{
"matcher": {
"id": "byName",
"options": "app"
},
"properties": [
{
"id": "custom.width",
"value": 100
}
]
},
{
"matcher": {
"id": "byName",
"options": "Total"
},
"properties": [
{
"id": "custom.width",
"value": 68
}
]
}
]
},
"gridPos": {
"h": 5,
"w": 11,
"x": 0,
"y": 18
},
"id": 8,
"options": {
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Not Ready"
}
]
},
"pluginVersion": "7.5.4",
"targets": [
{
"exemplar": true,
"expr": "min(\n probe_success{namespace=~\"$namespaces\"}\n or\n probe_success{instance=~\"(.*)($namespaces)(.*)\"}\n) by (namespace,job,ingress,instance)",
"format": "table",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"refId": "A"
}
],
"title": "BlackBox HTTP Probes",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"instance",
"job",
"namespace",
"Value",
"ingress"
]
}
}
},
{
"id": "merge",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Value #C": false,
"Value #D": false
},
"indexByName": {
"Value": 4,
"ingress": 2,
"instance": 3,
"job": 1,
"namespace": 0
},
"renameByName": {
"Value": "Up",
"Value #A": "Ready",
"Value #B": "Total",
"Value #C": "Not Ready",
"Value #D": "Pod Age (days)"
}
}
}
],
"type": "table"
}
],
"schemaVersion": 27,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(kube_namespace_created, namespace)",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "namespaces",
"options": [],
"query": {
"query": "label_values(kube_namespace_created, namespace)",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Apps Basic Checks By Namespace",
"uid": "e8DxRIJnz",
"version": 9
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment