Prometheus exporter for MeshCore repeaters, read over the mesh: a companion (USB, BLE, or a companion identity in openHop over TCP) logs in to each repeater, asks for status and telemetry with direct packets and serves battery, temperature/humidity, noise floor, RSSI/SNR, packet counters, airtime and uptime on :9200/metrics. - meshcore_exporter.py: command line, MC_* environment or a TOML file with a password per repeater; --check reads every repeater once and exits; interval 1 h (min 15 min); a failed repeater is retried once after 3 min; contacts fetched once per round. - dashboards/: the Grafana dashboard, generated from generate.py (datasource, job and the rate window are variables; TX drawn above zero, RX below). - stack/: Docker Compose with Prometheus and Grafana provisioned, for a USB companion, or on the host network for openHop on the same machine. - systemd/: running without Docker. - README.md (Czech) and AGENTS.md for setting it up with an AI agent. - CI: lint and tests, gitleaks; PR check builds the image; single-platform images per architecture behind a Trivy gate (latest-<arch>, and X.Y.Z-<arch> with a release on tag vX.Y.Z); dependencies by Renovate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.1 KiB
Docker
27 lines
1.1 KiB
Docker
FROM python:3.15-slim@sha256:8c13a3f37a6a5b71498228e902c4b9f51c1f7900d49fabf71f9a650c6120e0d0
|
|
|
|
# Re-runs the security-update layer once a day despite the layer cache (CI
|
|
# passes the date).
|
|
ARG OS_UPDATES=none
|
|
RUN apt-get update && apt-get -y upgrade && rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt .
|
|
# pip is not needed at runtime and vendors its own urllib3, msgpack and
|
|
# pkg_resources, which the Trivy gate flags whenever they lag behind: install,
|
|
# then remove pip and the ensurepip wheel.
|
|
RUN pip install --no-cache-dir -r requirements.txt \
|
|
&& pip uninstall -y pip \
|
|
&& rm -rf /usr/local/lib/python3*/ensurepip
|
|
COPY meshcore_exporter.py .
|
|
|
|
# The serial port belongs to group dialout (20) on most hosts; compose adds
|
|
# the group with `group_add` when it differs.
|
|
RUN useradd --system --uid 10001 --gid 20 --no-create-home exporter
|
|
USER exporter
|
|
|
|
EXPOSE 9200
|
|
HEALTHCHECK --interval=60s --timeout=5s --start-period=30s \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:9200/metrics', timeout=4)"
|
|
ENTRYPOINT ["python", "/app/meshcore_exporter.py"]
|