summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2022-06-21 21:00:55 -0600
committerAaron Ball <nullspoon@oper.io>2022-06-21 21:00:55 -0600
commit14269261189b2c45addf0c67daf4b0ca52c7b381 (patch)
treef564e15cb15eecf7212ca45692a081af33fd0edf
parente3eadc3a5b85b3c97b7ff5504808ef73ea1c7e2a (diff)
downloadcmon-14269261189b2c45addf0c67daf4b0ca52c7b381.tar.gz
cmon-14269261189b2c45addf0c67daf4b0ca52c7b381.tar.xz
Support overriding net device name
The default net device was `wlan0`, and it was not previously overrideable. Now it can be overridden by the `CMON_NETDEV` environment variable.
-rw-r--r--src/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index cf31530..42d2b5e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,8 +52,11 @@ int main(int argc, char* argv[]) {
status.nprocs = get_nprocs();
// Store number of processors to make load values more useful
- status.nettx = net_x_bytes("wlan0", 't');
- status.netrx = net_x_bytes("wlan0", 'r');
+ char* netdev = "wlan0";
+ if(getenv("CMON_NETDEV") != NULL)
+ netdev = getenv("CMON_NETDEV");
+ status.nettx = net_x_bytes(netdev, 't');
+ status.netrx = net_x_bytes(netdev, 'r');
// Store uptime
status.uptime = proc_uptime();

Generated by cgit