Open m1012000 opened 3 months ago
Hi @m1012000 , thank you for opening this issue. :)
It seems to me that the netio uses an updated structure of the JSON response which is not compatible with the current exporter version.
It looks like there is no Current
key in the response and the exporter expects it to be there.
Could you please send me the raw json response from the netio? As I don't own this netio I don't have access to the exact json structure. It will allow me to update the exporter so it works with your device :)
You can get the raw json either by using your browser and navigating to http://192.168.0.95/netio.json (and optionally authenticating with your credentials (if you configured them)), or using curl
curl -u username:password http://192.168.0.95/netio.json
(where the -u username:password
is optional - only if you configured username and password)
You can, of course, redact any information you feel are sensitive. Just please keep the structure intact :)
Once I have the JSON, I think I can update the exporter quite quickly.
Thank you very much, Jan
Hi Jan,
Thanks for coming back and supporting the request. Here is the JSON raw as requested: netio.json
Only change made is staring out the SN and MAC.
Hope that works. Please let me know I you need anything else and thanks again.
Thank you very much, this really helps tracking down the issue. According to this json, the netio provides power/consumption data only for the first output. The other outputs are visible in the data, but don't provide any power data. My assumption is that the other outputs were not initialized yet.
I am right to assume that you only ever tried the first output to power anything (server, most likely) and the other outputs were never used? If so, could you please try to connect anything that consumes electricity to one of the other outputs, let it run a short while (so that there are non-zero numbers on consumption) and then send me another data json dump? It would help me to determine how to deal with the outputs that don't report any power data - whether it is safe to assume that those missing numbers are just zeros (because the output was never used)
Thank you for your cooperation :)
Jan
Hi @m1012000, I've finally found the time to look at the issue. It seems, that in the last few years Netio introduced new models and some of them provide only a limited number of metered outputs. One of them is 8QS, which provides consumption data only for the whole device and for the first output port. The rest of the ports are unmetered (mentioned here on page 21 https://www.netio-products.com/files/NETIO-M2M-API-Protocol-JSON.pdf)
That explains the JSON structure.
So to get you going I prepared a 0.1.0-quickfix
version you can start using:
And in the meantime I will be preparing a new release with proper and more robust output handling and input support.
Please try the quickfix version and let me know if it works for you or if I should make any adjustments.
Thank you for the patience and have a great day :)
Jan.
Hi,
I have set up the docker version. Following what is outlined here: https://www.netio-products.com/en/application-notes/an50-prometheus-and-grafana-for-netio-power-data-analysis-and-visualization
Looking in the console for the container it can query the JSON from the PDU but seems to fail after a certain point (I have starred the SN):
172.17.0.1 - - [20/Aug/2024 06:57:24] "GET /metrics HTTP/1.1" 500 59 DEBUG:netio-exporter:Scraping netio at http://192.168.0.95/netio.json DEBUG:netio-exporter:Successfully scraped netio DEBUG:netio-exporter:Processing netio agent info DEBUG:netio-exporter:Agent info metric: Metric(netio_agent, Global info about Netio agent, info, , [Sample(name='netio_agent_info', labels={'model': '8QS', 'version': '4.0.5', 'json_version': '2.5', 'name': 'PowerPDU-0B', 'outputs': '8', 'sn': '****, 'target': 'http://192.168.0.95/netio.json'}, value=1, timestamp=None, exemplar=None)]) DEBUG:netio-exporter:Processing global stats DEBUG:netio-exporter:Processing global metric "Voltage" DEBUG:netio-exporter:Processing global metric "TotalCurrent" DEBUG:netio-exporter:Processing global metric "OverallPowerFactor" DEBUG:netio-exporter:Global metric "TotalPowerFactor" not processed. Either not known or not wanted DEBUG:netio-exporter:Global metric "OverallPhase" not processed. Either not known or not wanted DEBUG:netio-exporter:Global metric "TotalPhase" not processed. Either not known or not wanted DEBUG:netio-exporter:Processing global metric "Frequency" DEBUG:netio-exporter:Processing global metric "TotalEnergy" DEBUG:netio-exporter:Global metric "TotalReverseEnergy" not processed. Either not known or not wanted DEBUG:netio-exporter:Global metric "TotalEnergyNR" not processed. Either not known or not wanted DEBUG:netio-exporter:Global metric "TotalReverseEnergyNR" not processed. Either not known or not wanted DEBUG:netio-exporter:Processing global metric "TotalLoad" DEBUG:netio-exporter:Global metric "EnergyStart" not processed. Either not known or not wanted DEBUG:netio-exporter:Processing individual Netio outputs. DEBUG:netio-exporter:Output metric "ID" not processed. Either not known or not wanted DEBUG:netio-exporter:Output metric "Name" not processed. Either not known or not wanted DEBUG:netio-exporter:Processing "State" output metric. DEBUG:netio-exporter:Output metric "Action" not processed. Either not known or not wanted DEBUG:netio-exporter:Output metric "Delay" not processed. Either not known or not wanted DEBUG:netio-exporter:Processing "Current" output metric. Traceback (most recent call last): File "/usr/local/lib/python3.12/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/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 "/usr/local/lib/python3.12/site-packages/prometheus_client/exposition.py", line 104, in _bake_output output = encoder(registry) ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prometheus_client/openmetrics/exposition.py", line 21, in generate_latest for metric in registry.collect(): File "/usr/local/lib/python3.12/site-packages/prometheus_client/registry.py", line 97, in collect yield from collector.collect() File "/netio/netio-exporter.py", line 296, in collect self.process() File "/netio/netio-exporter.py", line 280, in process self.process_outputs() File "/netio/netio-exporter.py", line 269, in process_outputs value=output[metric_name] metric_metadata.scale