Hddtemp fix issue 4#5
Conversation
|
I'm not sure why a connection to the hddtemp daemon won't give updating values. But this seems to fix things as far as Prometheus is concerned. I hope @ncabatoff will take a look. He must have observed the same problem. |
|
Every time the data is asked the code executes this sensor-exporter/sensor-exporter/main.go Line 229 in da6ddc4 This in turn uses the Init - where the acutal HTTP happens sensor-exporter/sensor-exporter/main.go Line 155 in da6ddc4 This was done in the old code only at first run ( https://github.com/ncabatoff/sensor-exporter/pull/5/files#diff-5c2840fe6d87fdb78e1df0d92576984dL164 ) The code uses the same object, so the Init was before only called once/first time. Now it is called every time. I only added the closing of connection(to not leave dangling stuff https://github.com/ncabatoff/sensor-exporter/pull/5/files#diff-5c2840fe6d87fdb78e1df0d92576984dR172) and to reset the buffer ( https://github.com/ncabatoff/sensor-exporter/pull/5/files#diff-5c2840fe6d87fdb78e1df0d92576984dR167 ) . |
|
LGTM. I will add this manually on my server until this is merged. |
By closing and opening new connection to hddtemp daemon, we fetch new data with every call. Also the reset of buffer is needed to have where to write new data.
Should fix issue #4