bairhys / prometheus-frigate-exporter

A Prometheus exporter for Frigate stats
MIT License
33 stars 4 forks source link

Default exporter port change option #5

Closed PovilasID closed 9 months ago

PovilasID commented 9 months ago

Hey,

I run a lot of monitoring on the same remote server, so with VPN config and all that fun I needed to change the default exporter's port. This change allows you to set the internal exporter's port using environmental variable PORT. If nothing is defined it falls back to 9100.

bairhys commented 9 months ago

Probably don't need to do this as Docker allows users to define ports when starting a container with -p 4321:9100:

docker run \
    -d \
    --restart unless-stopped \
    -p 4321:9100 \
    -e "FRIGATE_STATS_URL=http://<your-frigate-ip>:5000/api/stats" \
    --name prometheus_frigate_exporter \
    rhysbailey/prometheus-frigate-exporter
PovilasID commented 9 months ago

TL;DR Please use less common port as default or allow users to set a custom one.

Oh I am fully aware of that docker allows you to remap external ports to host, however since I am monitoring a remote server I have a VPN docker container 'wireguard-N1' that has access to N1 server's network without exposing it to my monitoring host, that can then connect to N2, N3... and so on using pretty much same exporter's configuration without risk of port collision. This has downside that exporters have to use network_mode: service:wiregurard-n1 meaning I can not take advantage of using external port remapping and if multiple exporters use same port I get collisions.