mbugert / connectbox-prometheus Goto Github PK
View Code? Open in Web Editor NEWPrometheus exporter for Compal CH7465LG cable modems, commonly sold as "Connect Box"
License: Apache License 2.0
Prometheus exporter for Compal CH7465LG cable modems, commonly sold as "Connect Box"
License: Apache License 2.0
See #16 (comment)
Exception occurred during processing of request from ('172.17.0.1', 58136)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 438, in _error_catcher
yield
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File "/usr/local/lib/python3.9/http/client.py", line 458, in read
n = self.readinto(b)
File "/usr/local/lib/python3.9/http/client.py", line 502, in readinto
n = self.fp.readinto(b)
File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 753, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 576, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/local/lib/python3.9/contextlib.py", line 135, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 443, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.0.1', port=80): Read timed out.
During handling of the above exception, another exception occurred:
2021-03-25 01:13:53,481 - connectbox_exporter - ERROR - ReadTimeout(ReadTimeoutError("HTTPConnectionPool(host='192.168.0.1', port=80): Read timed out. (read timeout=9)"))
Tracked by ties/compal_CH7465LG_py#25
python 3.10 (and latest security updates for the other releases) change the parse_qs
parsing behavior which breaks the compal library. Since the docker image tracks the latest python release this means the docker build is currently broken.
A temporary fix would be to pin the docker image to 3.9.1-alpine
where it will still work until the library can be updated.
I was wondering if this project supports TLS/Auth out of the box. For my use case, I was planning on running Prometheus remotely while having this exporter run locally on a Raspberry Pi. I've got no experience yet with Prometheus, but as far as I can see this tool exposes modem metrics via an unsecured and open API, which I think might be a bit risky. Older firmware versions had some exploits available, and metrics like uptime/temperature gives access to more intelligence about your household to potential attackers.
My Compal CH7465LG is in bridge-modus, maybe that might explain te error listed below?
Exception happened during processing of request from ('127.0.0.1', 35354)
ValueError: 'Modem Mode' is not a valid ProvisioningStatus
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/connectbox_exporter/xml2metric.py", line 357, in extract
enum_provisioning_status = ProvisioningStatus(provisioning_status)
File "/usr/lib/python3.7/enum.py", line 310, in __call__
return cls.__new__(cls, value)
File "/usr/lib/python3.7/enum.py", line 564, in __new__
raise exc
File "/usr/lib/python3.7/enum.py", line 548, in __new__
result = cls._missing_(value)
File "/usr/lib/python3.7/enum.py", line 577, in _missing_
raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'Modem Mode' is not a valid ProvisioningStatus
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
self.handle()
File "/usr/lib/python3.7/http/server.py", line 426, in handle
self.handle_one_request()
File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
method()
File "/usr/local/lib/python3.7/dist-packages/prometheus_client/exposition.py", line 152, in do_GET
output = encoder(registry)
File "/usr/local/lib/python3.7/dist-packages/prometheus_client/exposition.py", line 90, in generate_latest
for metric in registry.collect():
File "/usr/local/lib/python3.7/dist-packages/prometheus_client/registry.py", line 75, in collect
for metric in collector.collect():
File "/usr/local/lib/python3.7/dist-packages/connectbox_exporter/connectbox_exporter.py", line 79, in collect
yield from extractor.extract(raw_xmls)
File "/usr/local/lib/python3.7/dist-packages/connectbox_exporter/xml2metric.py", line 360, in extract
f"Unknown provisioning status '{provisioning_status}'. Please open an issue on Github."
ValueError: Unknown provisioning status 'Modem Mode'. Please open an issue on Github.
Manually workaround by editing line 302 of xml2metric.py: ONLINE = "Modem Mode"
I am getting constantly this error, not sure if you are still supporting this, but my modem is exactly the same except it was UPC branded now Vodafone, it reads as CH7465VF. It is asking username on the web UI and default is admin, cannot be changed. I am not sure where else I can look to modify something to make it work with my modem. could you please help? Thanks
Hi,
I get only these data:
connectbox_device_info{cable_modem_status="Operational",cm_provision_mode="IPv4",docsis_mode="DOCSIS 3.0",firmware_version="CH7465LG-NCIP-6.12.18.25-2p6-NOSH",gw_provision_mode="IPv4",hardware_version="5.01",operator_id="LIBERTYGLOBAL"} 1.0
connectbox_provisioning_status{connectbox_provisioning_status="Online"} 1.0
connectbox_provisioning_status{connectbox_provisioning_status="Partial Service (DS only)"} 0.0
connectbox_provisioning_status{connectbox_provisioning_status="Partial Service (US only)"} 0.0
connectbox_provisioning_status{connectbox_provisioning_status="Partial Service (US+DS)"} 0.0
connectbox_uptime_seconds_total 118093.0
connectbox_tuner_temperature_celsius 26.666666666666668
connectbox_temperature_celsius 16.666666666666668
connectbox_scrape_success 0.0
At log i get:
2020-04-15 22:19:59,466 - connectbox_exporter - DEBUG - Logging in at 192.168.0.1
DEBUG:connectbox_exporter:Logging in at 192.168.0.1
INFO:compal:302 [http://192.168.0.1/] => '../common_page/login.html' [token: 1203887360]
INFO:compal:[login] SID 2710463232
2020-04-15 22:20:00,901 - connectbox_exporter - DEBUG - Querying fun=1...
DEBUG:connectbox_exporter:Querying fun=1...
2020-04-15 22:20:01,591 - connectbox_exporter - DEBUG - Querying fun=2...
DEBUG:connectbox_exporter:Querying fun=2...
2020-04-15 22:20:02,050 - connectbox_exporter - DEBUG - Querying fun=144...
DEBUG:connectbox_exporter:Querying fun=144...
2020-04-15 22:20:02,561 - connectbox_exporter - DEBUG - Querying fun=136...
DEBUG:connectbox_exporter:Querying fun=136...
2020-04-15 22:20:03,045 - connectbox_exporter - DEBUG - Querying fun=123...
DEBUG:connectbox_exporter:Querying fun=123...
2020-04-15 22:20:04,624 - connectbox_exporter - ERROR - 'NoneType' object has no attribute 'text'
ERROR:connectbox_exporter:'NoneType' object has no attribute 'text'
2020-04-15 22:20:04,625 - connectbox_exporter - DEBUG - Logging out.
DEBUG:connectbox_exporter:Logging out.
I live in Poland and I use Compal CH7465LG cable modem from UPC.
Hi Michael! Would love to have your contact info -- can I have your email or can you email me at [email protected]?
Exception happened during processing of request from
Traceback (most recent call last):
File "/usr/lib/python3.7/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.7/socketserver.py", line 720, in init
self.handle()
File "/usr/lib/python3.7/http/server.py", line 426, in handle
self.handle_one_request()
File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
method()
File "/usr/local/lib/python3.7/dist-packages/prometheus_client/exposition.py", line 175, in do_GET
self.wfile.write(output)
File "/usr/lib/python3.7/socketserver.py", line 799, in write
self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe
When connecting to the Arris Connectbox the following error occurs in the Docker Container of Connectbox-Prometheus. See the error below:
Exception happened during processing of request from ('172.17.0.1', 41560)
Traceback (most recent call last):
File "/usr/local/lib/python3.8/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python3.8/socketserver.py", line 720, in __init__
self.handle()
File "/usr/local/lib/python3.8/http/server.py", line 427, in handle
self.handle_one_request()
File "/usr/local/lib/python3.8/http/server.py", line 415, in handle_one_request
�
method()
File "/usr/local/lib/python3.8/site-packages/prometheus_client/exposition.py", line 152, in do_GET
output = encoder(registry)
File "/usr/local/lib/python3.8/site-packages/prometheus_client/openmetrics/exposition.py", line 14, in generate_latest
for metric in registry.collect():
File "/usr/local/lib/python3.8/site-packages/prometheus_client/registry.py", line 75, in collect
for metric in collector.collect():
File "/usr/local/lib/python3.8/site-packages/connectbox_prometheus-0.2.6-py3.8.egg/connectbox_exporter/connectbox_exporter.py", line 58, in collect
connectbox.login()
File "/usr/local/lib/python3.8/site-packages/compal/__init__.py", line 202, in login
if res.headers["Location"].endswith("common_page/Access-denied.html"):
File "/usr/local/lib/python3.8/site-packages/requests/structures.py", line 54, in __getitem__
return self._store[key.lower()][1]
KeyError: 'location'
----------------------------------------
ERROR:compal:Was not redirected to login page: concurrent session?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.