Reporting on active users using radwho
Djerk Geurts
djerk at maizymoo.com
Fri May 13 08:56:06 UTC 2022
> On 12 May 2022, at 12:15, Alan DeKok <aland at deployingradius.com> wrote:
>
> On May 12, 2022, at 7:00 AM, Djerk Geurts via Freeradius-Users <freeradius-users at lists.freeradius.org> wrote:
>> Over the last week, I’ve spent some time getting radsniff telemetry into Grafana via Collectd and Telegraf. Sadly radsniff direct to Telegraf doesn’t work, but that’s another story.
>
> There's also the stats produced by the server. See "radmin stats" for more information. The data is also available via Status-Server packets. See raddb/sites-available/status.
I wasn’t able to figure out how to get the number of active users out of admin stats, but that’s likely me being stupid. I enabled it and played around and quickly figured that a MySQL query to the redact table would be easier.
>
>> Wanting to graph online users I then scripted a rough little bit of bash to take the output of `radwho -r -n` and output the number of active users in influx format to Telegraf. However I’ve noticed that at midnight the reported online users drop to 0 to then slowly ramp up again. This may well be normal behaviour for what I should expect from rad who output, but it’s not what I’d like to see in my graph, it’s worrying to see the number of active xDSL subscribers drop to 0. I’d rather avoid having to state such a caveat.
>>
>> Is there a better way to track active users using the data available from FreeRADIUS server, its tools or directly from the (MySQL) database?
>
> Put accounting data into SQL. Then, count the number of rows which don't have a "stop time".
Accounting was already set up, so all I had to do was to figure out the SQL queries and wrap that in a little code. This works perfect and is quick and reliable.
Initially I had planned to report active users per Radius server, but this detail isn’t in the redacts table and would be unreliable as one server may auth and another may get the acct data. Plus radsniff gives me access requests, rejects and response times per server, so I don’t have a need to replicate this in a report about active subscribers.
@Alan Thank you for your help, much appreciated!
Djerk Geurts
More information about the Freeradius-Users
mailing list