Skip to content
Snippets Groups Projects
Commit a1d27aef authored by Nils Schneider's avatar Nils Schneider
Browse files

mesh-batman-adv-core: add clientcount statistics

This adds

  "client" { "total": <int>, "wifi": <int>" }

to statistics.d. "total" will be the number of clients connected.
"wifi" will be the number of clients connected over wifi. I.e. "total"
will always be equal to or greater than "wifi".

The node will not count itself.
parent d90b1d66
No related branches found
No related tags found
No related merge requests found
local list = io.lines("/sys/kernel/debug/batman_adv/bat0/transtable_local")
local count = 0
local wifi = 0
for line in list do
local mac, _, flags, lastseen = line:match("^ %* ([0-9a-f:]+) *(.- )%[(.-)%] +(%d+%.%d+)")
if mac then
if not flags:match('P') then
count = count + 1
if flags:match('W') then
wifi = wifi +1
end
end
end
end
return { total = count
, wifi = wifi
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment