guilbaults / infiniband-exporter

Prometheus exporter for a Infiniband Fabric
Apache License 2.0
47 stars 21 forks source link

Exit nicely when ibqueryerrors is not executable #6

Closed jbd closed 3 years ago

jbd commented 3 years ago

Replace https://github.com/guilbaults/infiniband-exporter/pull/5.

Prevents runtime exception when ibqueryerrors not installed or executable:

Before:

Traceback (most recent call last):
  File "infiniband-exporter.py", line 354, in <module>
    args.node_name_map))
  File "/usr/lib/python2.7/site-packages/prometheus_client/registry.py", line 24, in register
    names = self._get_names(collector)
  File "/usr/lib/python2.7/site-packages/prometheus_client/registry.py", line 64, in _get_names
    for metric in desc_func():
  File "infiniband-exporter.py", line 274, in collect
    stdout=subprocess.PIPE)
  File "/usr/lib64/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

After:

python2 infiniband-exporter.py 
Cannot find an executable ibqueryerrors binary in PATH