I’ve been trying to run meshtastic-prometheus-exporter:2.7 in TCP mode inside Docker and ran into a startup crash that looks like a bug in the current release.
Environment
- Exporter:
ghcr.io/hacktegic/meshtastic-prometheus-exporter:2.7
- Deployment: Docker Compose (using the repo’s
docker-compose.yml as a base)
- Interface:
MESHTASTIC_INTERFACE=TCP
- Meshtastic node: Heltec V4, reachable over TCP at
192.168.27.233:4403
- Host OS: Proxmox VM (Debian/Ubuntu‑like), Docker + docker compose
docker-compose.yml (relevant part)
services:
exporter:
image: ghcr.io/hacktegic/meshtastic-prometheus-exporter:2.7
restart: unless-stopped
environment:
MESHTASTIC_INTERFACE: TCP
INTERFACE_TCP_ADDR: 192.168.27.233
INTERFACE_TCP_PORT: 4403
PROMETHEUS_SERVER_ADDR: 0.0.0.0
PROMETHEUS_SERVER_PORT: 9100
LOG_LEVEL: info
networks:
- mesh-bridge
networks:
mesh-bridge:
driver: bridge
The Meshtastic TCP port is reachable from the host:
nc -vz 192.168.27.233 4403
Connection to 192.168.27.233 4403 port [tcp/*] succeeded!
Inside the container the env looks correct (excerpt):
MESHTASTIC_INTERFACE=TCP
INTERFACE_TCP_ADDR=192.168.27.233
INTERFACE_TCP_PORT=4403
PROMETHEUS_SERVER_ADDR=0.0.0.0
PROMETHEUS_SERVER_PORT=9100
Observed behavior
The container repeatedly restarts with the following log (shortened):
CRITICAL - Exception occurred while starting up:
File `meshtastic_prometheus_exporter/__main__.py`, line 127:
start_http_server(port=config["prometheus_server_port"], addr=config["prometheus_server_addr"])
Deep down in `wsgiref.simple_server` / `socketserver.TCPServer.server_bind` this ends with:
TypeError: 'str' object cannot be interpreted as an integer
Because of this the HTTP server never starts, and the exporter never reaches the point where it connects to the Meshtastic TCP interface.
Code analysis
In __main__.py, configuration is built like this (simplified):
- `prometheus_server_addr` is read from `PROMETHEUS_SERVER_ADDR` (default `"127.0.0.1"`)
- `prometheus_server_port` is read from `PROMETHEUS_SERVER_PORT` (default `"9464"`)
Both are stored in the config dict as strings:
"prometheus_server_port": os.environ.get("PROMETHEUS_SERVER_PORT", "9464")
Later:
start_http_server(
port=config["prometheus_server_port"],
addr=config["prometheus_server_addr"],
)
Since os.environ.get always returns a string, config["prometheus_server_port"] is a string, but start_http_server expects an integer port, which explains the TypeError.
This happens regardless of whether the port is set via Docker env or left as default.
(Separately, TCP address/port are correctly picked up from INTERFACE_TCP_ADDR and INTERFACE_TCP_PORT.)
Expected behavior
- Exporter should start the HTTP server on the configured port (
PROMETHEUS_SERVER_PORT, default 9464) and then connect to the Meshtastic TCP interface.
- Docker deployment with
MESHTASTIC_INTERFACE=TCP and PROMETHEUS_SERVER_PORT=9100 should work out‑of‑the‑box.
Actual behavior
- Exporter crashes on startup due to treating
prometheus_server_port as string instead of integer.
- This makes the official Docker‑based setup unusable in this configuration (at least for TCP, and likely for other interfaces as well) unless the code is patched.
I’ve been trying to run
meshtastic-prometheus-exporter:2.7in TCP mode inside Docker and ran into a startup crash that looks like a bug in the current release.Environment
ghcr.io/hacktegic/meshtastic-prometheus-exporter:2.7docker-compose.ymlas a base)MESHTASTIC_INTERFACE=TCP192.168.27.233:4403docker-compose.yml (relevant part)
The Meshtastic TCP port is reachable from the host:
Inside the container the env looks correct (excerpt):
Observed behavior
The container repeatedly restarts with the following log (shortened):
Because of this the HTTP server never starts, and the exporter never reaches the point where it connects to the Meshtastic TCP interface.
Code analysis
In
__main__.py, configuration is built like this (simplified):Both are stored in the
configdict as strings:"prometheus_server_port": os.environ.get("PROMETHEUS_SERVER_PORT", "9464")Later:
Since
os.environ.getalways returns a string,config["prometheus_server_port"]is a string, butstart_http_serverexpects an integer port, which explains theTypeError.This happens regardless of whether the port is set via Docker env or left as default.
(Separately, TCP address/port are correctly picked up from
INTERFACE_TCP_ADDRandINTERFACE_TCP_PORT.)Expected behavior
PROMETHEUS_SERVER_PORT, default 9464) and then connect to the Meshtastic TCP interface.MESHTASTIC_INTERFACE=TCPandPROMETHEUS_SERVER_PORT=9100should work out‑of‑the‑box.Actual behavior
prometheus_server_portas string instead of integer.