Package: linkhub-prometheus-exporter
Linkhub ExporterA Prometheus exporter for Alcatel Linkhub boxes.Tested with an Alcatel HH41 4G LTE hotspot WiFi router.UsageInstall Poetry for you system (need>=1.2.0b1currently if using
the dynamic versioning, and have to add the relevant plugin withpoetry plugin add poetry-dynamic-versioning-plugin). Then install the
package with:poetryinstallYou'll need a Request Key to run exporter, which is derived from the
login password of router box admin interface. See below how to
obtain it.Once you have a key, you can set it in multiple ways:In.secrets.toml, see the template shipped atsecrets.toml.templatefor the format (note the.for the non-template filename), ORSet an environment variableLINKHUB_REQUEST_KEYwith the value, e.g.export LINKHUB_REQUEST_KEY=...in your shell where...is replaced with
the actual value.Then start up the exporter:poetryrunexporterRunning in DockerBuild the image with the included Dockerfile from the cloned repository,
let's say:dockerbuild-tlinkhub_exporterand then run the resulting image as:dockerrun-ti--rm-e"LINKHUB_REQUEST_KEY=...."-p9877:9877linkhub_exporterwhich exposes the Prometheus metrics onhttp://localhost:9877. Don't forget
to set theLINKHUB_REQUEST_KEYvalue, or add it in an.envfile and
run things as:dockerrun-ti--rm--env-file.env-p9877:9877linkhub_exporterRunning in Docker ComposeYou can add this exporter as a container in yourdocker-compose.yml, along
similar lines (other container configuration has been snip'd):linkhub:image:imrehg/linkhub_prometheus_exporterrestart:alwaysports:-"9877:9877"environment:-LINKHUB_EXPORTER_ADDRESS='0.0.0.0'env_file:-.envTheLINKHUB_REQUEST_KEYvalue should be set in the.envfile (or wherever
you will keep the configuration for this particular service). You can comment
out theportssection if you don't want to view the results outside of the
docker compose run services. You might want to addnetworkfield if you
are running things within a custom network.Finally, you probably want to set an explicit tag for the image value.Setting up task in PrometheusThe setup in Prometheus is pretty straightforward, using the relevant IP/port
combo. If the server is run manually or through Docker on its own, use the machine's
IP that's running it, and the port that is set in the config. If docker compose
is used, the can use the service name to connect to it automatically, say like this:-job_name:'linkhub'scrape_interval:5sstatic_configs:-targets:['linkhub:9877'](The other parts of the Prometheus configuration are omitted.)Getting the request keyCurrently the easiest way to get it is to:Open a browser  and navigate to your router admin interfaceOpen the debug console, and ensure that network requests are logged thereLog in to the admin interfaceCheck requests going towebapi, look for the requests headers, and the
value of the_TclRequestVerificationKeyis what you should use for the
request key setting of this exporter.Showing the metrics in GrafanaAnexample Grafana dashboardsetup is provided in theextrafolder.LicenseCopyright 2022 Gergely Imrehgergely@imreh.netLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.