tncexporter icon indicating copy to clipboard operation
tncexporter copied to clipboard

Systemd

Open wolfman2g1 opened this issue 3 years ago • 4 comments

I'm having an issue running this with systemd. do you have an example you can share?

wolfman2g1 avatar Dec 13 '22 22:12 wolfman2g1

I haven't configured an instance of this with systemd, so unfortunately I can't help you at present. I will leave this issue open though, as it would be nice to have a working example. If you can update with specific details of your issue and any resolution, that may help someone!

rouyng avatar Dec 16 '22 18:12 rouyng

Just set this up on a pi as a systemd service, here's my setup:

Download and Install

git clone https://github.com/rouyng/tncexporter
cd tncexporter
pip3 install -r requirements.txt

Create Systemd Service

sudo nano /etc/systemd/system/tncexporter.service
[Unit]
Description=TNC Exporter       
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=pi
WorkingDirectory=/home/pi/tncexporter
ExecStart=/usr/bin/env python3 -m tncexporter --latitude xx --longitude xx

[Install]
WantedBy=multi-user.target

NOTE 1: replace --latitude xx --longitude xx with your own values for distance metrics to work. NOTE 2: set User and WorkingDirectory to your values. User is important for python deps to load.

Enable and Start Service

sudo systemctl enable tncexporter.service
sudo systemctl start tncexporter.service
sudo systemctl status tncexporter.service

Metrics should now be available at: http://127.0.0.1:9110/metrics

liamcottle avatar Jul 27 '23 14:07 liamcottle

Just set this up on a pi as a systemd service, here's my setup:

Download and Install

git clone https://github.com/rouyng/tncexporter
cd tncexporter
pip3 install -r requirements.txt

Create Systemd Service

sudo nano /etc/systemd/system/tncexporter.service
[Unit]
Description=TNC Exporter       
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=pi
WorkingDirectory=/home/pi/tncexporter
ExecStart=/usr/bin/env python3 -m tncexporter --latitude xx --longitude xx

[Install]
WantedBy=multi-user.target

NOTE 1: replace --latitude xx --longitude xx with your own values for distance metrics to work. NOTE 2: set User and WorkingDirectory to your values. User is important for python deps to load.

Enable and Start Service

sudo systemctl enable tncexporter.service
sudo systemctl start tncexporter.service
sudo systemctl status tncexporter.service

Metrics should now be available at: http://127.0.0.1:9110/metrics

Hi Liam, Do you mind if I incorporate your instructions here into the project documentation? Thanks Ross

rouyng avatar Dec 28 '23 17:12 rouyng

Sounds good to me 😃 thanks!

liamcottle avatar Dec 28 '23 21:12 liamcottle