1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-08 10:04:09 +00:00

Use grafanalib to generate Grafana dashboards

This commit is contained in:
Arve Knudsen 2017-09-15 08:05:12 +02:00
parent 67b1187e31
commit ed5670691e
27 changed files with 3515 additions and 6831 deletions

9
.editorconfig Normal file
View file

@ -0,0 +1,9 @@
root = true
[*.py]
indent_style = space
end_of_line = lf
insert_final_newline = true
max_line_length = 100
trim_trailing_whitespace = true
indent_size = 4

2
.gitignore vendored
View file

@ -6,3 +6,5 @@ requirements.lock
.idea
*.iml
.DS_Store
__pycache__
.env/

View file

@ -0,0 +1,6 @@
FROM python:3.6-slim
RUN apt-get update -y && apt-get install -y git
RUN pip3 install virtualenv
ENTRYPOINT ["/bin/bash"]

View file

@ -1,4 +1,11 @@
BUILDER := docker run --rm -it --workdir /data -v ${PWD}:/data debian:8 ./hack/scripts/generate-manifests.sh
generate:
.PHONY: image
IMAGE := coreos/generate-prometheus-operator-manifests
image: Dockerfile
docker build -t $(IMAGE) .
BUILDER := docker run --rm -it --workdir /data -v ${PWD}:/data $(IMAGE) ./hack/scripts/generate-manifests.sh
generate: image
@echo ">> Compiling assets and generating Kubernetes manifests"
$(BUILDER)

View file

@ -0,0 +1 @@
*-dashboard.json

View file

