Remove old python script to generate Grafana dashboards

This commit is contained in:
Frederic Branczyk
2018-05-28 16:54:06 +02:00
parent 25a3ae65b2
commit 309974fadb
14 changed files with 0 additions and 4712 deletions

View File

@@ -1,91 +0,0 @@
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': 'prometheus',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
], rows=rows, graphTooltip=graphTooltip, editable=False, **optional_args,
)
def Row(
panels, height=None, title='Dashboard Row', showTitle=False
):
assert isinstance(height, (type(None), int))
return core.Row(
panels=panels, height=height, title=title, showTitle=showTitle,
titleSize='h6', editable=False,
)
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='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, editable=False,
)
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='prometheus', nullPointMode=nullPointMode, editable=False,
)
def YAxis(format='none', label='', min=0, show=True):
return core.YAxis(
format=format, label=label, min=min, show=show
)

View File

@@ -1,467 +0,0 @@
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': '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': '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

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

View File

@@ -1,465 +0,0 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Kubernetes Capacity Planning',
version=4,
gnetId=22,
graphTooltip=0,
refresh=False,
editable=False,
schemaVersion=14,
time=Time(start='now-1h'),
timezone='browser',
inputs=[
{
'name': 'prometheus',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus',
}
],
rows=[
Row(
height=250, title='New Row', showTitle=False, editable=False,
titleSize='h6', panels=[
Graph(
title='Idle CPU',
id=3,
dataSource='prometheus',
dashLength=10,
dashes=False,
isNew=False,
editable=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='prometheus',
dashLength=10,
dashes=False,
isNew=False,
editable=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, editable=False,
titleSize='h6', panels=[
Graph(
title='Memory Usage',
id=4,
dataSource='prometheus',
dashLength=10,
dashes=False,
isNew=False,
editable=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='prometheus',
id=5,
format='percent',
span=3,
gauge=Gauge(show=True),
editable=False,
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, editable=False,
titleSize='h6', panels=[
Graph(
title='Disk I/O',
dataSource='prometheus',
id=6,
dashLength=10,
dashes=False,
isNew=False,
editable=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='prometheus',
id=12,
span=3,
editable=False,
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, editable=False,
titleSize='h6', panels=[
Graph(
title='Network Received',
dataSource='prometheus',
id=8,
dashLength=10,
dashes=False,
isNew=False,
editable=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='prometheus',
id=10,
dashLength=10,
dashes=False,
isNew=False,
editable=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, editable=False,
titleSize='h6',
panels=[
Graph(
title='Cluster Pod Utilization',
dataSource='prometheus',
id=11,
span=9,
dashes=False,
editable=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='prometheus',
id=7,
editable=False,
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,405 +0,0 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Kubernetes Cluster Health',
version=9,
graphTooltip=0,
schemaVersion=14,
editable=False,
time=Time(start='now-6h'),
timezone='browser',
inputs=[
{
'name': 'prometheus',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
rows=[
Row(
height=254, title='Row', showTitle=False, editable=False,
titleSize='h6', panels=[
SingleStat(
title='Control Plane Components Down',
id=1,
dataSource='prometheus',
gauge=Gauge(),
span=3,
thresholds='1, 3',
colorValue=True,
editable=False,
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='prometheus',
gauge=Gauge(),
colorValue=True,
editable=False,
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='prometheus',
gauge=Gauge(),
colorValue=True,
editable=False,
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='prometheus',
gauge=Gauge(),
colorValue=True,
editable=False,
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, editable=False,
titleSize='h6', panels=[
SingleStat(
title='Node Not Ready',
id=5,
dataSource='prometheus',
gauge=Gauge(),
colorValue=True,
editable=False,
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='prometheus',
gauge=Gauge(),
colorValue=True,
editable=False,
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='prometheus',
gauge=Gauge(),
colorValue=True,
editable=False,
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='prometheus',
gauge=Gauge(),
colorValue=True,
editable=False,
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,450 +0,0 @@
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,344 +0,0 @@
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,
editable=False,
inputs=[
{
'name': 'prometheus',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
rows=[
Row(
title='Dashboard Row', showTitle=False, titleSize='h6', editable=False,
panels=[
SingleStat(
title='API Servers UP',
dataSource='prometheus',
format='percent',
editable=False,
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='prometheus',
format='percent',
editable=False,
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='prometheus',
format='percent',
editable=False,
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='prometheus',
format='percent',
editable=False,
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', editable=False,
panels=[
Graph(
title='API Server Request Latency',
id=7,
dataSource='prometheus',
dashLength=10,
dashes=False,
isNew=False,
editable=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', editable=False,
panels=[
Graph(
title='End to End Scheduling Latency',
id=5,
dataSource='prometheus',
isNew=False,
editable=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='prometheus',
isNew=False,
editable=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,205 +0,0 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Kubernetes Resource Requests',
version=2,
graphTooltip=0,
refresh=False,
editable=False,
schemaVersion=14,
time=Time(start='now-3h'),
timezone='browser',
inputs=[
{
'name': 'prometheus',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
rows=[
Row(
height=300, title='CPU Cores', showTitle=False, editable=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='prometheus',
dashLength=10,
dashes=False,
isNew=False,
editable=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='prometheus',
id=2,
format='percent',
editable=False,
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, editable=False,
titleSize='h6', panels=[
Graph(
title='Memory',
id=3,
dataSource='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,
editable=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='prometheus',
id=4,
format='percent',
span=3,
gauge=Gauge(show=True),
sparkline=SparkLine(show=True),
editable=False,
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,423 +0,0 @@
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,
editable=False,
schemaVersion=14,
time=Time(start='now-1h'),
timezone='browser',
inputs=[
{
'name': 'prometheus',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
templating=Templating(list=[
{
'allValue': None,
'current': {},
'datasource': '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, editable=False,
titleSize='h6', panels=[
Graph(
title='Idle CPU',
dataSource='prometheus',
id=3,
isNew=False,
editable=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='prometheus',
id=9,
isNew=False,
editable=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, editable=False,
titleSize='h6', panels=[
Graph(
title='Memory Usage',
dataSource='prometheus',
id=4,
isNew=False,
editable=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='prometheus',
id=5,
format='percent',
gauge=Gauge(show=True),
editable=False,
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', editable=False,
showTitle=False, panels=[
Graph(
title='Disk I/O',
dataSource='prometheus',
id=6,
dashLength=10,
dashes=False,
editable=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='prometheus',
id=7,
thresholds='0.75, 0.9',
editable=False,
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, editable=False,
panels=[
Graph(
title='Network Received',
dataSource='prometheus',
id=8,
dashLength=10,
dashes=False,
isNew=False,
editable=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='prometheus',
id=10,
dashLength=10,
dashes=False,
isNew=False,
editable=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,255 +0,0 @@
from grafanalib.core import *
dashboard = Dashboard(
title='Pods',
version=1,
graphTooltip=1,
refresh=False,
editable=False,
schemaVersion=14,
time=Time(start='now-6h'),
timezone='browser',
inputs=[
{
'name': 'prometheus',
'label': 'prometheus',
'description': '',
'type': 'datasource',
'pluginId': 'prometheus',
'pluginName': 'Prometheus'
},
],
templating=Templating(list=[
{
'allValue': '.*',
'current': {},
'datasource': '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': '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': '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, editable=False,
titleSize='h6', panels=[
Graph(
title='Memory Usage',
dataSource='prometheus',
id=1,
isNew=False,
editable=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,
},
{
'expr': 'kube_pod_container_resource_limits_'
'memory_bytes{pod="$pod", container=~'
'"$container"}',
'interval': '10s',
'intervalFactor': 2,
'legendFormat': 'Limit: {{ container }}',
'metric': 'kube_pod_container_resource_'
'limits_memory_bytes',
'refId': 'C',
'step': 20,
},
],
),
],
),
Row(
height=250, title='Row', showTitle=False, editable=False,
titleSize='h6', panels=[
Graph(
title='CPU Usage',
dataSource='prometheus',
id=2,
isNew=False,
editable=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
},
{
'expr': 'kube_pod_container_resource_requests_'
'cpu_cores{pod="$pod", container=~'
'"$container"}',
'interval': '10s',
'intervalFactor': 2,
'legendFormat': 'Requested: {{ container }}',
'metric': 'kube_pod_container_resource_'
'requests_cpu_cores',
'refId': 'B',
'step': 20,
},
{
'expr': 'kube_pod_container_resource_limits_'
'cpu_cores{pod="$pod", container=~'
'"$container"}',
'interval': '10s',
'intervalFactor': 2,
'legendFormat': 'Limit: {{ container }}',
'metric': 'kube_pod_container_resource_'
'limits_memory_bytes',
'refId': 'C',
'step': 20,
},
],
),
],
),
Row(
height=250, title='New Row', showTitle=False, editable=False,
titleSize='h6', panels=[
Graph(
title='Network I/O',
dataSource='prometheus',
id=3,
isNew=False,
editable=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

@@ -1,7 +0,0 @@
{
"access": "proxy",
"basicAuth": false,
"name": "prometheus",
"type": "prometheus",
"url": "http://prometheus-k8s.monitoring.svc:9090"
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,440 +0,0 @@
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
from _grafanalib import *
dashboard = Dashboard(
title='StatefulSet',
version=1,
graphTooltip=1,
time=Time(start='now-6h'),
templating=Templating(list=[
{
'allValue': '.*',
'current': {},
'datasource': 'prometheus',
'hide': 0,
'includeAll': False,
'label': 'Namespace',
'multi': False,
'name': 'statefulset_namespace',
'options': [],
'query': 'label_values(kube_statefulset_metadata_generation, '
'namespace)',
'refresh': 1,
'regex': '',
'sort': 0,
'tagValuesQuery': None,
'tags': [],
'tagsQuery': '',
'type': 'query',
'useTags': False,
},
{
'allValue': None,
'current': {},
'datasource': 'prometheus',
'hide': 0,
'includeAll': False,
'label': 'StatefulSet',
'multi': False,
'name': 'statefulset_name',
'options': [],
'query': 'label_values(kube_statefulset_metadata_generation'
'{namespace="$statefulset_namespace"}, statefulset)',
'refresh': 1,
'regex': '',
'sort': 0,
'tagValuesQuery': '',
'tags': [],
'tagsQuery': 'statefulset',
'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=\"$statefulset_namespace\",pod_name=~\"'
'$statefulset_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='
'\"$statefulset_namespace\",pod_name=~\"$'
'statefulset_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=\"$statefulset_namespace\",pod_name=~\"'
'$statefulset_name.*\"}[3m])) + '
'sum(rate(container_network_receive_bytes_total'
'{namespace=\"$statefulset_namespace\",pod_name=~'
'\"$statefulset_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_statefulset_replicas',
'expr': 'max(kube_statefulset_replicas'
'{statefulset="$statefulset_name",namespace='
'"$statefulset_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_statefulset_status_replicas'
'{statefulset=\"$statefulset_name\",'
'namespace=\"$statefulset_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_statefulset_status_observed_'
'generation{statefulset=\"$statefulset_name\",'
'namespace=\"$statefulset_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_statefulset_metadata_generation'
'{statefulset=\"$statefulset_name\",namespace=\"'
'$statefulset_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': 'min(kube_statefulset_status_replicas'
'{statefulset=\"$statefulset_name\",'
'namespace=\"$statefulset_namespace\"}) without '
'(instance, pod)',
'legendFormat': 'available',
'refId': 'B',
'step': 30,
},
{
'expr': 'max(kube_statefulset_replicas'
'{statefulset=\"$statefulset_name\",namespace=\"'
'$statefulset_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),
),
),
]
),
],
)