Naudit / pySMART-exporter

A Prometheus PySMART (smartctl) exporter
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

throws an error and wont run #2

Open evanrich opened 2 months ago

evanrich commented 2 months ago

Traceback (most recent call last):
  File "/usr/lib/python3.11/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/sirius/homes/pysmart/lib/python3.11/site-packages/prometheus_client/exposition.py", line 128, in prometheus_app
    status, headers, output = _bake_output(registry, accept_header, accept_encoding_header, params, disable_compression)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/sirius/homes/pysmart/lib/python3.11/site-packages/prometheus_client/exposition.py", line 104, in _bake_output
    output = encoder(registry)
             ^^^^^^^^^^^^^^^^^
  File "/mnt/sirius/homes/pysmart/lib/python3.11/site-packages/prometheus_client/exposition.py", line 284, in generate_latest
    output.append(sample_line(s))
                  ^^^^^^^^^^^^^^
  File "/mnt/sirius/homes/pysmart/lib/python3.11/site-packages/prometheus_client/exposition.py", line 241, in sample_line
    ['{}="{}"'.format(
  File "/mnt/sirius/homes/pysmart/lib/python3.11/site-packages/prometheus_client/exposition.py", line 242, in <listcomp>
    k, v.replace('\\', r'\\').replace('\n', r'\n').replace('"', r'\"'))
       ^^^^^^^^^
AttributeError: ("'int' object has no attribute 'replace'", Metric(pysmart_test, PySMART metric test, gauge, , [Sample(name='pysmart_test', labels={'num': '0', 'hours': 3324, 'type': 'Short', 'status': 'Completed without error', 'LBA': 'N/A', 'device': 'nvme0', 'interface': 'nvme', 'raid_id': 'N/A', 'remain': 0}, value=1, timestamp=None, exemplar=None), Sample(name='pysmart_test', labels={'num': '1', 'hours': 3206, 'type': 'Short', 'status': 'Completed without error', 'LBA': 'N/A', 'device': 'nvme0', 'interface': 'nvme', 'raid_id': 'N/A', 'remain': 0}, value=1, timestamp=None, exemplar=None), Sample(name='pysmart_test', labels={'num': '2', 'ho
ralequi commented 2 months ago

Hi,

Which pysmart version are you using?

evanrich commented 2 months ago

hey @ralequi I'm using whatever version is currently released, looks like 1.3.0. I tried multiple verisons of pysmart, the exporter (going back as far as v0.2.0) and the prometheus-client, going back to like 0.10.0, and couldn't get it to work.

My thoughts are that in the system I'm running this on (a venv on trueNAS scale), that maybe the nvme drives are throwing it off, or that it looks like your code was written for python 3.8, but truenas provides python 3.11 and that this was something between 3.8 and 3.11. I ended up finding another exporter (smart-exporter) that does something similar, but I can try and mess around with this next week or so. I'll be out of town for a week starting tonight but I can debug further to figure out if its a 3.8/3.11 or nvme issue.

From the errors, prometheus-client doens't seem to like something it's being fed, so it's either i think something in pysmart, or a 3.8/3.11 difference.