@ -0,0 +1,92 @@
from grafanalib import core
from grafanalib.core import Graph, Time, SparkLine, \
Gauge, Templating, XAxis, YAxes
def Dashboard(
title, version, time, rows, graphTooltip=0, templating=None,
):
optional_args = {}
if templating is not None:
optional_args['templating'] = templating
return core.Dashboard(
title=title, refresh=None, schemaVersion=14,
version=version, time=time, timezone='browser', inputs=[
{
'name': 'DS_PROMETHEUS',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
], rows=rows, graphTooltip=graphTooltip, **optional_args,
)
def Row(
panels, height=None, title='Dashboard Row', showTitle=False,
editable=None
):
assert isinstance(height, (type(None), int))
return core.Row(
panels=panels, height=height, title=title, showTitle=showTitle,
titleSize='h6', editable=editable,
)
def SingleStat(
title, id, targets, colorValue=False, gauge=Gauge(show=True),
valueFontSize='80%', thresholds=None, valueName='avg', valueMaps=None,
rangeMaps=None, mappingTypes=None, mappingType=None, postfix=None,
sparkline=SparkLine(), prefixFontSize='50%', colors=[
(50, 172, 45, 0.97),
(237, 129, 40, 0.89),
(245, 54, 54, 0.9),
], span=None, format='none', transparent=None,
):
def merge_target(target):
return {**{
'intervalFactor': 2,
'refId': 'A',
'step': 600,
}, **target}
targets = [merge_target(t) for t in targets]
return core.SingleStat(
title=title, id=id, colorValue=colorValue,
dataSource='${DS_PROMETHEUS}', gauge=gauge,
valueFontSize=valueFontSize, thresholds=thresholds,
valueName=valueName, valueMaps=valueMaps, rangeMaps=rangeMaps,
mappingTypes=mappingTypes, targets=targets,
mappingType=mappingType, format=format, colors=colors, span=span,
postfix=postfix, sparkline=sparkline, prefixFontSize=prefixFontSize,
hideTimeOverride=None, transparent=transparent,
)
def Graph(
id, title, targets, dashLength=None, dashes=False, spaceLength=None,
xAxis=None, yAxes=None, nullPointMode='connected',
):
def merge_target(target):
return {**{
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
}, **target}
targets = [merge_target(t) for t in targets]
assert isinstance(yAxes, YAxes)
return core.Graph(
id=id, title=title, dashLength=dashLength, dashes=dashes,
spaceLength=spaceLength, targets=targets, xAxis=xAxis, yAxes=yAxes,
dataSource='${DS_PROMETHEUS}', nullPointMode=nullPointMode,
)
def YAxis(format='none', label='', min=0, show=True):
return core.YAxis(
format=format, label=label, min=min, show=show
)

View file

@ -1,816 +0,0 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.4.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 1,
"hideControls": false,
"id": null,
"links": [],
"rows": [
{
"collapse": false,
"height": "200px",
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 8,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "cores",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 4,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$deployment_namespace\",pod_name=~\"$deployment_name.*\"}[3m])) ",
"intervalFactor": 2,
"refId": "A",
"step": 600
}
],
"thresholds": "",
"title": "CPU",
"type": "singlestat",
"valueFontSize": "110%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 9,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "GB",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "80%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 4,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "sum(container_memory_usage_bytes{namespace=\"$deployment_namespace\",pod_name=~\"$deployment_name.*\"}) / 1024^3",
"intervalFactor": 2,
"refId": "A",
"step": 600
}
],
"thresholds": "",
"title": "Memory",
"type": "singlestat",
"valueFontSize": "110%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"format": "Bps",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": false
},
"id": 7,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 4,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "sum(rate(container_network_transmit_bytes_total{namespace=\"$deployment_namespace\",pod_name=~\"$deployment_name.*\"}[3m])) + sum(rate(container_network_receive_bytes_total{namespace=\"$deployment_namespace\",pod_name=~\"$deployment_name.*\"}[3m])) ",
"intervalFactor": 2,
"refId": "A",
"step": 600
}
],
"thresholds": "",
"title": "Network",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Row",
"titleSize": "h6"
},
{
"collapse": false,
"height": "100px",
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"editable": true,
"error": false,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": false
},
"id": 5,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "max(kube_deployment_spec_replicas{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"metric": "kube_deployment_spec_replicas",
"refId": "A",
"step": 600
}
],
"thresholds": "",
"title": "Desired Replicas",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 6,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "min(kube_deployment_status_replicas_available{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"refId": "A",
"step": 600
}
],
"thresholds": "",
"title": "Available Replicas",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 3,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "max(kube_deployment_status_observed_generation{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "",
"title": "Observed Generation",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 2,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "max(kube_deployment_metadata_generation{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "",
"title": "Metadata Generation",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
},
{
"collapse": false,
"height": "350px",
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 1,
"legend": {
"avg": false,
"current": false,
"hideZero": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "max(kube_deployment_status_replicas{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"legendFormat": "current replicas",
"refId": "A",
"step": 30
},
{
"expr": "min(kube_deployment_status_replicas_available{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"legendFormat": "available",
"refId": "B",
"step": 30
},
{
"expr": "max(kube_deployment_status_replicas_unavailable{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"legendFormat": "unavailable",
"refId": "C",
"step": 30
},
{
"expr": "min(kube_deployment_status_replicas_updated{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"legendFormat": "updated",
"refId": "D",
"step": 30
},
{
"expr": "max(kube_deployment_spec_replicas{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)",
"intervalFactor": 2,
"legendFormat": "desired",
"refId": "E",
"step": 30
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Replicas",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"transparent": false,
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "none",
"label": "",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": false
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"hide": 0,
"includeAll": false,
"label": "Namespace",
"multi": false,
"name": "deployment_namespace",
"options": [],
"query": "label_values(kube_deployment_metadata_generation, namespace)",
"refresh": 1,
"regex": "",
"sort": 0,
"tagValuesQuery": null,
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"hide": 0,
"includeAll": false,
"label": "Deployment",
"multi": false,
"name": "deployment_name",
"options": [],
"query": "label_values(kube_deployment_metadata_generation{namespace=\"$deployment_namespace\"}, deployment)",
"refresh": 1,
"regex": "",
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "deployment",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-6h",
"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": "browser",
"title": "Deployment",
"version": 1
}

View file

@ -0,0 +1,467 @@
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
from _grafanalib import *
dashboard = Dashboard(
title='Deployment',
version=1,
graphTooltip=1,
time=Time(start='now-6h'),
templating=Templating(list=[
{
'allValue': '.*',
'current': {},
'datasource': '${DS_PROMETHEUS}',
'hide': 0,
'includeAll': False,
'label': 'Namespace',
'multi': False,
'name': 'deployment_namespace',
'options': [],
'query': 'label_values(kube_deployment_metadata_generation, '
'namespace)',
'refresh': 1,
'regex': '',
'sort': 0,
'tagValuesQuery': None,
'tags': [],
'tagsQuery': '',
'type': 'query',
'useTags': False,
},
{
'allValue': None,
'current': {},
'datasource': '${DS_PROMETHEUS}',
'hide': 0,
'includeAll': False,
'label': 'Deployment',
'multi': False,
'name': 'deployment_name',
'options': [],
'query': 'label_values(kube_deployment_metadata_generation'
'{namespace="$deployment_namespace"}, deployment)',
'refresh': 1,
'regex': '',
'sort': 0,
'tagValuesQuery': '',
'tags': [],
'tagsQuery': 'deployment',
'type': 'query',
'useTags': False,
},
]),
rows=[
Row(panels=[
SingleStat(
title='CPU',
id=8,
gauge=Gauge(show=False),
postfix='cores',
span=4,
valueFontSize='110%',
mappingType=1,
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
sparkline=SparkLine(
fillColor=(31, 118, 189, 0.18),
lineColor=(31, 120, 193),
show=True,
),
targets=[
{
'expr': 'sum(rate(container_cpu_usage_seconds_total'
'{namespace=\"$deployment_namespace\",pod_name=~\"'
'$deployment_name.*\"}[3m]))',
},
],
),
SingleStat(
title='Memory',
id=9,
postfix='GB',
prefixFontSize='80%',
gauge=Gauge(show=False),
span=4,
valueFontSize='110%',
mappingType=1,
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
sparkline=SparkLine(
fillColor=(31, 118, 189, 0.18),
lineColor=(31, 120, 193),
show=True,
),
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
targets=[
{
'expr': 'sum(container_memory_usage_bytes{namespace='
'\"$deployment_namespace\",pod_name=~\"$'
'deployment_name.*\"}) / 1024^3',
'intervalFactor': 2,
'refId': 'A',
'step': 600,
},
],
),
SingleStat(
title='Network',
format='Bps',
gauge=Gauge(thresholdMarkers=False),
id=7,
postfix='',
span=4,
mappingType=1,
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
sparkline=SparkLine(
fillColor=(31, 118, 189, 0.18),
lineColor=(31, 120, 193),
show=True,
),
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
targets=[
{
'expr': 'sum(rate(container_network_transmit_'
'bytes_total'
'{namespace=\"$deployment_namespace\",pod_name=~\"'
'$deployment_name.*\"}[3m])) + '
'sum(rate(container_network_receive_bytes_total'
'{namespace=\"$deployment_namespace\",pod_name=~'
'\"$deployment_name.*\"}[3m]))',
},
],
),
],
height=200,
),
Row(
height=100, panels=[
SingleStat(
title='Desired Replicas',
id=5,
mappingType=1,
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
span=3,
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
targets=[
{
'metric': 'kube_deployment_spec_replicas',
'expr': 'max(kube_deployment_spec_replicas'
'{deployment="$deployment_name",namespace='
'"$deployment_namespace"}) without '
'(instance, pod)',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
gauge=Gauge(thresholdMarkers=False, show=False),
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
),
SingleStat(
title='Available Replicas',
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
gauge=Gauge(show=False),
id=6,
mappingType=1,
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
targets=[
{
'expr': 'min(kube_deployment_status_replicas_'
'available{deployment=\"$deployment_name\",'
'namespace=\"$deployment_namespace\"}) without '
'(instance, pod)',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
span=3,
sparkline=SparkLine(),
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
}
],
),
SingleStat(
title='Observed Generation',
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
gauge=Gauge(),
id=3,
mappingType=1,
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
targets=[
{
'expr': 'max(kube_deployment_status_observed_'
'generation{deployment=\"$deployment_name\",'
'namespace=\"$deployment_namespace\"}) without '
'(instance, pod)',
},
],
rangeMaps=[
{
'from': "null",
'text': 'N/A',
'to': 'null',
},
],
span=3,
sparkline=SparkLine(),
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
}
],
),
SingleStat(
title='Metadata Generation',
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
gauge=Gauge(show=False),
id=2,
mappingType=1,
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
targets=[
{
'expr': 'max(kube_deployment_metadata_generation'
'{deployment=\"$deployment_name\",namespace=\"'
'$deployment_namespace\"}) without (instance, '
'pod)',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
span=3,
sparkline=SparkLine(),
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
),
],
),
Row(
height=350, panels=[
Graph(
title='Replicas',
dashLength=10,
dashes=False,
id=1,
spaceLength=10,
targets=[
{
'expr': 'max(kube_deployment_status_replicas'
'{deployment=\"$deployment_name\",namespace=\"'
'$deployment_namespace\"}) without (instance, '
'pod)',
'legendFormat': 'current replicas',
'refId': 'A',
'step': 30,
},
{
'expr': 'min(kube_deployment_status_replicas_'
'available{deployment=\"$deployment_name\",'
'namespace=\"$deployment_namespace\"}) without '
'(instance, pod)',
'legendFormat': 'available',
'refId': 'B',
'step': 30,
},
{
'expr': 'max(kube_deployment_status_replicas_'
'unavailable{deployment=\"$deployment_name\",'
'namespace=\"$deployment_namespace\"}) without '
'(instance, pod)',
'legendFormat': 'unavailable',
'refId': 'C',
'step': 30,
},
{
'expr': 'min(kube_deployment_status_replicas_'
'updated{deployment=\"$deployment_name\",'
'namespace=\"$deployment_namespace\"}) without '
'(instance, pod)',
'legendFormat': 'updated',
'refId': 'D',
'step': 30,
},
{
'expr': 'max(kube_deployment_spec_replicas'
'{deployment=\"$deployment_name\",namespace=\"'
'$deployment_namespace\"}) without '
'(instance, pod)',
'legendFormat': 'desired',
'refId': 'E',
'step': 30,
}
],
xAxis=XAxis(mode='time'),
yAxes=YAxes(
YAxis(min=None),
YAxis(format='short', min=None, show=False),
),
),
]
),
],
)

View file

@ -0,0 +1,454 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Kubernetes Capacity Planning',
version=4,
gnetId=22,
graphTooltip=0,
refresh=False,
schemaVersion=14,
time=Time(start='now-1h'),
timezone='browser',
inputs=[
{
'name': 'DS_PROMETHEUS',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus',
}
],
rows=[
Row(
height=250, title='New Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Idle CPU',
id=3,
dataSource='${DS_PROMETHEUS}',
dashLength=10,
dashes=False,
isNew=False,
spaceLength=10,
span=6,
tooltip=Tooltip(msResolution=False),
yAxes=YAxes(
YAxis(format='percent', label='cpu usage',),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sum(rate(node_cpu{mode=\"idle\"}[2m])) '
'* 100',
'hide': False,
'intervalFactor': 10,
'legendFormat': '',
'refId': 'A',
'step': 50,
},
],
),
Graph(
title='System Load',
id=9,
dataSource='${DS_PROMETHEUS}',
dashLength=10,
dashes=False,
isNew=False,
spaceLength=10,
span=6,
tooltip=Tooltip(msResolution=False),
yAxes=YAxes(
YAxis(format='percentunit', min=None),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sum(node_load1)',
'intervalFactor': 4,
'legendFormat': 'load 1m',
'refId': 'A',
'step': 20,
'target': '',
},
{
'expr': 'sum(node_load5)',
'intervalFactor': 4,
'legendFormat': 'load 5m',
'refId': 'B',
'step': 20,
'target': ''
},
{
'expr': 'sum(node_load15)',
'intervalFactor': 4,
'legendFormat': 'load 15m',
'refId': 'C',
'step': 20,
'target': '',
},
],
),
],
),
Row(
height=250, title='New Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Memory Usage',
id=4,
dataSource='${DS_PROMETHEUS}',
dashLength=10,
dashes=False,
isNew=False,
spaceLength=10,
span=9,
stack=True,
seriesOverrides=[
{
'alias': 'node_memory_SwapFree{instance='
'\"172.17.0.1:9100\",job=\"prometheus\"}',
'yaxis': 2,
}
],
tooltip=Tooltip(
msResolution=False, valueType='individual'
),
yAxes=YAxes(
YAxis(format='bytes', min='0'),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sum(node_memory_MemTotal) - sum(node_'
'memory_MemFree) - sum(node_memory_Buffers) - '
'sum(node_memory_Cached)',
'intervalFactor': 2,
'legendFormat': 'memory usage',
'metric': 'memo',
'refId': 'A',
'step': 10,
'target': '',
},
{
'expr': 'sum(node_memory_Buffers)',
'interval': '',
'intervalFactor': 2,
'legendFormat': 'memory buffers',
'metric': 'memo',
'refId': 'B',
'step': 10,
'target': '',
},
{
'expr': 'sum(node_memory_Cached)',
'interval': '',
'intervalFactor': 2,
'legendFormat': 'memory cached',
'metric': 'memo',
'refId': 'C',
'step': 10,
'target': '',
},
{
'expr': 'sum(node_memory_MemFree)',
'interval': '',
'intervalFactor': 2,
'legendFormat': 'memory free',
'metric': 'memo',
'refId': 'D',
'step': 10,
'target': '',
},
],
),
SingleStat(
title='Memory Usage',
dataSource='${DS_PROMETHEUS}',
id=5,
format='percent',
span=3,
gauge=Gauge(show=True),
thresholds='80, 90',
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
targets=[
{
'expr': '((sum(node_memory_MemTotal) - '
'sum(node_memory_MemFree) - sum('
'node_memory_Buffers) - sum(node_memory_Cached)) '
'/ sum(node_memory_MemTotal)) * 100',
'intervalFactor': 2,
'metric': '',
'refId': 'A',
'step': 60,
'target': '',
},
],
),
],
),
Row(
height=246, title='New Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Disk I/O',
dataSource='${DS_PROMETHEUS}',
id=6,
dashLength=10,
dashes=False,
isNew=False,
spaceLength=10,
span=9,
tooltip=Tooltip(msResolution=False),
seriesOverrides=[
{
'alias': 'read',
'yaxis': 1
},
{
'alias': '{instance=\"172.17.0.1:9100\"}',
'yaxis': 2,
},
{
'alias': 'io time',
'yaxis': 2,
},
],
yAxes=YAxes(
YAxis(format='bytes', min=None),
YAxis(format='ms', min=None),
),
targets=[
{
'expr': 'sum(rate(node_disk_bytes_read[5m]))',
'hide': False,
'intervalFactor': 4,
'legendFormat': 'read',
'refId': 'A',
'step': 20,
'target': ''
},
{
'expr': 'sum(rate(node_disk_bytes_written[5m]))',
'intervalFactor': 4,
'legendFormat': 'written',
'refId': 'B',
'step': 20
},
{
'expr': 'sum(rate(node_disk_io_time_ms[5m]))',
'intervalFactor': 4,
'legendFormat': 'io time',
'refId': 'C',
'step': 20
},
],
),
SingleStat(
title='Disk Space Usage',
dataSource='${DS_PROMETHEUS}',
id=12,
span=3,
format='percentunit',
valueName='current',
gauge=Gauge(
maxValue=1,
show=True,
),
thresholds='0.75, 0.9',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
targets=[
{
'expr': '(sum(node_filesystem_size{device!='
'\"rootfs\"}) - sum(node_filesystem_free{'
'device!=\"rootfs\"})) / sum(node_filesystem_size'
'{device!=\"rootfs\"})',
'intervalFactor': 2,
'refId': 'A',
'step': 60,
'target': '',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
),
]
),
Row(
height=250, title='New Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Network Received',
dataSource='${DS_PROMETHEUS}',
id=8,
dashLength=10,
dashes=False,
isNew=False,
spaceLength=10,
span=6,
tooltip=Tooltip(msResolution=False),
seriesOverrides=[
{
'alias': 'transmitted',
'yaxis': 2,
},
],
yAxes=YAxes(
YAxis(format='bytes', min=None),
YAxis(format='bytes', min=None),
),
targets=[
{
'expr': 'sum(rate(node_network_receive_bytes'
'{device!~\"lo\"}[5m]))',
'hide': False,
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 10,
'target': '',
},
],
),
Graph(
title='Network Transmitted',
dataSource='${DS_PROMETHEUS}',
id=10,
dashLength=10,
dashes=False,
isNew=False,
spaceLength=10,
span=6,
tooltip=Tooltip(msResolution=False),
seriesOverrides=[
{
'alias': 'transmitted',
'yaxis': 2,
},
],
yAxes=YAxes(
YAxis(format='bytes', min=None),
YAxis(format='bytes', min=None),
),
targets=[
{
'expr': 'sum(rate(node_network_transmit_bytes'
'{device!~\"lo\"}[5m]))',
'hide': False,
'intervalFactor': 2,
'legendFormat': '',
'refId': 'B',
'step': 10,
'target': '',
},
],
),
],
),
Row(
height=276, title='New Row', showTitle=False,
titleSize='h6',
panels=[
Graph(
title='Cluster Pod Utilization',
dataSource='${DS_PROMETHEUS}',
id=11,
span=9,
dashes=False,
spaceLength=11,
tooltip=Tooltip(
msResolution=False,
valueType='individual',
),
yAxes=YAxes(
YAxis(format='short', min=None),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sum(kube_pod_info)',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': 'Current number of Pods',
'refId': 'A',
'step': 10,
},
{
'expr': 'sum(kube_node_status_capacity_pods)',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': 'Maximum capacity of pods',
'refId': 'B',
'step': 10,
}
],
),
SingleStat(
title='Pod Utilization',
dataSource='${DS_PROMETHEUS}',
id=7,
span=3,
format='percent',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
gauge=Gauge(
show=True,
),
thresholds='80, 90',
valueName='current',
targets=[
{
'expr': '100 - (sum(kube_node_status_capacity_'
'pods) - sum(kube_pod_info)) / sum(kube_node_'
'status_capacity_pods) * 100',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 60,
'target': '',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
),
]
),
],
)

