MiguelNdeCarvalho / speedtest-exporter

Speedtest Exporter made in python using the official speedtest bin
https://docs.miguelndecarvalho.pt/projects/speedtest-exporter/
GNU General Public License v3.0
197 stars 56 forks source link

Keep Exporter running ? Manual installation method #208

Open keyoss opened 1 year ago

keyoss commented 1 year ago

Sorry - since i have issues with Docker on my Debian12 - (whenever the docker container for speedtest-exporter is running it takes 10s and the network goes down (like no route to host and such)) i decided to go the "manual" installation way. Which works so far.

The only question left is:

Execute the exporter - python src/exporter.py

how to keep it running? i also changed my Prometheus.yml since as soon as i ctrl+c it will stop the script and i doubt its not python that will start the script every 1hr by the changes in the prometheus.yml

but i wonder how the exporter python script keeps up and running in the background and restarts !?

Yeah, basically a noob here. :)

Thanks for any tips!

bruins0437 commented 8 months ago

Here is an example of how I keep the python script running as a service. `sudo nano /etc/systemd/system/speedtest_exporter.service

[Unit] Description=Speedtest-Exporter service After=multi-user.target [Service] User=prometheus Type=simple Environment=PYTHONUNBUFFERED=1 WorkingDirectory=/etc/prometheus/speedtest-exporter ExecStart=/usr/bin/python3 /etc/prometheus/speedtest-exporter/src/exporter.py ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target

`