Menu

Realm/NAS accounting not reflecting

Help
2016-07-14
2016-08-01
  • Stephen Buchanan

    I've got RadiusDesk and FreeRADIUS running on a hosted Ubuntu server, and starting to add a few test NAS devices running CoovaChilli which are redirecting to Dynamic Login Pages as expected and authentication apppears to be working perfectly, etc. etc.

    I can see accounting data (graphs) for users on the system, when these users access via on of the NAS devices (via Dynamic Radius Clients). I can see them in the correct Realm. I can even see Activity Monitor logging when they have an active session or not.

    However, no usage data appears for the Realm or the NAS on which that user is connected. 0kb in, 0kb out no matter what.

    Any idea how this is possible, or what I might need to sort out in my configuration to make it work as expected?

     
  • Stephen Buchanan

    Some further clarification, after poking around the database and logging SQL queries...

    It seems that when RadiusDesk is requesting the accounting data for the Realm, it is doing a query like this:

    SELECT sum(`UserStat`.`acctinputoctets`)  as data_in, sum(`UserStat`.`acctoutputoctets`) as data_out, sum(`UserStat`.`acctoutputoctets`)+ sum(UserStat.acctinputoctets) as total FROM `rd`.`user_stats` AS `UserStat`   WHERE `UserStat`.`username` = '37' AND `UserStat`.`realm` = 'Magnesium' AND `UserStat`.`timestamp` >= '2016-07-20 23:00:00' AND `UserStat`.`timestamp` <= '2016-07-20 23:59:59'    LIMIT 1
    

    (The realm name is "Magnesium").

    What I don't understand is the WHERE UserStat.username = 37 part. If left out, this query returns results as expected. But why is it looking for results with a username? Surely that doesn't apply? (I think username 37 is actually the ID of the realm Magnesium in this case, but that doesn't make any sense either.) Help!

     
  • Stephen Buchanan

    And now I fixed it.

    In Controllers/UserStatsController.php, line 213:

    if(($type == 'permanent')||($type == 'voucher')||($type == 'user')||('activity_viewer')){
    

    I changed that to:

    if(($type == 'permanent')||($type == 'voucher')||($type == 'user')) {
    

    Is this a bug? Surely ('activity_viewer') would always evaluate to true no matter what, which is why the query keeps adding the username piece regardless of query type?

     
  • Stephen Buchanan

    Whoo hoo Realms and NAS data now showing up as expected.

    I don't know Sourceforge very well though - how do I submit a ticket (is that like an Issue on Github?) or Pull Request (or whatever is the equivalent in SVN)?

     

    Last edit: Stephen Buchanan 2016-07-20
    • Steven Kusters

      Steven Kusters - 2016-08-01

      Your fix will be checked for compliance and implemented soon!
      Writing the issue here (and even providing a fix) is the correct way to do this

      Thank you for your time and effort

      Steven

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.