View file

@ -1,733 +0,0 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.4.1"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"hideControls": false,
"id": null,
"links": [],
"rows": [
{
"collapse": false,
"height": 254,
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 1,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(up{job=~\"apiserver|kube-scheduler|kube-controller-manager\"} == 0)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "1,3",
"title": "Control Plane Components Down",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "Everything UP and healthy",
"value": "null"
},
{
"op": "=",
"text": "",
"value": ""
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 2,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(ALERTS{alertstate=\"firing\",alertname!=\"DeadMansSwitch\"})",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "3,5",
"title": "Alerts Firing",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "0",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 3,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(ALERTS{alertstate=\"pending\",alertname!=\"DeadMansSwitch\"})",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "3,5",
"title": "Alerts Pending",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "0",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 4,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "count(increase(kube_pod_container_status_restarts[1h]) > 5)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "1,3",
"title": "Crashlooping Pods",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "0",
"value": "null"
}
],
"valueName": "current"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
},
{
"collapse": false,
"height": 250,
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 5,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(kube_node_status_condition{condition=\"Ready\",status!=\"true\"})",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "1,3",
"title": "Node Not Ready",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 6,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(kube_node_status_condition{condition=\"DiskPressure\",status=\"true\"})",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "1,3",
"title": "Node Disk Pressure",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 7,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(kube_node_status_condition{condition=\"MemoryPressure\",status=\"true\"})",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "1,3",
"title": "Node Memory Pressure",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 8,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(kube_node_spec_unschedulable)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "1,3",
"title": "Nodes Unschedulable",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"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": "Kubernetes Cluster Health",
"version": 9
}

View file

@ -0,0 +1,396 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Kubernetes Cluster Health',
version=9,
graphTooltip=0,
schemaVersion=14,
time=Time(start='now-6h'),
timezone='browser',
inputs=[
{
'name': 'DS_PROMETHEUS',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
rows=[
Row(
height=254, title='Row', showTitle=False,
titleSize='h6', panels=[
SingleStat(
title='Control Plane Components Down',
id=1,
dataSource='${DS_PROMETHEUS}',
gauge=Gauge(),
span=3,
thresholds='1, 3',
colorValue=True,
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'Everything UP and healthy',
'value': 'null',
},
{
'op': '=',
'text': '',
'value': '',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'sum(up{job=~"apiserver|kube-scheduler|'
'kube-controller-manager"} == 0)',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
],
),
SingleStat(
title='Alerts Firing',
id=2,
dataSource='${DS_PROMETHEUS}',
gauge=Gauge(),
colorValue=True,
span=3,
valueName='current',
thresholds='1, 3',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': '0',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'sum(ALERTS{alertstate="firing",'
'alertname!="DeadMansSwitch"})',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
],
),
SingleStat(
title='Alerts Pending',
id=3,
dataSource='${DS_PROMETHEUS}',
gauge=Gauge(),
colorValue=True,
span=3,
valueName='current',
thresholds='3, 5',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': '0',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'sum(ALERTS{alertstate="pending",'
'alertname!="DeadMansSwitch"})',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
],
),
SingleStat(
title='Crashlooping Pods',
id=4,
dataSource='${DS_PROMETHEUS}',
gauge=Gauge(),
colorValue=True,
span=3,
valueName='current',
thresholds='1, 3',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': '0',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'count(increase(kube_pod_container_'
'status_restarts[1h]) > 5)',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
],
),
],
),
Row(
height=250, title='Row', showTitle=False,
titleSize='h6', panels=[
SingleStat(
title='Node Not Ready',
id=5,
dataSource='${DS_PROMETHEUS}',
gauge=Gauge(),
colorValue=True,
span=3,
valueName='current',
thresholds='1, 3',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'sum(kube_node_status_condition{'
'condition="Ready",status!="true"})',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
],
),
SingleStat(
title='Node Disk Pressure',
id=6,
dataSource='${DS_PROMETHEUS}',
gauge=Gauge(),
colorValue=True,
span=3,
valueName='current',
thresholds='1, 3',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'sum(kube_node_status_condition'
'{condition="DiskPressure",status="true"})',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
],
),
SingleStat(
title='Node Memory Pressure',
id=7,
dataSource='${DS_PROMETHEUS}',
gauge=Gauge(),
colorValue=True,
span=3,
valueName='current',
thresholds='1, 3',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'sum(kube_node_status_condition'
'{condition="MemoryPressure",status="true"})',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
],
),
SingleStat(
title='Nodes Unschedulable',
id=8,
dataSource='${DS_PROMETHEUS}',
gauge=Gauge(),
colorValue=True,
span=3,
valueName='current',
thresholds='1, 3',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'sum(kube_node_spec_unschedulable)',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
],
),
],
),
],
)

View file

@ -1,896 +0,0 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.4.1"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"hideControls": false,
"id": null,
"links": [],
"rows": [
{
"collapse": false,
"height": 129,
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 5,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 6,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(up{job=~\"apiserver|kube-scheduler|kube-controller-manager\"} == 0)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "1,3",
"title": "Control Plane UP",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "UP",
"value": "null"
}
],
"valueName": "total"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 6,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 6,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(ALERTS{alertstate=\"firing\",alertname!=\"DeadMansSwitch\"})",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "3,5",
"title": "Alerts Firing",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "0",
"value": "null"
}
],
"valueName": "current"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "Cluster Health",
"titleSize": "h6"
},
{
"collapse": false,
"height": 168,
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 1,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "(sum(up{job=\"apiserver\"} == 1) / count(up{job=\"apiserver\"})) * 100",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "50,80",
"title": "API Servers UP",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 2,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "(sum(up{job=\"kube-controller-manager\"} == 1) / count(up{job=\"kube-controller-manager\"})) * 100",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "50,80",
"title": "Controller Managers UP",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 3,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "(sum(up{job=\"kube-scheduler\"} == 1) / count(up{job=\"kube-scheduler\"})) * 100",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "50,80",
"title": "Schedulers UP",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"hideTimeOverride": false,
"id": 4,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "count(increase(kube_pod_container_status_restarts{namespace=~\"kube-system|tectonic-system\"}[1h]) > 5)",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "1,3",
"title": "Crashlooping Control Plane Pods",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "0",
"value": "null"
}
],
"valueName": "current"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "Control Plane Status",
"titleSize": "h6"
},
{
"collapse": false,
"height": 158,
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 8,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "sum(100 - (avg by (instance) (rate(node_cpu{job=\"node-exporter\",mode=\"idle\"}[5m])) * 100)) / count(node_cpu{job=\"node-exporter\",mode=\"idle\"})",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "80,90",
"title": "CPU Utilization",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 7,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "((sum(node_memory_MemTotal) - sum(node_memory_MemFree) - sum(node_memory_Buffers) - sum(node_memory_Cached)) / sum(node_memory_MemTotal)) * 100",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "80,90",
"title": "Memory Utilization",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 9,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "(sum(node_filesystem_size{device!=\"rootfs\"}) - sum(node_filesystem_free{device!=\"rootfs\"})) / sum(node_filesystem_size{device!=\"rootfs\"})",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "80,90",
"title": "Filesystem Utilization",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 10,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "100 - (sum(kube_node_status_capacity_pods) - sum(kube_pod_info)) / sum(kube_node_status_capacity_pods) * 100",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "80,90",
"title": "Pod Utilization",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "Capacity Planing",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"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": "Kubernetes Cluster Status",
"version": 3
}

View file

@ -0,0 +1,450 @@
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
from _grafanalib import *
dashboard = Dashboard(
title='Kubernetes Cluster Status',
version=3,
time=Time(start='now-6h'),
rows=[
Row(
height=129, title='Cluster Health', showTitle=True,
panels=[
SingleStat(
title='Control Plane UP',
id=5,
gauge=Gauge(show=False),
colorValue=True,
mappingType=1,
thresholds='1, 3',
valueName='total',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'UP',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
targets=[
{
'expr': 'sum(up{job=~"apiserver|kube-scheduler|'
'kube-controller-manager"} == 0)',
'format': 'time_series',
},
]
),
SingleStat(
title='Alerts Firing',
id=6,
gauge=Gauge(show=False),
colorValue=True,
mappingType=1,
thresholds='3, 5',
valueName='current',
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': '0',
'value': 'null',
},
],
targets=[
{
'expr': 'sum(ALERTS{alertstate="firing",'
'alertname!="DeadMansSwitch"})',
'format': 'time_series',
},
]
),
],
),
Row(
height=168, title='Control Plane Status', showTitle=True,
panels=[
SingleStat(
title='API Servers UP',
id=1,
mappingType=1,
format='percent',
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
thresholds='50, 80',
span=3,
valueName='current',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
targets=[
{
'expr': '(sum(up{job="apiserver"} == 1) / '
'count(up{job="apiserver"})) * 100',
'format': 'time_series',
},
]
),
SingleStat(
title='Controller Managers UP',
id=2,
span=3,
mappingType=1,
thresholds='50, 80',
format='percent',
valueName='current',
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
targets=[
{
'expr': '(sum(up{job="kube-controller-manager"} =='
' 1) / count(up{job="kube-controller-manager"})) '
'* 100',
'format': 'time_series',
},
]
),
SingleStat(
title='Schedulers UP',
id=3,
span=3,
mappingType=1,
format='percent',
thresholds='50, 80',
valueName='current',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
targets=[
{
'expr': '(sum(up{job="kube-scheduler"} == 1) / '
'count(up{job="kube-scheduler"})) * 100',
'format': 'time_series',
},
]
),
SingleStat(
title='Crashlooping Control Plane Pods',
id=4,
colorValue=True,
gauge=Gauge(show=False),
span=3,
mappingType=1,
thresholds='1, 3',
valueName='current',
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': '0',
'value': 'null',
},
],
targets=[
{
'expr': 'count(increase(kube_pod_container_'
'status_restarts{namespace=~"kube-system|'
'tectonic-system"}[1h]) > 5)',
'format': 'time_series',
},
]
),
],
),
Row(
height=158, title='Capacity Planning', showTitle=True,
panels=[
SingleStat(
title='CPU Utilization',
id=8,
format='percent',
mappingType=1,
span=3,
thresholds='80, 90',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
targets=[
{
'expr': 'sum(100 - (avg by (instance) (rate('
'node_cpu{job="node-exporter",mode="idle"}[5m])) '
'* 100)) / count(node_cpu{job="node-exporter",'
'mode="idle"})',
'format': 'time_series',
},
]
),
SingleStat(
title='Memory Utilization',
id=7,
format='percent',
span=3,
mappingType=1,
thresholds='80, 90',
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
targets=[
{
'expr': '((sum(node_memory_MemTotal) - sum('
'node_memory_MemFree) - sum(node_memory_Buffers) '
'- sum(node_memory_Cached)) / sum('
'node_memory_MemTotal)) * 100',
'format': 'time_series',
},
]
),
SingleStat(
title='Filesystem Utilization',
id=9,
span=3,
format='percent',
mappingType=1,
thresholds='80, 90',
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
targets=[
{
'expr': '(sum(node_filesystem_size{device!='
'"rootfs"}) - sum(node_filesystem_free{device!='
'"rootfs"})) / sum(node_filesystem_size{device!='
'"rootfs"})',
'format': 'time_series',
},
]
),
SingleStat(
title='Pod Utilization',
id=10,
gauge=Gauge(show=True),
span=3,
mappingType=1,
format='percent',
thresholds='80, 90',
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
targets=[
{
'expr': '100 - (sum(kube_node_status_capacity_pods'
') - sum(kube_pod_info)) / sum(kube_node_status_'
'capacity_pods) * 100',
'format': 'time_series',
},
]
),
],
),
],
)

View file

@ -1,663 +0,0 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.4.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"hideControls": false,
"id": null,
"links": [],
"rows": [
{
"collapse": false,
"height": "250px",
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 1,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "(sum(up{job=\"apiserver\"} == 1) / sum(up{job=\"apiserver\"})) * 100",
"format": "time_series",
"intervalFactor": 2,
"refId": "A",
"step": 600
}
],
"thresholds": "50,80",
"title": "API Servers UP",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 2,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "(sum(up{job=\"kube-controller-manager\"} == 1) / sum(up{job=\"kube-controller-manager\"})) * 100",
"format": "time_series",
"intervalFactor": 2,
"refId": "A",
"step": 600
}
],
"thresholds": "50,80",
"title": "Controller Mangers UP",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 3,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "(sum(up{job=\"kube-scheduler\"} == 1) / sum(up{job=\"kube-scheduler\"})) * 100",
"format": "time_series",
"intervalFactor": 2,
"refId": "A",
"step": 600
}
],
"thresholds": "50,80",
"title": "Schedulers UP",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 4,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "max(sum by(instance) (rate(apiserver_request_count{code=~\"5..\"}[5m])) / sum by(instance) (rate(apiserver_request_count[5m]))) * 100",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 600
}
],
"thresholds": "5,10",
"title": "API Server Request Error Rate",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "0",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
},
{
"collapse": false,
"height": 250,
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"fill": 1,
"id": 7,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum by(verb) (rate(apiserver_latency_seconds:quantile[5m]) >= 0)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 30
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "API Server Request Latency",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
},
{
"collapse": false,
"height": 250,
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"fill": 1,
"id": 5,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "cluster:scheduler_e2e_scheduling_latency_seconds:quantile",
"format": "time_series",
"intervalFactor": 2,
"refId": "A",
"step": 60
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "End to end scheduling latency",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "dtdurations",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"fill": 1,
"id": 6,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum by(instance) (rate(apiserver_request_count{code!~\"2..\"}[5m]))",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "Error Rate",
"refId": "A",
"step": 60
},
{
"expr": "sum by(instance) (rate(apiserver_request_count[5m]))",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "Request Rate",
"refId": "B",
"step": 60
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "API Server Request Rates",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"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": "Kubernetes Control Plane Status",
"version": 3
}

View file

@ -0,0 +1,336 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Kubernetes Control Plane Status',
version=3,
graphTooltip=0,
schemaVersion=14,
time=Time(start='now-6h'),
timezone='browser',
refresh=None,
inputs=[
{
'name': 'DS_PROMETHEUS',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
rows=[
Row(
title='Dashboard Row', showTitle=False, titleSize='h6',
panels=[
SingleStat(
title='API Servers UP',
dataSource='${DS_PROMETHEUS}',
format='percent',
gauge=Gauge(
show=True,
),
id=1,
span=3,
thresholds='50, 80',
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
}
],
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
targets=[
{
'expr': '(sum(up{job=\"apiserver\"} == 1) / '
'sum(up{job=\"apiserver\"})) * 100',
'format': 'time_series',
'intervalFactor': 2,
'refId': 'A',
'step': 600,
},
]
),
SingleStat(
title='Controller Managers UP',
dataSource='${DS_PROMETHEUS}',
format='percent',
gauge=Gauge(
show=True,
),
id=2,
span=3,
thresholds='50, 80',
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
}
],
rangeMaps=([
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
]),
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
targets=[
{
'expr': '(sum(up{job=\"kube-controller-manager\"}'
' == 1) / sum(up{job=\"kube-controller-manager\"'
'})) * 100',
'format': 'time_series',
'intervalFactor': 2,
'refId': 'A',
'step': 600,
}
]
),
SingleStat(
title='Schedulers UP',
dataSource='${DS_PROMETHEUS}',
format='percent',
gauge=Gauge(
show=True,
),
id=3,
span=3,
thresholds='50, 80',
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
}
],
rangeMaps=([
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
]),
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
colors=[
(245, 54, 54, 0.9),
(237, 129, 40, 0.89),
(50, 172, 45, 0.97),
],
targets=[
{
'expr': '(sum(up{job=\"kube-scheduler\"} == 1) '
'/ sum(up{job=\"kube-scheduler\"})) * 100',
'format': 'time_series',
'intervalFactor': 2,
'refId': 'A',
'step': 600,
}
]
),
SingleStat(
title='API Server Request Error Rate',
dataSource='${DS_PROMETHEUS}',
format='percent',
gauge=Gauge(
show=True,
),
id=4,
span=3,
thresholds='5, 10',
valueMaps=[
{
'op': '=',
'text': '0',
'value': 'null',
}
],
rangeMaps=([
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
]),
mappingTypes=[
{
'name': 'value to text',
'value': 1,
},
{
'name': 'range to text',
'value': 2,
}
],
targets=[
{
'expr': 'max(sum by(instance) (rate('
'apiserver_request_count{code=~"5.."}[5m])) / '
'sum by(instance) (rate(apiserver_request_count'
'[5m]))) * 100',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 600,
},
]
),
],
),
Row(
title='Dashboard Row', showTitle=False, titleSize='h6',
panels=[
Graph(
title='API Server Request Latency',
id=7,
dataSource='${DS_PROMETHEUS}',
dashLength=10,
dashes=False,
isNew=False,
lineWidth=1,
nullPointMode='null',
tooltip=Tooltip(
msResolution=False, valueType='individual',
),
spaceLength=10,
yAxes=YAxes(
YAxis(format='short', min=None),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sum by(verb) (rate(apiserver_latency_'
'seconds:quantile[5m]) >= 0)',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 30,
}
],
),
],
),
Row(
title='Dashboard Row', showTitle=False, titleSize='h6',
panels=[
Graph(
title='End to End Scheduling Latency',
id=5,
dataSource='${DS_PROMETHEUS}',
isNew=False,
dashLength=10,
lineWidth=1,
nullPointMode="null",
spaceLength=10,
span=6,
dashes=False,
tooltip=Tooltip(
msResolution=False,
valueType='individual',
),
yAxes=YAxes(
YAxis(format='short', min=None),
YAxis(format='dtdurations', min=None),
),
targets=[
{
'expr': 'cluster:scheduler_e2e_scheduling_'
'latency_seconds:quantile',
'format': 'time_series',
'intervalFactor': 2,
'refId': 'A',
'step': 60,
}
],
),
Graph(
title='API Server Request Rates',
id=6,
dataSource='${DS_PROMETHEUS}',
isNew=False,
dashLength=10,
lineWidth=1,
nullPointMode="null",
spaceLength=10,
span=6,
dashes=False,
tooltip=Tooltip(
msResolution=False,
valueType='individual',
),
yAxes=YAxes(
YAxis(format='short', min=None),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sum by(instance) (rate(apiserver_'
'request_count{code!~\"2..\"}[5m]))',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': 'Error Rate',
'refId': 'A',
'step': 60,
},
{
'expr': 'sum by(instance) (rate(apiserver_'
'request_count[5m]))',
'format': 'time_series',
'intervalFactor': 2,
'legendFormat': 'Request Rate',
'refId': 'B',
'step': 60,
},
],
),
],
),
],
)

