Move node-mixin into docs directory
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
61bcc5b468
commit
2df034c055
12 changed files with 0 additions and 0 deletions
2
docs/node-mixin/dashboards/dashboards.libsonnet
Normal file
2
docs/node-mixin/dashboards/dashboards.libsonnet
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(import 'node.libsonnet') +
|
||||
(import 'use.libsonnet')
|
||||
170
docs/node-mixin/dashboards/node.libsonnet
Normal file
170
docs/node-mixin/dashboards/node.libsonnet
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
local grafana = import 'grafonnet/grafana.libsonnet';
|
||||
local dashboard = grafana.dashboard;
|
||||
local row = grafana.row;
|
||||
local prometheus = grafana.prometheus;
|
||||
local template = grafana.template;
|
||||
local graphPanel = grafana.graphPanel;
|
||||
local promgrafonnet = import '../lib/promgrafonnet/promgrafonnet.libsonnet';
|
||||
local gauge = promgrafonnet.gauge;
|
||||
|
||||
{
|
||||
grafanaDashboards+:: {
|
||||
'nodes.json':
|
||||
local idleCPU =
|
||||
graphPanel.new(
|
||||
'Idle CPU',
|
||||
datasource='$datasource',
|
||||
span=6,
|
||||
format='percentunit',
|
||||
max=100,
|
||||
min=0,
|
||||
)
|
||||
.addTarget(prometheus.target(
|
||||
|||
|
||||
1 - avg by (cpu) (irate(node_cpu{%(nodeExporterSelector)s, mode="idle", instance="$instance"}[1m]))
|
||||
||| % $._config,
|
||||
legendFormat='{{cpu}}',
|
||||
intervalFactor=10,
|
||||
));
|
||||
|
||||
local systemLoad =
|
||||
graphPanel.new(
|
||||
'System load',
|
||||
datasource='$datasource',
|
||||
span=6,
|
||||
format='percentunit',
|
||||
)
|
||||
.addTarget(prometheus.target('node_load1{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='load 1m'))
|
||||
.addTarget(prometheus.target('node_load5{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='load 5m'))
|
||||
.addTarget(prometheus.target('node_load15{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='load 15m'));
|
||||
|
||||
local memoryGraph =
|
||||
graphPanel.new(
|
||||
'Memory Usage',
|
||||
datasource='$datasource',
|
||||
span=9,
|
||||
format='bytes',
|
||||
)
|
||||
.addTarget(prometheus.target(
|
||||
|||
|
||||
node_memory_MemTotal{%(nodeExporterSelector)s, instance="$instance"}
|
||||
- node_memory_MemFree{%(nodeExporterSelector)s, instance="$instance"}
|
||||
- node_memory_Buffers{%(nodeExporterSelector)s, instance="$instance"}
|
||||
- node_memory_Cached{%(nodeExporterSelector)s, instance="$instance"}
|
||||
||| % $._config, legendFormat='memory used'
|
||||
))
|
||||
.addTarget(prometheus.target('node_memory_Buffers{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='memory buffers'))
|
||||
.addTarget(prometheus.target('node_memory_Cached{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='memory cached'))
|
||||
.addTarget(prometheus.target('node_memory_MemFree{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='memory free'));
|
||||
|
||||
local memoryGauge = gauge.new(
|
||||
'Memory Usage',
|
||||
|||
|
||||
node_memory_MemAvailable{%(nodeExporterSelector)s, instance="$instance"}
|
||||
/
|
||||
node_memory_MemTotal{%(nodeExporterSelector)s, instance="$instance"}
|
||||
||| % $._config,
|
||||
).withLowerBeingBetter();
|
||||
|
||||
local diskIO =
|
||||
graphPanel.new(
|
||||
'Disk I/O',
|
||||
datasource='$datasource',
|
||||
span=9,
|
||||
)
|
||||
.addTarget(prometheus.target('sum by (instance) (irate(node_disk_bytes_read_total{%(nodeExporterSelector)s, instance="$instance"}[1m]))' % $._config, legendFormat='read'))
|
||||
.addTarget(prometheus.target('sum by (instance) (irate(node_disk_bytes_written_total{%(nodeExporterSelector)s, instance="$instance"}[1m]))' % $._config, legendFormat='written'))
|
||||
.addTarget(prometheus.target('sum by (instance) (irate(node_disk_io_time_ms{%(nodeExporterSelector)s, instance="$instance"}[1m]))' % $._config, legendFormat='io time')) +
|
||||
{
|
||||
seriesOverrides: [
|
||||
{
|
||||
alias: 'read',
|
||||
yaxis: 1,
|
||||
},
|
||||
{
|
||||
alias: 'io time',
|
||||
yaxis: 2,
|
||||
},
|
||||
],
|
||||
yaxes: [
|
||||
self.yaxe(format='bytes'),
|
||||
self.yaxe(format='ms'),
|
||||
],
|
||||
};
|
||||
|
||||
local diskSpaceUsage = gauge.new(
|
||||
'Disk Space Usage',
|
||||
|||
|
||||
1 - (
|
||||
sum(node_filesystem_free{%(nodeExporterSelector)s, device!="rootfs", instance="$instance"}
|
||||
/
|
||||
sum(node_filesystem_size{%(nodeExporterSelector)s, device!="rootfs", instance="$instance"}
|
||||
)
|
||||
||| % $._config,
|
||||
).withLowerBeingBetter();
|
||||
|
||||
local networkReceived =
|
||||
graphPanel.new(
|
||||
'Network Received',
|
||||
datasource='$datasource',
|
||||
span=6,
|
||||
format='bytes',
|
||||
)
|
||||
.addTarget(prometheus.target('irate(node_network_receive_bytes{%(nodeExporterSelector)s, instance="$instance", device!~"lo"}[1m])' % $._config, legendFormat='{{device}}'));
|
||||
|
||||
local networkTransmitted =
|
||||
graphPanel.new(
|
||||
'Network Transmitted',
|
||||
datasource='$datasource',
|
||||
span=6,
|
||||
format='bytes',
|
||||
)
|
||||
.addTarget(prometheus.target('irate(node_network_transmit_bytes{%(nodeExporterSelector)s, instance="$instance", device!~"lo"}[1m])' % $._config, legendFormat='{{device}}'));
|
||||
|
||||
dashboard.new('Nodes', time_from='now-1h')
|
||||
.addTemplate(
|
||||
{
|
||||
current: {
|
||||
text: 'Prometheus',
|
||||
value: 'Prometheus',
|
||||
},
|
||||
hide: 0,
|
||||
label: null,
|
||||
name: 'datasource',
|
||||
options: [],
|
||||
query: 'prometheus',
|
||||
refresh: 1,
|
||||
regex: '',
|
||||
type: 'datasource',
|
||||
},
|
||||
)
|
||||
.addTemplate(
|
||||
template.new(
|
||||
'instance',
|
||||
'$datasource',
|
||||
'label_values(node_boot_time{%(nodeExporterSelector)s}, instance)' % $._config,
|
||||
refresh='time',
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
row.new()
|
||||
.addPanel(idleCPU)
|
||||
.addPanel(systemLoad)
|
||||
)
|
||||
.addRow(
|
||||
row.new()
|
||||
.addPanel(memoryGraph)
|
||||
.addPanel(memoryGauge)
|
||||
)
|
||||
.addRow(
|
||||
row.new()
|
||||
.addPanel(diskIO)
|
||||
.addPanel(diskSpaceUsage)
|
||||
)
|
||||
.addRow(
|
||||
row.new()
|
||||
.addPanel(networkReceived)
|
||||
.addPanel(networkTransmitted)
|
||||
),
|
||||
},
|
||||
}
|
||||
151
docs/node-mixin/dashboards/use.libsonnet
Normal file
151
docs/node-mixin/dashboards/use.libsonnet
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
local g = import 'grafana-builder/grafana.libsonnet';
|
||||
|
||||
{
|
||||
grafanaDashboards+:: {
|
||||
'node-cluster-rsrc-use.json':
|
||||
local legendLink = '%s/dashboard/file/k8s-node-rsrc-use.json' % $._config.grafana_prefix;
|
||||
|
||||
g.dashboard('USE Method / Cluster')
|
||||
.addRow(
|
||||
g.row('CPU')
|
||||
.addPanel(
|
||||
g.panel('CPU Utilisation') +
|
||||
g.queryPanel('instance:node_cpu_utilisation:avg1m * instance:node_num_cpu:sum / scalar(sum(instance:node_num_cpu:sum))', '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes({ format: 'percentunit', max: 1 }) },
|
||||
)
|
||||
.addPanel(
|
||||
g.panel('CPU Saturation (Load1)') +
|
||||
g.queryPanel(|||
|
||||
instance:node_cpu_saturation_load1: / scalar(sum(up{%(nodeExporterSelector)s}))
|
||||
||| % $._config, '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes({ format: 'percentunit', max: 1 }) },
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
g.row('Memory')
|
||||
.addPanel(
|
||||
g.panel('Memory Utilisation') +
|
||||
g.queryPanel('instance:node_memory_utilisation:ratio', '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes({ format: 'percentunit', max: 1 }) },
|
||||
)
|
||||
.addPanel(
|
||||
g.panel('Memory Saturation (Swap I/O)') +
|
||||
g.queryPanel('instance:node_memory_swap_io_bytes:sum_rate', '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes('Bps') },
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
g.row('Disk')
|
||||
.addPanel(
|
||||
g.panel('Disk IO Utilisation') +
|
||||
// Full utilisation would be all disks on each node spending an average of
|
||||
// 1 sec per second doing I/O, normalize by node count for stacked charts
|
||||
g.queryPanel(|||
|
||||
instance:node_disk_utilisation:sum_irate / scalar(sum(up{%(nodeExporterSelector)s}))
|
||||
||| % $._config, '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes({ format: 'percentunit', max: 1 }) },
|
||||
)
|
||||
.addPanel(
|
||||
g.panel('Disk IO Saturation') +
|
||||
g.queryPanel(|||
|
||||
instance:node_disk_saturation:sum_irate / scalar(sum(up{%(nodeExporterSelector)s}))
|
||||
||| % $._config, '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes({ format: 'percentunit', max: 1 }) },
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
g.row('Network')
|
||||
.addPanel(
|
||||
g.panel('Net Utilisation (Transmitted)') +
|
||||
g.queryPanel('instance:node_net_utilisation:sum_irate', '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes('Bps') },
|
||||
)
|
||||
.addPanel(
|
||||
g.panel('Net Saturation (Dropped)') +
|
||||
g.queryPanel('instance:node_net_saturation:sum_irate', '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes('Bps') },
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
g.row('Storage')
|
||||
.addPanel(
|
||||
g.panel('Disk Capacity') +
|
||||
g.queryPanel('sum(max(node_filesystem_size_bytes{fstype=~"ext[24]"} - node_filesystem_free_bytes{fstype=~"ext[24]"}) by (device,instance,namespace)) by (instance,namespace) / scalar(sum(max(node_filesystem_size_bytes{fstype=~"ext[24]"}) by (device,instance,namespace)))', '{{instance}}', legendLink) +
|
||||
g.stack +
|
||||
{ yaxes: g.yaxes({ format: 'percentunit', max: 1 }) },
|
||||
),
|
||||
),
|
||||
|
||||
'node-rsrc-use.json':
|
||||
g.dashboard('USE Method / Node')
|
||||
.addTemplate('instance', 'up{%(nodeExporterSelector)s}' % $._config, 'instance')
|
||||
.addRow(
|
||||
g.row('CPU')
|
||||
.addPanel(
|
||||
g.panel('CPU Utilisation') +
|
||||
g.queryPanel('instance:node_cpu_utilisation:avg1m{instance="$instance"}', 'Utilisation') +
|
||||
{ yaxes: g.yaxes('percentunit') },
|
||||
)
|
||||
.addPanel(
|
||||
g.panel('CPU Saturation (Load1)') +
|
||||
g.queryPanel('instance:node_cpu_saturation_load1:{instance="$instance"}', 'Saturation') +
|
||||
{ yaxes: g.yaxes('percentunit') },
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
g.row('Memory')
|
||||
.addPanel(
|
||||
g.panel('Memory Utilisation') +
|
||||
g.queryPanel('instance:node_memory_utilisation:ratio{instance="$instance"}', 'Memory') +
|
||||
{ yaxes: g.yaxes('percentunit') },
|
||||
)
|
||||
.addPanel(
|
||||
g.panel('Memory Saturation (Swap I/O)') +
|
||||
g.queryPanel('instance:node_memory_swap_io_bytes:sum_rate{instance="$instance"}', 'Swap IO') +
|
||||
{ yaxes: g.yaxes('Bps') },
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
g.row('Disk')
|
||||
.addPanel(
|
||||
g.panel('Disk IO Utilisation') +
|
||||
g.queryPanel('instance:node_disk_utilisation:sum_irate{instance="$instance"}', 'Utilisation') +
|
||||
{ yaxes: g.yaxes('percentunit') },
|
||||
)
|
||||
.addPanel(
|
||||
g.panel('Disk IO Saturation') +
|
||||
g.queryPanel('instance:node_disk_saturation:sum_irate{instance="$instance"}', 'Saturation') +
|
||||
{ yaxes: g.yaxes('percentunit') },
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
g.row('Net')
|
||||
.addPanel(
|
||||
g.panel('Net Utilisation (Transmitted)') +
|
||||
g.queryPanel('instance:node_net_utilisation:sum_irate{instance="$instance"}', 'Utilisation') +
|
||||
{ yaxes: g.yaxes('Bps') },
|
||||
)
|
||||
.addPanel(
|
||||
g.panel('Net Saturation (Dropped)') +
|
||||
g.queryPanel('instance:node_net_saturation:sum_irate{instance="$instance"}', 'Saturation') +
|
||||
{ yaxes: g.yaxes('Bps') },
|
||||
)
|
||||
)
|
||||
.addRow(
|
||||
g.row('Disk')
|
||||
.addPanel(
|
||||
g.panel('Disk Utilisation') +
|
||||
g.queryPanel('1 - sum(max by (device, node) (node_filesystem_free_bytes{fstype=~"ext[24]"})) / sum(max by (device, node) (node_filesystem_size_bytes{fstype=~"ext[24]"}))', 'Disk') +
|
||||
{ yaxes: g.yaxes('percentunit') },
|
||||
),
|
||||
),
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue