2018-05-08 03:10:29 -07:00
|
|
|
{
|
|
|
|
prometheusRules+:: {
|
|
|
|
groups+: [
|
|
|
|
{
|
2018-08-06 01:46:28 -07:00
|
|
|
name: 'node-exporter.rules',
|
2018-05-08 03:10:29 -07:00
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
// This rule gives the number of CPUs per node.
|
|
|
|
record: 'instance:node_num_cpu:sum',
|
|
|
|
expr: |||
|
|
|
|
count by (instance) (
|
|
|
|
sum by (instance, cpu) (
|
2018-11-19 07:00:48 -08:00
|
|
|
node_cpu_seconds_total{%(nodeExporterSelector)s}
|
2018-05-08 03:10:29 -07:00
|
|
|
)
|
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// CPU utilisation is % CPU is not idle.
|
|
|
|
record: 'instance:node_cpu_utilisation:avg1m',
|
|
|
|
expr: |||
|
|
|
|
1 - avg by (instance) (
|
2018-11-19 07:00:48 -08:00
|
|
|
rate(node_cpu_seconds_total{%(nodeExporterSelector)s,mode="idle"}[1m])
|
2018-05-08 03:10:29 -07:00
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// CPU saturation is 1min avg run queue length / number of CPUs.
|
|
|
|
// Can go over 100%. >100% is bad.
|
|
|
|
record: 'instance:node_cpu_saturation_load1:',
|
|
|
|
expr: |||
|
2018-07-13 06:01:01 -07:00
|
|
|
sum by (instance) (node_load1{%(nodeExporterSelector)s})
|
2018-05-08 03:10:29 -07:00
|
|
|
/
|
2018-07-13 06:01:01 -07:00
|
|
|
instance:node_num_cpu:sum
|
2018-05-08 03:10:29 -07:00
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Total memory per node
|
|
|
|
record: 'instance:node_memory_bytes_total:sum',
|
|
|
|
expr: |||
|
|
|
|
sum by (instance) (
|
2018-11-19 07:00:48 -08:00
|
|
|
node_memory_MemTotal_bytes{%(nodeExporterSelector)s}
|
2018-05-08 03:10:29 -07:00
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Memory utilisation per node, normalized by per-node memory
|
|
|
|
record: 'instance:node_memory_utilisation:ratio',
|
|
|
|
expr: |||
|
2018-05-10 02:35:48 -07:00
|
|
|
1 - (
|
2018-11-19 07:00:48 -08:00
|
|
|
node_memory_MemAvailable_bytes{%(nodeExporterSelector)s}
|
2018-05-10 02:35:48 -07:00
|
|
|
/
|
2018-11-19 07:00:48 -08:00
|
|
|
node_memory_MemTotal_bytes{%(nodeExporterSelector)s}
|
2018-05-10 02:35:48 -07:00
|
|
|
)
|
2018-07-13 06:01:01 -07:00
|
|
|
||| % $._config,
|
2018-05-08 03:10:29 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
record: 'instance:node_memory_swap_io_bytes:sum_rate',
|
|
|
|
expr: |||
|
|
|
|
1e3 * sum by (instance) (
|
|
|
|
(rate(node_vmstat_pgpgin{%(nodeExporterSelector)s}[1m])
|
|
|
|
+ rate(node_vmstat_pgpgout{%(nodeExporterSelector)s}[1m]))
|
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
{
|
2018-05-10 02:35:48 -07:00
|
|
|
// Disk utilisation (ms spent, 1 second irate())
|
|
|
|
record: 'instance:node_disk_utilisation:sum_irate',
|
2018-05-08 03:10:29 -07:00
|
|
|
expr: |||
|
2018-05-10 02:35:48 -07:00
|
|
|
sum by (instance) (
|
2018-11-19 07:00:48 -08:00
|
|
|
irate(node_disk_io_time_seconds_total{%(nodeExporterSelector)s,device=~"(sd|xvd).+"}[1m])
|
2018-05-08 03:10:29 -07:00
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// Disk saturation (ms spent, by rate() it's bound by 1 second)
|
2018-05-10 02:35:48 -07:00
|
|
|
record: 'instance:node_disk_saturation:sum_irate',
|
2018-05-08 03:10:29 -07:00
|
|
|
expr: |||
|
2018-05-10 02:35:48 -07:00
|
|
|
sum by (instance) (
|
2018-11-19 07:00:48 -08:00
|
|
|
irate(node_disk_io_time_weighted_seconds_total{%(nodeExporterSelector)s,device=~"(sd|xvd).+"}[1m])
|
2018-05-08 03:10:29 -07:00
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
record: 'instance:node_net_utilisation:sum_irate',
|
|
|
|
expr: |||
|
|
|
|
sum by (instance) (
|
2018-11-19 07:00:48 -08:00
|
|
|
(irate(node_network_receive_bytes_total{%(nodeExporterSelector)s,device=~"eth[0-9]+"}[1m]) +
|
|
|
|
irate(node_network_transmit_bytes_total{%(nodeExporterSelector)s,device=~"eth[0-9]+"}[1m]))
|
2018-05-08 03:10:29 -07:00
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
record: 'instance:node_net_saturation:sum_irate',
|
|
|
|
expr: |||
|
|
|
|
sum by (instance) (
|
2018-11-19 07:00:48 -08:00
|
|
|
(irate(node_network_receive_drop_total{%(nodeExporterSelector)s,device=~"eth[0-9]+"}[1m]) +
|
|
|
|
irate(node_network_transmit_drop_total{%(nodeExporterSelector)s,device=~"eth[0-9]+"}[1m]))
|
2018-05-08 03:10:29 -07:00
|
|
|
)
|
|
|
|
||| % $._config,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|