View file

@ -1,434 +0,0 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.4.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"description": "",
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"hideControls": false,
"id": null,
"links": [],
"rows": [
{
"collapse": false,
"height": "300",
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"description": "This represents the total [CPU resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu) in the cluster.\nFor comparison the total [allocatable CPU cores](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node-allocatable.md) is also shown.",
"fill": 1,
"id": 1,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 9,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "min(sum(kube_node_status_allocatable_cpu_cores) by (instance))",
"hide": false,
"intervalFactor": 2,
"legendFormat": "Allocatable CPU Cores",
"refId": "A",
"step": 20
},
{
"expr": "max(sum(kube_pod_container_resource_requests_cpu_cores) by (instance))",
"intervalFactor": 2,
"legendFormat": "Requested CPU Cores",
"refId": "B",
"step": 20
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "CPU Cores",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": "CPU Cores",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 2,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "max(sum(kube_pod_container_resource_requests_cpu_cores) by (instance)) / min(sum(kube_node_status_allocatable_cpu_cores) by (instance)) * 100",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 240
}
],
"thresholds": "80, 90",
"title": "CPU Cores",
"type": "singlestat",
"valueFontSize": "110%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "CPU Cores",
"titleSize": "h6"
},
{
"collapse": false,
"height": "300",
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"description": "This represents the total [memory resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory) in the cluster.\nFor comparison the total [allocatable memory](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node-allocatable.md) is also shown.",
"fill": 1,
"id": 3,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 9,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "min(sum(kube_node_status_allocatable_memory_bytes) by (instance))",
"hide": false,
"intervalFactor": 2,
"legendFormat": "Allocatable Memory",
"refId": "A",
"step": 20
},
{
"expr": "max(sum(kube_pod_container_resource_requests_memory_bytes) by (instance))",
"intervalFactor": 2,
"legendFormat": "Requested Memory",
"refId": "B",
"step": 20
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Memory",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": "Memory",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"decimals": null,
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 4,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "max(sum(kube_pod_container_resource_requests_memory_bytes) by (instance)) / min(sum(kube_node_status_allocatable_memory_bytes) by (instance)) * 100",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A",
"step": 240
}
],
"thresholds": "80, 90",
"title": "Memory",
"type": "singlestat",
"valueFontSize": "110%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Memory",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-3h",
"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": "browser",
"title": "Kubernetes Resource Requests",
"version": 2
}

