mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-09 23:24:09 -08:00
Handle 'Unknown' as measurement value. (#1113)
We use the output-compatible perccli and storcli.py does not handle 'Unknown' as a result: ``` sg="Error parsing \"/var/lib/node_exporter/perccli.prom\": text format parsing error in line 222: expected float as value, got \"Unknown\"" source="textfile.go:212" ``` I know, the perccli should not return 'Unknown' but this error breaks all other useful measurements because the prom file is not parsable. My if condition fixes this. Signed-off-by: Andreas Wirooks <andreas.wirooks@1und1.de>
This commit is contained in:
parent
ea8e1373f7
commit
9c9e17aba7
|
@ -198,8 +198,9 @@ def print_all_metrics(metrics):
|
|||
print('# HELP {}{} MegaRAID {}'.format(metric_prefix, metric, metric.replace('_', ' ')))
|
||||
print('# TYPE {}{} gauge'.format(metric_prefix, metric))
|
||||
for measurement in measurements:
|
||||
print('{}{}{} {}'.format(metric_prefix, metric, '{' + measurement['labels'] + '}',
|
||||
measurement['value']))
|
||||
if measurement['value'] != 'Unknown':
|
||||
print('{}{}{} {}'.format(metric_prefix, metric, '{' + measurement['labels'] + '}',
|
||||
measurement['value']))
|
||||
|
||||
|
||||
def get_storcli_json(storcli_args):
|
||||
|
|
Loading…
Reference in a new issue