May 16 2009
Graph Number of Freeradius Sessions in MRTG
You can easily graph your Freeradius number of active sessions with a simple shell script if you store accounting data in a SQL database.
Use the script below for Mysql:
#!/bin/bash
SQL_USERNAME=radius_username
SQL_DATABASE=radius
SQL_PASSWORD=your_password
SQL_SERVER=127.0.0.1
SQL_ACCOUNTING_TABLE=radacct
BACK_DAYS=5
SESSIONS=`mysql -BN -u$SQL_USERNAME -p$SQL_PASSWORD -h $SQL_SERVER $SQL_DATABASE -e \
“SELECT COUNT(*) FROM $SQL_ACCOUNTING_TABLE \
WHERE acctstoptime IS NULL \
AND Acctstarttime > NOW() – [...]

