Guys, I found the right code from the Daloradius /sql/counter.conf. In all my googling I have not seen it like this…
I found it a little tough when the wiki and Github show code that does not work for a daily-max-session… I guess there is a reason but loads of the examples out there simply don’t work unless the radacct table is already populated, cheers.
sqlcounter dailycounter {
counter-name = Daily-Session-Time
check-name = Max-Daily-Session
reply-name = Session-Timeout
sqlmod-inst = sql
key = User-Name
reset = daily
query = "SELECT IFNULL(SUM(acctsessiontime - \
GREATEST((%b - UNIX_TIMESTAMP(acctstarttime)), 0)),0) \
FROM radacct WHERE username = '%{%k}' AND \
UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%b'"
Regards
Jim