View file

@ -0,0 +1,200 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Kubernetes Resource Requests',
version=2,
graphTooltip=0,
refresh=False,
schemaVersion=14,
time=Time(start='now-3h'),
timezone='browser',
inputs=[
{
'name': 'DS_PROMETHEUS',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
rows=[
Row(
height=300, title='CPU Cores', showTitle=False,
titleSize='h6', panels=[
Graph(
title='CPU Cores',
description='This represents the total [CPU resource '
'requests](https://kubernetes.io/docs/concepts/configu'
'ration/manage-compute-resources-container/#meaning-of-'
'cpu) in the cluster.\nFor comparison the total '
'[allocatable CPU cores](https://github.com/kubernetes/'
'community/blob/master/contributors/design-proposals/'
'node-allocatable.md) is also shown.',
id=1,
dataSource='${DS_PROMETHEUS}',
dashLength=10,
dashes=False,
isNew=False,
lineWidth=1,
spaceLength=10,
nullPointMode='null',
span=9,
tooltip=Tooltip(
msResolution=False, valueType='individual'
),
yAxes=YAxes(
YAxis(format='short', label='CPU Cores', min=None,),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'min(sum(kube_node_status_allocatable_'
'cpu_cores) by (instance))',
'hide': False,
'intervalFactor': 2,
'legendFormat': 'Allocatable CPU Cores',
'refId': 'A',
'step': 20,
},
{
'expr': 'max(sum(kube_pod_container_resource_'
'requests_cpu_cores) by (instance))',
'hide': False,
'intervalFactor': 2,
'legendFormat': 'Requested CPU Cores',
'refId': 'B',
'step': 20,
},
],
),
SingleStat(
title='CPU Cores',
dataSource='${DS_PROMETHEUS}',
id=2,
format='percent',
span=3,
gauge=Gauge(show=True),
sparkline=SparkLine(show=True),
valueFontSize='110%',
thresholds='80, 90',
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
targets=[
{
'expr': 'max(sum(kube_pod_container_resource_'
'requests_cpu_cores) by (instance)) / min(sum'
'(kube_node_status_allocatable_cpu_cores) by '
'(instance)) * 100',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 240,
},
],
),
],
),
Row(
height=300, title='Memory', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Memory',
id=3,
dataSource='${DS_PROMETHEUS}',
description='This represents the total [memory resource '
'requests](https://kubernetes.io/docs/concepts/'
'configuration/manage-compute-resources-container/'
'#meaning-of-memory) in the cluster.\nFor comparison '
'the total [allocatable memory](https://github.com/'
'kubernetes/community/blob/master/contributors/'
'design-proposals/node-allocatable.md) is also shown.',
dashLength=10,
dashes=False,
lineWidth=1,
isNew=False,
spaceLength=10,
span=9,
nullPointMode='null',
tooltip=Tooltip(
msResolution=False, valueType='individual'
),
yAxes=YAxes(
YAxis(format='bytes', label='Memory', min=None),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'min(sum(kube_node_status_allocatable_'
'memory_bytes) by (instance))',
'hide': False,
'intervalFactor': 2,
'legendFormat': 'Allocatable Memory',
'refId': 'A',
'step': 20,
},
{
'expr': 'max(sum(kube_pod_container_resource_'
'requests_memory_bytes) by (instance))',
'hide': False,
'intervalFactor': 2,
'legendFormat': 'Requested Memory',
'refId': 'B',
'step': 20,
},
],
),
SingleStat(
title='Memory',
dataSource='${DS_PROMETHEUS}',
id=4,
format='percent',
span=3,
gauge=Gauge(show=True),
sparkline=SparkLine(show=True),
valueFontSize='110%',
thresholds='80, 90',
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
targets=[
{
'expr': 'max(sum(kube_pod_container_resource_'
'requests_memory_bytes) by (instance)) / '
'min(sum(kube_node_status_allocatable_memory_'
'bytes) by (instance)) * 100',
'intervalFactor': 2,
'legendFormat': '',
'refId': 'A',
'step': 240,
},
],
),
],
),
],
)

