A simple prometheus exporter for reporting data about your current Internet connection, with data from ip-api.com.
Run the following as root, or using sudo as appropriate:
-
Checkout the code:
cd /usr/local/ git clone https://github.com/dpage/myip_exporter.git
-
Create a virtual environment:
cd myip_exporter python3 -m venv venv
-
Install dependencies:
source venv/bin/activate pip install -r requirements.txt
-
Setup and run the service:
cp myip_exporter.service /etc/systemd/system/ systemctl daemon-reload systemctl enable myip_exporter systemctl start myip_exporter
The following environment variables can be set to configure myip_cxporter. Add and Environment= line to the service unit file in the Service section, e.g.
Environment=MYIP_PORT=1234 MYIP_CACHE_TIMEOUT=10
MYIP_PORT: Set the port number to listen on.
MYIP_CACHE_TIMEOUT: Set the timeout for cached data from ip-api.com. This defaults to 5 seconds. Set to 0 to disable caching.