diff options
author | beorn7 <beorn@grafana.com> | 2019-07-16 19:34:27 +0200 |
---|---|---|
committer | beorn7 <beorn@grafana.com> | 2019-07-16 19:34:27 +0200 |
commit | 3ab1f41d12d55e1561bab58bc6f0ef1604c5dd65 (patch) | |
tree | 7830b4f224ea335a163c73bb0e617528744eceb4 /docs | |
parent | 2180c2f3bf65b38952076a51e410742323ba47bb (diff) | |
download | prometheus_node_collector-3ab1f41d12d55e1561bab58bc6f0ef1604c5dd65.tar.bz2 prometheus_node_collector-3ab1f41d12d55e1561bab58bc6f0ef1604c5dd65.tar.xz prometheus_node_collector-3ab1f41d12d55e1561bab58bc6f0ef1604c5dd65.zip |
Make more use of config.libsonnet
Signed-off-by: beorn7 <beorn@grafana.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/node-mixin/config.libsonnet | 7 | ||||
-rw-r--r-- | docs/node-mixin/dashboards/use.libsonnet | 12 | ||||
-rw-r--r-- | docs/node-mixin/rules/rules.libsonnet | 4 |
3 files changed, 14 insertions, 9 deletions
diff --git a/docs/node-mixin/config.libsonnet b/docs/node-mixin/config.libsonnet index 5406bdb..de84b9e 100644 --- a/docs/node-mixin/config.libsonnet +++ b/docs/node-mixin/config.libsonnet | |||
@@ -1,11 +1,16 @@ | |||
1 | { | 1 | { |
2 | _config+:: { | 2 | _config+:: { |
3 | // Selectors are inserted between {} in Prometheus queries. | 3 | // Selectors are inserted between {} in Prometheus queries. |
4 | |||
5 | // Select the metrics coming from the node exporter. | ||
4 | nodeExporterSelector: 'job="node-exporter"', | 6 | nodeExporterSelector: 'job="node-exporter"', |
5 | 7 | ||
6 | // Mainly extracted because they are repetitive, but also useful to customize. | 8 | // Select the fstype for filesystem-related queries. |
7 | fsSelector: 'fstype=~"ext.|xfs",mountpoint!="/var/lib/docker/aufs"', | 9 | fsSelector: 'fstype=~"ext.|xfs",mountpoint!="/var/lib/docker/aufs"', |
8 | 10 | ||
11 | // Select the device for disk-related queries. | ||
12 | diskDeviceSelector: 'device=~"(sd|xvd).+"', | ||
13 | |||
9 | grafana_prefix: '', | 14 | grafana_prefix: '', |
10 | }, | 15 | }, |
11 | } | 16 | } |
diff --git a/docs/node-mixin/dashboards/use.libsonnet b/docs/node-mixin/dashboards/use.libsonnet index 96bf0f5..115e893 100644 --- a/docs/node-mixin/dashboards/use.libsonnet +++ b/docs/node-mixin/dashboards/use.libsonnet | |||
@@ -104,17 +104,17 @@ local g = import 'grafana-builder/grafana.libsonnet'; | |||
104 | ( | 104 | ( |
105 | sum without (device) ( | 105 | sum without (device) ( |
106 | max without (fstype, mountpoint) ( | 106 | max without (fstype, mountpoint) ( |
107 | node_filesystem_size_bytes{fstype=~"ext[24]"} - node_filesystem_avail_bytes{fstype=~"ext[24]"} | 107 | node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s} - node_filesystem_avail_bytes{%(nodeExporterSelector)s, %(fsSelector)s} |
108 | ) | 108 | ) |
109 | ) | 109 | ) |
110 | / ignoring (instance) group_left | 110 | / ignoring (instance) group_left |
111 | sum without (instance, device) ( | 111 | sum without (instance, device) ( |
112 | max without (fstype, mountpoint) ( | 112 | max without (fstype, mountpoint) ( |
113 | node_filesystem_size_bytes{fstype=~"ext[24]"} | 113 | node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s} |
114 | ) | 114 | ) |
115 | ) | 115 | ) |
116 | ) | 116 | ) |
117 | |||, '{{instance}}', legendLink) + | 117 | ||| % $._config, '{{instance}}', legendLink) + |
118 | g.stack + | 118 | g.stack + |
119 | { yaxes: g.yaxes({ format: 'percentunit', max: 1 }) }, | 119 | { yaxes: g.yaxes({ format: 'percentunit', max: 1 }) }, |
120 | ), | 120 | ), |
@@ -182,11 +182,11 @@ local g = import 'grafana-builder/grafana.libsonnet'; | |||
182 | g.queryPanel(||| | 182 | g.queryPanel(||| |
183 | 1 - | 183 | 1 - |
184 | ( | 184 | ( |
185 | sum(max without (mountpoint, fstype) (node_filesystem_avail_bytes{fstype=~"ext[24]"})) | 185 | sum(max without (mountpoint, fstype) (node_filesystem_avail_bytes{%(nodeExporterSelector)s, %(fsSelector)s})) |
186 | / | 186 | / |
187 | sum(max without (mountpoint, fstype) (node_filesystem_size_bytes{fstype=~"ext[24]"})) | 187 | sum(max without (mountpoint, fstype) (node_filesystem_size_bytes{%(nodeExporterSelector)s, %(fsSelector)s})) |
188 | ) | 188 | ) |
189 | |||, 'Disk') + | 189 | ||| % $._config, 'Disk') + |
190 | { yaxes: g.yaxes('percentunit') }, | 190 | { yaxes: g.yaxes('percentunit') }, |
191 | ), | 191 | ), |
192 | ), | 192 | ), |
diff --git a/docs/node-mixin/rules/rules.libsonnet b/docs/node-mixin/rules/rules.libsonnet index 6bd39a5..c4bc31a 100644 --- a/docs/node-mixin/rules/rules.libsonnet +++ b/docs/node-mixin/rules/rules.libsonnet | |||
@@ -62,7 +62,7 @@ | |||
62 | record: 'instance:node_disk_utilisation:sum_irate', | 62 | record: 'instance:node_disk_utilisation:sum_irate', |
63 | expr: ||| | 63 | expr: ||| |
64 | sum without (device) ( | 64 | sum without (device) ( |
65 | irate(node_disk_io_time_seconds_total{%(nodeExporterSelector)s,device=~"(sd|xvd).+"}[1m]) | 65 | irate(node_disk_io_time_seconds_total{%(nodeExporterSelector)s, %(diskDeviceSelector)s}[1m]) |
66 | ) | 66 | ) |
67 | ||| % $._config, | 67 | ||| % $._config, |
68 | }, | 68 | }, |
@@ -71,7 +71,7 @@ | |||
71 | record: 'instance:node_disk_saturation:sum_irate', | 71 | record: 'instance:node_disk_saturation:sum_irate', |
72 | expr: ||| | 72 | expr: ||| |
73 | sum without (device) ( | 73 | sum without (device) ( |
74 | irate(node_disk_io_time_weighted_seconds_total{%(nodeExporterSelector)s,device=~"(sd|xvd).+"}[1m]) | 74 | irate(node_disk_io_time_weighted_seconds_total{%(nodeExporterSelector)s, %(diskDeviceSelector)s}[1m]) |
75 | ) | 75 | ) |
76 | ||| % $._config, | 76 | ||| % $._config, |
77 | }, | 77 | }, |