sbrudenell / ecobee_exporter

Prometheus exporter for Ecobee
MIT License
1 stars 1 forks source link

shelve erroring when running container #1

Open billykwooten opened 5 years ago

billykwooten commented 5 years ago

Shelve is bombing out inside the container when trying to run it.

I would also say we need some documentation here, it took me about an hour and a reddit post you had to see you were volume mounting the configuration and passing it into the auth_file variable. Also took me a while to figure out that we needed a shelve DB file vs a plain json auth file using debugger in intelliJ.

[root@xxxxxx ecobee_exporter]# docker run --restart always -v /root:/config sbrudenell/ecobee_exporter --api_key XXXXXXXXX --auth_file /config/ecobee.db
Traceback (most recent call last):
  File "/ecobee_exporter", line 11, in <module>
    sys.exit(exporter_main())
  File "/usr/local/lib/python3.7/site-packages/ecobee_exporter/exporter.py", line 31, in main
    prometheus_client.REGISTRY.register(collector)
  File "/usr/local/lib/python3.7/site-packages/prometheus_client/core.py", line 96, in register
    names = self._get_names(collector)
  File "/usr/local/lib/python3.7/site-packages/prometheus_client/core.py", line 136, in _get_names
    for metric in desc_func():
  File "/usr/local/lib/python3.7/site-packages/ecobee_exporter/collector.py", line 25, in collect
    authfile=self.authfile)
  File "/usr/local/lib/python3.7/site-packages/ecobee/__init__.py", line 91, in __init__
    self.auth = shelve.open(authfile)
  File "/usr/local/lib/python3.7/shelve.py", line 243, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/usr/local/lib/python3.7/shelve.py", line 227, in __init__
    Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
  File "/usr/local/lib/python3.7/dbm/__init__.py", line 94, in open
    return mod.open(file, flag, mode)
_gdbm.error: Bad magic number
dichro commented 5 years ago

+1, it'd be lovely to have some clear instructions on how to get the auth db set up. mrala/ecobee_prometheus_exporter handles the first-time setup very well, as one example.

sbrudenell commented 5 years ago

hmm. So the library we're using is a little janky for initial setup, and the one mrala is using is janky in interpreting data.

I see that in order of most recent push, there's:

I will give that most recent one a try, when I get a chance.