2018-05-08 10:10:29 +00:00
|
|
|
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;
|
2019-07-06 19:09:17 +00:00
|
|
|
local promgrafonnet = import 'promgrafonnet/promgrafonnet.libsonnet';
|
2018-05-08 10:10:29 +00:00
|
|
|
local gauge = promgrafonnet.gauge;
|
|
|
|
|
|
|
|
{
|
|
|
|
grafanaDashboards+:: {
|
|
|
|
'nodes.json':
|
|
|
|
local idleCPU =
|
|
|
|
graphPanel.new(
|
|
|
|
'Idle CPU',
|
|
|
|
datasource='$datasource',
|
|
|
|
span=6,
|
2018-05-10 09:05:59 +00:00
|
|
|
format='percentunit',
|
2019-08-14 22:40:51 +00:00
|
|
|
max=1,
|
2018-05-08 10:10:29 +00:00
|
|
|
min=0,
|
2019-08-14 22:40:51 +00:00
|
|
|
stack=true,
|
2018-05-08 10:10:29 +00:00
|
|
|
)
|
|
|
|
.addTarget(prometheus.target(
|
|
|
|
|||
|
2019-08-14 22:40:51 +00:00
|
|
|
(
|
|
|
|
(1 - rate(node_cpu_seconds_total{%(nodeExporterSelector)s, mode="idle", instance="$instance"}[$__interval]))
|
|
|
|
/ ignoring(cpu) group_left
|
|
|
|
count without (cpu)( node_cpu_seconds_total{%(nodeExporterSelector)s, mode="idle", instance="$instance"})
|
|
|
|
)
|
2018-05-08 10:10:29 +00:00
|
|
|
||| % $._config,
|
|
|
|
legendFormat='{{cpu}}',
|
2019-08-14 22:40:51 +00:00
|
|
|
intervalFactor=5,
|
|
|
|
interval='1m',
|
2018-05-08 10:10:29 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
local systemLoad =
|
|
|
|
graphPanel.new(
|
2019-07-12 20:58:43 +00:00
|
|
|
'Load Average',
|
2018-05-08 10:10:29 +00:00
|
|
|
datasource='$datasource',
|
|
|
|
span=6,
|
2019-07-12 20:58:43 +00:00
|
|
|
format='short',
|
2019-08-15 14:32:54 +00:00
|
|
|
min=0,
|
2019-08-14 22:40:51 +00:00
|
|
|
fill=0,
|
2018-05-08 10:10:29 +00:00
|
|
|
)
|
2019-07-12 20:58:43 +00:00
|
|
|
.addTarget(prometheus.target('node_load1{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='1m load average'))
|
|
|
|
.addTarget(prometheus.target('node_load5{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='5m load average'))
|
|
|
|
.addTarget(prometheus.target('node_load15{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='15m load average'));
|
2018-05-08 10:10:29 +00:00
|
|
|
|
|
|
|
local memoryGraph =
|
|
|
|
graphPanel.new(
|
|
|
|
'Memory Usage',
|
|
|
|
datasource='$datasource',
|
|
|
|
span=9,
|
|
|
|
format='bytes',
|
2019-08-14 22:40:51 +00:00
|
|
|
stack=true,
|
|
|
|
min=0,
|
2018-05-08 10:10:29 +00:00
|
|
|
)
|
|
|
|
.addTarget(prometheus.target(
|
|
|
|
|||
|
2019-07-10 18:07:20 +00:00
|
|
|
(
|
2019-07-12 20:58:43 +00:00
|
|
|
node_memory_MemTotal_bytes{%(nodeExporterSelector)s, instance="$instance"}
|
2019-07-10 18:07:20 +00:00
|
|
|
-
|
2019-07-12 20:58:43 +00:00
|
|
|
node_memory_MemFree_bytes{%(nodeExporterSelector)s, instance="$instance"}
|
2019-07-10 18:07:20 +00:00
|
|
|
-
|
2019-07-12 20:58:43 +00:00
|
|
|
node_memory_Buffers_bytes{%(nodeExporterSelector)s, instance="$instance"}
|
2019-07-10 18:07:20 +00:00
|
|
|
-
|
2019-07-12 20:58:43 +00:00
|
|
|
node_memory_Cached_bytes{%(nodeExporterSelector)s, instance="$instance"}
|
2019-07-10 18:07:20 +00:00
|
|
|
)
|
2018-05-08 10:10:29 +00:00
|
|
|
||| % $._config, legendFormat='memory used'
|
|
|
|
))
|
2019-07-12 20:58:43 +00:00
|
|
|
.addTarget(prometheus.target('node_memory_Buffers_bytes{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='memory buffers'))
|
|
|
|
.addTarget(prometheus.target('node_memory_Cached_bytes{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='memory cached'))
|
|
|
|
.addTarget(prometheus.target('node_memory_MemFree_bytes{%(nodeExporterSelector)s, instance="$instance"}' % $._config, legendFormat='memory free'));
|
2018-05-08 10:10:29 +00:00
|
|
|
|
2019-07-17 21:54:31 +00:00
|
|
|
// TODO: It would be nicer to have a gauge that gets a 0-1 range and displays it as a percentage 0%-100%.
|
|
|
|
// This needs to be added upstream in the promgrafonnet library and then changed here.
|
2018-05-08 10:10:29 +00:00
|
|
|
local memoryGauge = gauge.new(
|
|
|
|
'Memory Usage',
|
|
|
|
|||
|
2019-07-17 21:54:31 +00:00
|
|
|
100 -
|
2019-07-10 18:07:20 +00:00
|
|
|
(
|
2019-07-12 20:58:43 +00:00
|
|
|
node_memory_MemAvailable_bytes{%(nodeExporterSelector)s, instance="$instance"}
|
2018-05-10 09:21:00 +00:00
|
|
|
/
|
2019-07-12 20:58:43 +00:00
|
|
|
node_memory_MemTotal_bytes{%(nodeExporterSelector)s, instance="$instance"}
|
2019-07-10 18:07:20 +00:00
|
|
|
* 100
|
2019-07-17 21:54:31 +00:00
|
|
|
)
|
2018-05-08 10:10:29 +00:00
|
|
|
||| % $._config,
|
|
|
|
).withLowerBeingBetter();
|
|
|
|
|
|
|
|
local diskIO =
|
|
|
|
graphPanel.new(
|
|
|
|
'Disk I/O',
|
|
|
|
datasource='$datasource',
|
2019-08-15 14:32:54 +00:00
|
|
|
span=6,
|
|
|
|
min=0,
|
2019-08-14 22:40:51 +00:00
|
|
|
fill=0,
|
2018-05-08 10:10:29 +00:00
|
|
|
)
|
2019-07-17 21:54:31 +00:00
|
|
|
// TODO: Does it make sense to have those three in the same panel?
|
2019-08-14 22:40:51 +00:00
|
|
|
.addTarget(prometheus.target(
|
|
|
|
'rate(node_disk_read_bytes_total{%(nodeExporterSelector)s, instance="$instance", %(diskDeviceSelector)s}[$__interval])' % $._config,
|
|
|
|
legendFormat='{{device}} read',
|
|
|
|
interval='1m',
|
|
|
|
))
|
|
|
|
.addTarget(prometheus.target(
|
|
|
|
'rate(node_disk_written_bytes_total{%(nodeExporterSelector)s, instance="$instance", %(diskDeviceSelector)s}[$__interval])' % $._config,
|
|
|
|
legendFormat='{{device}} written',
|
|
|
|
interval='1m',
|
|
|
|
))
|
|
|
|
.addTarget(prometheus.target(
|
|
|
|
'rate(node_disk_io_time_seconds_total{%(nodeExporterSelector)s, instance="$instance", %(diskDeviceSelector)s}[$__interval])' % $._config,
|
|
|
|
legendFormat='{{device}} io time',
|
|
|
|
interval='1m',
|
|
|
|
)) +
|
2018-05-08 10:10:29 +00:00
|
|
|
{
|
|
|
|
seriesOverrides: [
|
|
|
|
{
|
2019-08-14 22:40:51 +00:00
|
|
|
alias: '/ read| written/',
|
2018-05-08 10:10:29 +00:00
|
|
|
yaxis: 1,
|
|
|
|
},
|
|
|
|
{
|
2019-08-14 22:40:51 +00:00
|
|
|
alias: '/ io time/',
|
2018-05-08 10:10:29 +00:00
|
|
|
yaxis: 2,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
yaxes: [
|
|
|
|
self.yaxe(format='bytes'),
|
2019-07-12 20:58:43 +00:00
|
|
|
self.yaxe(format='s'),
|
2018-05-08 10:10:29 +00:00
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2019-08-15 14:32:54 +00:00
|
|
|
// TODO: Somehow partition this by device while excluding read-only devices.
|
|
|
|
local diskSpaceUsage =
|
|
|
|
graphPanel.new(
|
|
|
|
'Disk Space Usage',
|
|
|
|
datasource='$datasource',
|
|
|
|
span=6,
|
|
|
|
format='bytes',
|
|
|
|
min=0,
|
|
|
|
fill=1,
|
|
|
|
stack=true,
|
|
|
|
)
|
|
|
|
.addTarget(prometheus.target(
|
|
|
|
|||
|
|
|
|
sum(
|
|
|
|
max by (device) (
|
|
|
|
node_filesystem_size_bytes{%(nodeExporterSelector)s, instance="$instance", %(fsSelector)s}
|
|
|
|
-
|
|
|
|
node_filesystem_avail_bytes{%(nodeExporterSelector)s, instance="$instance", %(fsSelector)s}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
legendFormat='used',
|
|
|
|
))
|
|
|
|
.addTarget(prometheus.target(
|
|
|
|
|||
|
|
|
|
sum(
|
|
|
|
max by (device) (
|
|
|
|
node_filesystem_avail_bytes{%(nodeExporterSelector)s, instance="$instance", %(fsSelector)s}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
legendFormat='available',
|
|
|
|
)) +
|
|
|
|
{
|
|
|
|
seriesOverrides: [
|
|
|
|
{
|
|
|
|
alias: 'used',
|
|
|
|
color: '#E0B400',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
alias: 'available',
|
|
|
|
color: '#73BF69',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2018-05-08 10:10:29 +00:00
|
|
|
|
|
|
|
local networkReceived =
|
|
|
|
graphPanel.new(
|
|
|
|
'Network Received',
|
|
|
|
datasource='$datasource',
|
|
|
|
span=6,
|
|
|
|
format='bytes',
|
2019-08-15 14:32:54 +00:00
|
|
|
min=0,
|
2019-08-14 22:40:51 +00:00
|
|
|
fill=0,
|
2018-05-08 10:10:29 +00:00
|
|
|
)
|
2019-08-14 22:40:51 +00:00
|
|
|
.addTarget(prometheus.target(
|
|
|
|
'rate(node_network_receive_bytes_total{%(nodeExporterSelector)s, instance="$instance", device!="lo"}[$__interval])' % $._config,
|
|
|
|
legendFormat='{{device}}',
|
|
|
|
interval='1m',
|
|
|
|
));
|
2018-05-08 10:10:29 +00:00
|
|
|
|
|
|
|
local networkTransmitted =
|
|
|
|
graphPanel.new(
|
|
|
|
'Network Transmitted',
|
|
|
|
datasource='$datasource',
|
|
|
|
span=6,
|
|
|
|
format='bytes',
|
2019-08-15 14:32:54 +00:00
|
|
|
min=0,
|
2019-08-14 22:40:51 +00:00
|
|
|
fill=0,
|
2018-05-08 10:10:29 +00:00
|
|
|
)
|
2019-08-14 22:40:51 +00:00
|
|
|
.addTarget(prometheus.target(
|
|
|
|
'rate(node_network_transmit_bytes_total{%(nodeExporterSelector)s, instance="$instance", device!="lo"}[$__interval])' % $._config,
|
|
|
|
legendFormat='{{device}}',
|
|
|
|
interval='1m',
|
|
|
|
));
|
2018-05-08 10:10:29 +00:00
|
|
|
|
|
|
|
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',
|
2019-07-17 21:54:31 +00:00
|
|
|
'label_values(node_exporter_build_info{%(nodeExporterSelector)s}, instance)' % $._config,
|
2018-05-08 10:10:29 +00:00
|
|
|
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)
|
|
|
|
),
|
|
|
|
},
|
|
|
|
}
|