This commit is contained in:
mwiegand 2021-10-30 20:59:54 +02:00
parent a564d2ed31
commit 79820a0c10
5 changed files with 9 additions and 3 deletions

View file

@ -138,6 +138,7 @@ for dashboard_id, monitored_node in enumerate(monitored_nodes, start=1):
negative=query_config.get('negative', False), negative=query_config.get('negative', False),
boolean_to_int=query_config.get('boolean_to_int', False), boolean_to_int=query_config.get('boolean_to_int', False),
resolution=query_config.get('resolution', 1) * 4, resolution=query_config.get('resolution', 1) * 4,
minimum=query_config.get('minimum', None),
filters={ filters={
'host': monitored_node.name, 'host': monitored_node.name,
**query_config['filters'], **query_config['filters'],

View file

@ -4,6 +4,9 @@ from(bucket: "${bucket}")
<% values = values if isinstance(values, list) else [values] %>\ <% values = values if isinstance(values, list) else [values] %>\
|> filter(fn: (r) => ${' or '.join(f'r["{key}"] == "{value}"' for value in values)}) |> filter(fn: (r) => ${' or '.join(f'r["{key}"] == "{value}"' for value in values)})
% endfor % endfor
% if minimum:
|> filter(fn: (r) => r._value > ${minimum})
% endif
% if function == 'derivative': % if function == 'derivative':
|> derivative(nonNegative: true) |> derivative(nonNegative: true)
% endif % endif

View file

@ -9,7 +9,8 @@
'cpu_usage', 'cpu_usage',
], ],
}, },
'resolution': 6, 'minimum': 1,
'resolution': 2,
}, },
}, },
'unit': 'percent', 'unit': 'percent',

View file

@ -9,7 +9,8 @@
'memory_rss', 'memory_rss',
], ],
}, },
'resolution': 6, 'minimum': 10*(10**6),
'resolution': 2,
}, },
}, },
'unit': 'bytes', 'unit': 'bytes',

View file

@ -56,7 +56,7 @@
}, },
'smartctl': { 'smartctl': {
'/dev/disk/by-id/ata-TOSHIBA_MG06ACA10TE_61C0A1B1FKQE': { '/dev/disk/by-id/ata-TOSHIBA_MG06ACA10TE_61C0A1B1FKQE': {
'apm': 32, 'apm': 1,
}, },
}, },
'zfs': { 'zfs': {