Skip to content

Commit

Permalink
Handle 'Unknown' as measurement value. (#1113)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ben Kochie <[email protected]>
  • Loading branch information
nudgegoonies authored and SuperQ committed Nov 30, 2018
1 parent 4a56908 commit 73d4157
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions text_collector_examples/storcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,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):
Expand Down

0 comments on commit 73d4157

Please sign in to comment.