Open nhjjr opened 12 months ago
If you can, please provide the console output (the error trace) of the exporter when used on UPS Firmware 2.0.5. Ideally, it would be good to have a dump of the new HTML as well.
There is no immediate need for us to upgrade our firmware, so it may take a while before we get to addressing this. If someone wants to help make this happen, I'm happy to review a PR.
There seems to be some bigger changes to the JSON response between different firmware versions. I've made a version that works with firmware 3.1.8. I did not spend the effort to check for firmware version to differentiate the expected output from the rest api. It does however seem to be possible to ask for firmware version using /rest/mbdetnrs/1.0/managers/1/firmwares/
@nhjjr cheers for putting this on Github - thanks!
@Randommmm ping
Thanks for the pings, keen to help out with this.
Command Used: python3 prometheus_eaton_ups_exporter.py -c config_ups2.json -k --verbose -w 127.0.0.1:9955 Command Output:
2023-10-11 09:44:40,520 - prometheus_eaton_ups_exporter.scraper - DEBUG - Unauthorized, try to login
2023-10-11 09:44:41,721 - prometheus_eaton_ups_exporter.scraper - DEBUG - Authentication successful on (https://192.168.1.81)
2023-10-11 09:44:42,278 - prometheus_eaton_ups_exporter.scraper - DEBUG - GET https://192.168.1.81/rest/mbdetnrs/1.0/powerDistributions/1
2023-10-11 09:44:42,557 - prometheus_eaton_ups_exporter.scraper - DEBUG - GET https://192.168.1.81/rest/mbdetnrs/1.0/powerDistributions/1/inputs/1
2023-10-11 09:44:42,934 - prometheus_eaton_ups_exporter.scraper - DEBUG - GET https://192.168.1.81/rest/mbdetnrs/1.0/powerDistributions/1/outputs/1
2023-10-11 09:44:42,964 - prometheus_eaton_ups_exporter.scraper - DEBUG - GET https://192.168.1.81/rest/mbdetnrs/1.0/powerDistributions/1/backupSystem
2023-10-11 09:44:43,217 - prometheus_eaton_ups_exporter.scraper - DEBUG - GET https://192.168.1.81/rest/mbdetnrs/1.0/powerDistributions/1/backupSystem/powerBank
Traceback (most recent call last):
File "/home/monitor/prometheus-eaton-ups-exporter/prometheus_eaton_ups_exporter.py", line 161, in <module>
main()
File "/home/monitor/prometheus-eaton-ups-exporter/prometheus_eaton_ups_exporter.py", line 157, in main
run(sys.argv[1:])
File "/home/monitor/prometheus-eaton-ups-exporter/prometheus_eaton_ups_exporter.py", line 129, in run
REGISTRY.register(
File "/usr/lib/python3/dist-packages/prometheus_client/registry.py", line 40, in register
names = self._get_names(collector)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/prometheus_client/registry.py", line 80, in _get_names
for metric in desc_func():
File "/home/monitor/prometheus-eaton-ups-exporter/prometheus_eaton_ups_exporter/exporter.py", line 61, in collect
inputs_rm = inputs['measures']['realtime']
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'realtime'
Contents of config_ups2.json, used in this text example to break things with my normal muli-ups config.json file
{
"ups2_name": {
"address": "https://192.168.1.81",
"user": "admin",
"password": "supersecurepassword"
}
}
I haven't had any luck scraping the web interface, I have a bit of experience with web scraping and wget, although even with the cookies file, the login still fails due to an unknown authentication method. Might need some assistance with that one.
Sorry I am just reading this conversation now, originally I created this project but now I am busy with other stuff. If I remember correctly you can look into the network communication that is send once you login. There was one where all the json formatted data was communicated. It was really hard to figure that out, but I would have to look into the webpage again to tell you exactly how and where you can find this information.