View file

@ -1,892 +0,0 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.4.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": ""
}
],
"annotations": {
"list": []
},
"description": "Dashboard to get an overview of one server",
"editable": true,
"gnetId": 22,
"graphTooltip": 0,
"hideControls": false,
"id": null,
"links": [],
"refresh": false,
"rows": [
{
"collapse": false,
"height": "250px",
"panels": [
{
"alerting": {},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 3,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "100 - (avg by (cpu) (irate(node_cpu{mode=\"idle\", instance=\"$server\"}[5m])) * 100)",
"hide": false,
"intervalFactor": 10,
"legendFormat": "{{cpu}}",
"refId": "A",
"step": 50
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Idle cpu",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "percent",
"label": "cpu usage",
"logBase": 1,
"max": 100,
"min": 0,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"alerting": {},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 9,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "node_load1{instance=\"$server\"}",
"intervalFactor": 4,
"legendFormat": "load 1m",
"refId": "A",
"step": 20,
"target": ""
},
{
"expr": "node_load5{instance=\"$server\"}",
"intervalFactor": 4,
"legendFormat": "load 5m",
"refId": "B",
"step": 20,
"target": ""
},
{
"expr": "node_load15{instance=\"$server\"}",
"intervalFactor": 4,
"legendFormat": "load 15m",
"refId": "C",
"step": 20,
"target": ""
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "System load",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "percentunit",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
},
{
"collapse": false,
"height": "250px",
"panels": [
{
"alerting": {},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 4,
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"hideEmpty": false,
"hideZero": false,
"max": false,
"min": false,
"rightSide": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "node_memory_SwapFree{instance=\"172.17.0.1:9100\",job=\"prometheus\"}",
"yaxis": 2
}
],
"spaceLength": 10,
"span": 9,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "node_memory_MemTotal{instance=\"$server\"} - node_memory_MemFree{instance=\"$server\"} - node_memory_Buffers{instance=\"$server\"} - node_memory_Cached{instance=\"$server\"}",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "memory used",
"metric": "",
"refId": "C",
"step": 10
},
{
"expr": "node_memory_Buffers{instance=\"$server\"}",
"interval": "",
"intervalFactor": 2,
"legendFormat": "memory buffers",
"metric": "",
"refId": "E",
"step": 10
},
{
"expr": "node_memory_Cached{instance=\"$server\"}",
"intervalFactor": 2,
"legendFormat": "memory cached",
"metric": "",
"refId": "F",
"step": 10
},
{
"expr": "node_memory_MemFree{instance=\"$server\"}",
"intervalFactor": 2,
"legendFormat": "memory free",
"metric": "",
"refId": "D",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Memory usage",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 5,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "((node_memory_MemTotal{instance=\"$server\"} - node_memory_MemFree{instance=\"$server\"} - node_memory_Buffers{instance=\"$server\"} - node_memory_Cached{instance=\"$server\"}) / node_memory_MemTotal{instance=\"$server\"}) * 100",
"intervalFactor": 2,
"refId": "A",
"step": 60,
"target": ""
}
],
"thresholds": "80, 90",
"title": "Memory usage",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
},
{
"collapse": false,
"height": "250px",
"panels": [
{
"alerting": {},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 6,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "read",
"yaxis": 1
},
{
"alias": "{instance=\"172.17.0.1:9100\"}",
"yaxis": 2
},
{
"alias": "io time",
"yaxis": 2
}
],
"spaceLength": 10,
"span": 9,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum by (instance) (rate(node_disk_bytes_read{instance=\"$server\"}[2m]))",
"hide": false,
"intervalFactor": 4,
"legendFormat": "read",
"refId": "A",
"step": 20,
"target": ""
},
{
"expr": "sum by (instance) (rate(node_disk_bytes_written{instance=\"$server\"}[2m]))",
"intervalFactor": 4,
"legendFormat": "written",
"refId": "B",
"step": 20
},
{
"expr": "sum by (instance) (rate(node_disk_io_time_ms{instance=\"$server\"}[2m]))",
"intervalFactor": 4,
"legendFormat": "io time",
"refId": "C",
"step": 20
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Disk I/O",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "ms",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"format": "percentunit",
"gauge": {
"maxValue": 1,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 7,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "(sum(node_filesystem_size{device!=\"rootfs\",instance=\"$server\"}) - sum(node_filesystem_free{device!=\"rootfs\",instance=\"$server\"})) / sum(node_filesystem_size{device!=\"rootfs\",instance=\"$server\"})",
"intervalFactor": 2,
"refId": "A",
"step": 60,
"target": ""
}
],
"thresholds": "0.75, 0.9",
"title": "Disk space usage",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
},
{
"collapse": false,
"height": "250px",
"panels": [
{
"alerting": {},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 8,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "transmitted ",
"yaxis": 2
}
],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(node_network_receive_bytes{instance=\"$server\",device!~\"lo\"}[5m])",
"hide": false,
"intervalFactor": 2,
"legendFormat": "{{device}}",
"refId": "A",
"step": 10,
"target": ""
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Network received",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"alerting": {},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 10,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "transmitted ",
"yaxis": 2
}
],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(node_network_transmit_bytes{instance=\"$server\",device!~\"lo\"}[5m])",
"hide": false,
"intervalFactor": 2,
"legendFormat": "{{device}}",
"refId": "B",
"step": 10,
"target": ""
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Network transmitted",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "server",
"options": [],
"query": "label_values(node_boot_time, instance)",
"refresh": 1,
"regex": "",
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-1h",
"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": "browser",
"title": "Nodes",
"version": 2
}

View file

@ -0,0 +1,414 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Nodes',
version=2,
description='Dashboard to get an overview of one server',
gnetId=22,
graphTooltip=0,
refresh=False,
schemaVersion=14,
time=Time(start='now-1h'),
timezone='browser',
inputs=[
{
'name': 'DS_PROMETHEUS',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
templating=Templating(list=[
{
'allValue': None,
'current': {},
'datasource': '${DS_PROMETHEUS}',
'hide': 0,
'includeAll': False,
'label': None,
'multi': False,
'name': 'server',
'options': [],
'query': 'label_values(node_boot_time, instance)',
'refresh': 1,
'regex': '',
'sort': 0,
'tagValuesQuery': '',
'tags': [],
'tagsQuery': '',
'type': 'query',
'useTags': False,
},
]),
rows=[
Row(
height=250, title='New Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Idle CPU',
dataSource='${DS_PROMETHEUS}',
id=3,
isNew=False,
spaceLength=10,
span=6,
dashLength=10,
dashes=False,
tooltip=Tooltip(msResolution=False),
yAxes=YAxes(
YAxis(
format='percent',
label='cpu usage',
max=100,
),
YAxis(format='short', min=None),
),
targets=[
{
'expr': '100 - (avg by (cpu) (irate(node_cpu'
'{mode=\"idle\", instance=\"$server\"}[5m])) '
'* 100)',
'hide': False,
'intervalFactor': 10,
'legendFormat': '{{cpu}}',
'refId': 'A',
'step': 50,
}
],
),
Graph(
title='System Load',
dataSource='${DS_PROMETHEUS}',
id=9,
isNew=False,
spaceLength=10,
span=6,
dashLength=10,
dashes=False,
tooltip=Tooltip(msResolution=False),
yAxes=YAxes(
YAxis(format='percentunit', min=None,),
YAxis(format='short', min=None,),
),
targets=[
{
'expr': 'node_load1{instance=\"$server\"}',
'intervalFactor': 4,
'legendFormat': 'load 1m',
'refId': 'A',
'step': 20,
'target': '',
},
{
'expr': 'node_load5{instance=\"$server\"}',
'intervalFactor': 4,
'legendFormat': 'load 5m',
'refId': 'B',
'step': 20,
'target': '',
},
{
'expr': 'node_load15{instance=\"$server\"}',
'intervalFactor': 4,
'legendFormat': 'load 15m',
'refId': 'C',
'step': 20,
'target': '',
},
],
),
],
),
Row(
height=250, title='New Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Memory Usage',
dataSource='${DS_PROMETHEUS}',
id=4,
isNew=False,
spaceLength=10,
span=9,
stack=True,
dashLength=10,
dashes=False,
tooltip=Tooltip(
msResolution=False, valueType='individual',
),
seriesOverrides=[
{
'alias': 'node_memory_SwapFree{instance='
'\"172.17.0.1:9100\",job=\"prometheus\"}',
'yaxis': 2,
},
],
yAxes=YAxes(
YAxis(format='bytes', min='0',),
YAxis(format='short', min=None,),
),
targets=[
{
'expr': 'node_memory_MemTotal{instance='
'\"$server\"} - node_memory_MemFree{instance='
'\"$server\"} - node_memory_Buffers{instance='
'\"$server\"} - node_memory_Cached{instance='
'\"$server\"}',
'hide': False,
'interval': '',
'intervalFactor': 2,
'legendFormat': 'memory used',
'metric': '',
'refId': 'C',
'step': 10,
},
{
'expr': 'node_memory_Buffers{instance='
'\"$server\"}',
'interval': '',
'intervalFactor': 2,
'legendFormat': 'memory buffers',
'metric': '',
'refId': 'E',
'step': 10,
},
{
'expr': 'node_memory_Cached{instance=\"$server\"}',
'intervalFactor': 2,
'legendFormat': 'memory cached',
'metric': '',
'refId': 'F',
'step': 10,
},
{
'expr': 'node_memory_MemFree{instance='
'\"$server\"}',
'intervalFactor': 2,
'legendFormat': 'memory free',
'metric': '',
'refId': 'D',
'step': 10,
},
],
),
SingleStat(
title='Memory Usage',
dataSource='${DS_PROMETHEUS}',
id=5,
format='percent',
gauge=Gauge(show=True),
span=3,
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
}
],
thresholds='80, 90',
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
},
],
targets=[
{
'expr': '((node_memory_MemTotal{instance='
'\"$server\"} - node_memory_MemFree{instance='
'\"$server\"} - node_memory_Buffers{instance='
'\"$server\"} - node_memory_Cached{instance='
'\"$server\"}) / node_memory_MemTotal{instance='
'\"$server\"}) * 100',
'intervalFactor': 2,
'refId': 'A',
'step': 60,
'target': '',
},
],
),
],
),
Row(
height=250, titleSize='h6', title='New Row',
showTitle=False, panels=[
Graph(
title='Disk I/O',
dataSource='${DS_PROMETHEUS}',
id=6,
dashLength=10,
dashes=False,
spaceLength=10,
span=9,
tooltip=Tooltip(msResolution=False),
yAxes=YAxes(
YAxis(
format='bytes',
min=None,
),
YAxis(
format='ms',
min=None,
),
),
seriesOverrides=[
{
'alias': 'read',
'yaxis': 1,
},
{
'alias': '{instance=\"172.17.0.1:9100\"}',
'yaxis': 2,
},
{
'alias': 'io time',
'yaxis': 2,
},
],
targets=[
{
'expr': 'sum by (instance) (rate(node_disk_'
'bytes_read{instance=\"$server\"}[2m]))',
'hide': False,
'intervalFactor': 4,
'legendFormat': 'read',
'refId': 'A',
'step': 20,
'target': '',
},
{
'expr': 'sum by (instance) (rate(node_disk_'
'bytes_written{instance=\"$server\"}[2m]))',
'intervalFactor': 4,
'legendFormat': 'written',
'refId': 'B',
'step': 20
},
{
'expr': 'sum by (instance) (rate(node_disk_io_'
'time_ms{instance=\"$server\"}[2m]))',
'intervalFactor': 4,
'legendFormat': 'io time',
'refId': 'C',
'step': 20,
},
],
),
SingleStat(
title='Disk Space Usage',
dataSource='${DS_PROMETHEUS}',
id=7,
thresholds='0.75, 0.9',
valueName='current',
format='percentunit',
span=3,
gauge=Gauge(
maxValue=1,
show=True,
),
rangeMaps=[
{
'from': 'null',
'text': 'N/A',
'to': 'null',
},
],
valueMaps=[
{
'op': '=',
'text': 'N/A',
'value': 'null',
}
],
targets=[
{
'expr': '(sum(node_filesystem_size{device!='
'\"rootfs\",instance=\"$server\"}) - '
'sum(node_filesystem_free{device!=\"rootfs\",'
'instance=\"$server\"})) / sum(node_filesystem_'
'size{device!=\"rootfs\",instance=\"$server\"})',
'intervalFactor': 2,
'refId': 'A',
'step': 60,
'target': '',
},
],
),
],
),
Row(
height=250, title='New Row', titleSize='h6',
showTitle=False,
panels=[
Graph(
title='Network Received',
dataSource='${DS_PROMETHEUS}',
id=8,
dashLength=10,
dashes=False,
isNew=False,
spaceLength=10,
span=6,
tooltip=Tooltip(msResolution=False),
yAxes=YAxes(
YAxis(format='bytes', min=None),
YAxis(format='bytes', min=None),
),
seriesOverrides=[
{
'alias': 'transmitted',
'yaxis': 2,
},
],
targets=[
{
'expr': 'rate(node_network_receive_bytes{'
'instance=\"$server\",device!~\"lo\"}[5m])',
'hide': False,
'intervalFactor': 2,
'legendFormat': '{{device}}',
'refId': 'A',
'step': 10,
'target': ''
}
],
),
Graph(
title='Network Transmitted',
dataSource='${DS_PROMETHEUS}',
id=10,
dashLength=10,
dashes=False,
isNew=False,
spaceLength=10,
span=6,
tooltip=Tooltip(msResolution=False),
yAxes=YAxes(
YAxis(format='bytes', min=None),
YAxis(format='bytes', min=None),
),
seriesOverrides=[
{
'alias': 'transmitted',
'yaxis': 2,
},
],
targets=[
{
'expr': 'rate(node_network_transmit_bytes'
'{instance=\"$server\",device!~\"lo\"}[5m])',
'hide': False,
'intervalFactor': 2,
'legendFormat': '{{device}}',
'refId': 'B',
'step': 10,
'target': '',
},
],
),
],
),
],
)

View file

@ -1,432 +0,0 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "4.4.1"
},
{
"type": "panel",
"id": "graph",
"name": "Graph",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
}
],
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 1,
"hideControls": false,
"id": null,
"links": [],
"rows": [
{
"collapse": false,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 1,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum by(container_name) (container_memory_usage_bytes{pod_name=\"$pod\", container_name=~\"$container\", container_name!=\"POD\"})",
"interval": "10s",
"intervalFactor": 1,
"legendFormat": "Current: {{ container_name }}",
"metric": "container_memory_usage_bytes",
"refId": "A",
"step": 15
},
{
"expr": "kube_pod_container_resource_requests_memory_bytes{pod=\"$pod\", container=~\"$container\"}",
"interval": "10s",
"intervalFactor": 2,
"legendFormat": "Requested: {{ container }}",
"metric": "kube_pod_container_resource_requests_memory_bytes",
"refId": "B",
"step": 20
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Memory Usage",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Row",
"titleSize": "h6"
},
{
"collapse": false,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 2,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum by (container_name)( rate(container_cpu_usage_seconds_total{image!=\"\",container_name!=\"POD\",pod_name=\"$pod\"}[1m] ) )",
"intervalFactor": 2,
"legendFormat": "{{ container_name }}",
"refId": "A",
"step": 30
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "CPU Usage",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
},
{
"collapse": false,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_PROMETHEUS}",
"editable": true,
"error": false,
"fill": 1,
"grid": {},
"id": 3,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sort_desc(sum by (pod_name) (rate (container_network_receive_bytes_total{pod_name=\"$pod\"}[1m]) ))",
"intervalFactor": 2,
"legendFormat": "{{ pod_name }}",
"refId": "A",
"step": 30
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Network I/O",
"tooltip": {
"msResolution": true,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "New row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"hide": 0,
"includeAll": true,
"label": "Namespace",
"multi": false,
"name": "namespace",
"options": [],
"query": "label_values(kube_pod_info, namespace)",
"refresh": 1,
"regex": "",
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"hide": 0,
"includeAll": false,
"label": "Pod",
"multi": false,
"name": "pod",
"options": [],
"query": "label_values(kube_pod_info{namespace=~\"$namespace\"}, pod)",
"refresh": 1,
"regex": "",
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": ".*",
"current": {},
"datasource": "${DS_PROMETHEUS}",
"hide": 0,
"includeAll": true,
"label": "Container",
"multi": false,
"name": "container",
"options": [],
"query": "label_values(kube_pod_container_info{namespace=\"$namespace\", pod=\"$pod\"}, container)",
"refresh": 1,
"regex": "",
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-6h",
"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": "browser",
"title": "Pods",
"version": 1
}

View file

@ -0,0 +1,215 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Pods',
version=1,
graphTooltip=1,
refresh=False,
schemaVersion=14,
time=Time(start='now-6h'),
timezone='browser',
inputs=[
{
'name': 'DS_PROMETHEUS',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
templating=Templating(list=[
{
'allValue': '.*',
'current': {},
'datasource': '${DS_PROMETHEUS}',
'hide': 0,
'includeAll': True,
'label': 'Namespace',
'multi': False,
'name': 'namespace',
'options': [],
'query': 'label_values(kube_pod_info, namespace)',
'refresh': 1,
'regex': '',
'sort': 0,
'tagValuesQuery': '',
'tags': [],
'tagsQuery': '',
'type': 'query',
'useTags': False,
},
{
'allValue': None,
'current': {},
'datasource': '${DS_PROMETHEUS}',
'hide': 0,
'includeAll': False,
'label': 'Pod',
'multi': False,
'name': 'pod',
'options': [],
'query': 'label_values(kube_pod_info{namespace=~"$namespace"}, '
'pod)',
'refresh': 1,
'regex': '',
'sort': 0,
'tagValuesQuery': '',
'tags': [],
'tagsQuery': '',
'type': 'query',
'useTags': False,
},
{
'allValue': '.*',
'current': {},
'datasource': '${DS_PROMETHEUS}',
'hide': 0,
'includeAll': True,
'label': 'Container',
'multi': False,
'name': 'container',
'options': [],
'query': 'label_values(kube_pod_container_info{namespace='
'"$namespace", pod="$pod"}, container)',
'refresh': 1,
'regex': '',
'sort': 0,
'tagValuesQuery': '',
'tags': [],
'tagsQuery': '',
'type': 'query',
'useTags': False,
},
]),
rows=[
Row(
height=250, title='Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Memory Usage',
dataSource='${DS_PROMETHEUS}',
id=1,
isNew=False,
spaceLength=10,
span=12,
dashLength=10,
dashes=False,
tooltip=Tooltip(msResolution=True, valueType='cumulative'),
legend=Legend(
alignAsTable=True, avg=True, current=True,
rightSide=True, total=False, values=True,
),
yAxes=YAxes(
YAxis(
format='bytes', min=None,
),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sum by(container_name) (container_'
'memory_usage_bytes{pod_name="$pod", '
'container_name=~"$container", '
'container_name!="POD"})',
'interval': '10s',
'intervalFactor': 1,
'legendFormat': 'Current: {{ container_name }}',
'metric': 'container_memory_usage_bytes',
'refId': 'A',
'step': 15,
},
{
'expr': 'kube_pod_container_resource_requests_'
'memory_bytes{pod="$pod", container=~'
'"$container"}',
'interval': '10s',
'intervalFactor': 2,
'legendFormat': 'Requested: {{ container }}',
'metric': 'kube_pod_container_resource_'
'requests_memory_bytes',
'refId': 'B',
'step': 20,
},
],
),
],
),
Row(
height=250, title='Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='CPU Usage',
dataSource='${DS_PROMETHEUS}',
id=2,
isNew=False,
spaceLength=10,
span=12,
dashLength=10,
dashes=False,
legend=Legend(
alignAsTable=True, avg=True, current=True,
rightSide=True, total=False, values=True,
),
tooltip=Tooltip(msResolution=True, valueType='cumulative'),
yAxes=YAxes(
YAxis(
format='short', min=None,
),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sum by (container_name)('
'rate(container_cpu_usage_seconds_total'
'{image!="",container_name!="POD",pod_name='
'"$pod"}[1m]))',
'intervalFactor': 2,
'legendFormat': '{{ container_name }}',
'refId': 'A',
'step': 30
},
],
),
],
),
Row(
height=250, title='New Row', showTitle=False,
titleSize='h6', panels=[
Graph(
title='Network I/O',
dataSource='${DS_PROMETHEUS}',
id=3,
isNew=False,
spaceLength=10,
span=12,
dashLength=10,
dashes=False,
legend=Legend(
alignAsTable=True, avg=True, current=True,
rightSide=True, total=False, values=True,
),
tooltip=Tooltip(msResolution=True, valueType='cumulative'),
yAxes=YAxes(
YAxis(
format='bytes', min=None,
),
YAxis(format='short', min=None),
),
targets=[
{
'expr': 'sort_desc(sum by (pod_name) (rate'
'(container_network_receive_bytes_total{'
'pod_name="$pod"}[1m])))',
'intervalFactor': 2,
'legendFormat': '{{ pod_name }}',
'refId': 'A',
'step': 30
},
],
),
],
),
],
)

View file

@ -226,7 +226,7 @@ bin-pack-files() {
# the max size of the queue is limited by DATA_SIZE_LIMIT
# while there's room available in the queue we add files.
# when there's no room we create a configmap with the members of the queue
# before adding the file to a cleaned queue
# before adding the file to a cleaned queue
# Counters initialization is not in the scope of this function
local file=""
@ -313,7 +313,7 @@ touch $GRAFANA_OUTPUT_FILE || { echo "ERROR: Unable to create or modify $GRAFANA
echo "# Starting execution of $SCRIPT_BASE on $DATE_EXEC"
echo "# Configured size limit: $DATA_SIZE_LIMIT bytes"
echo "# Grafna input dashboards and datasources will be read from: $DASHBOARDS_DIR"
echo "# Grafana input dashboards and datasources will be read from: $DASHBOARDS_DIR"
echo "# Grafana Dashboards ConfigMap will be created into file:"
echo "$OUTPUT_FILE"
echo "# Grafana Deployment manifest will be created into file:"

View file

@ -1,13 +1,23 @@
#!/bin/bash
set -e
cat <<-EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboards
name: grafana-dashboards-0
data:
EOF
virtualenv -p python3 .env
source .env/bin/activate
pip install -Ur requirements.txt
for f in assets/grafana/*.dashboard.py
do
JSON_FILENAME="$(pwd)/${f%%.*}-dashboard.json"
generate-dashboard $f -o $JSON_FILENAME 2>&1 > /dev/null
done
for f in assets/grafana/*-dashboard.json
do
echo " $(basename $f): |+"

View file

@ -1,10 +1,11 @@
#!/bin/bash
set -e
# Generate Alert Rules ConfigMap
hack/scripts/generate-rules-configmap.sh > manifests/prometheus/prometheus-k8s-rules.yaml
# Generate Dashboard ConfigMap
#hack/scripts/generate-dashboards-configmap.sh > manifests/grafana/grafana-dashboards.yaml
hack/scripts/generate-dashboards-configmap.sh > manifests/grafana/grafana-dashboards.yaml
# Generate Dashboard ConfigMap with configmap-generator tool
# Max Size per ConfigMap: 240000

View file

@ -0,0 +1 @@
git+https://github.com/aknuds1/grafanalib.git@v0.4.0