Track download/upload usage for a specific WiFi SSID only.
Perfect for shared environments where you pay per megabyte.
Clone the repo and run the auto‑installer:
git clone https://github.com/your-username/metered-wifi.git
cd metered-wifi
sudo ./scripts/setup.sh
The installer will ask for the SSID you want to track, detect your wireless interface, and set up everything automatically.
Usage
After installation, connect to your target WiFi network. The following commands become available:
metered-total.sh – total usage so far (download / upload / total)
show-metered.sh – live updating dashboard (1s refresh)
usage-between.sh '2026-05-09 12:45:00' '2026-05-09 12:47:00' – usage in a specific time range
All data is stored in /var/lib/metered/ and survives reboots (syncs every 30 seconds).
How It Works
Uses iptables counters that are enabled only when connected to the chosen SSID.
NetworkManager dispatcher adds/removes the counting rules automatically.
A background timer persists the counters to disk every 30 seconds, so power loss loses at most 30s of traffic.
Customisation
To change the tracked SSID later, edit /usr/local/bin/metered-wifi.sh and restart the dispatcher:
bash
sudo systemctl restart NetworkManager-dispatcher
Developed by amirpeyravan