accounting data
Dirk van der Walt
dirkvanderwalt at gmail.com
Mon Nov 12 08:29:50 CET 2012
Hi,
I've done the same exercise on my side and have the following
observations based on the debug output.
1.)The rlm_counter is only interested in Accounting Stop packets.
2.)If I send two subsequent Accounting Stop requests using the
radclient and the file with the Accounting Stop AVP bundles, only the
first one is used and the second one is ignored due to the fact that
the packet with the unique ID is already recorded in the database and
thus ignored:
rlm_counter: Packet Unique ID = '9c5a417fc48a9b9e'
rlm_counter: Searching the database for key 'aclice'
rlm_counter: Key found.
rlm_counter: Counter Unique ID = '8d3af3931deff832'
rlm_counter: Unique IDs for user match. Droping the request.
The Packet Unique ID is created by the acct_unique module in the
preacct section:
[acct_unique] WARNING: Attribute NAS-Identifier was not found in
request, unique ID MAY be inconsistent
[acct_unique] Hashing 'NAS-Port = 0,,NAS-IP-Address =
127.0.0.1,Acct-Session-Id = "4D2BB8AC-00000099",User-Name = "alice"'
[acct_unique] Acct-Unique-Session-ID = "9c5a417fc48a9b9e".
++[acct_unique] returns ok
This is covered in the pre-accounting section on page 133.
Since this is a simulation, in the real world the next packet will
have a different value for Acct-Session-Id. So by simply changing the
value of Acct-Session-Id to 4D2BB8AC-00000099 in these files
containing the AVP bundles and running the session simulation again
you can see the following:
rlm_counter: Packet Unique ID = '56a4675037d8b965'
rlm_counter: Searching the database for key 'aclice'
rlm_counter: Key found.
rlm_counter: Counter Unique ID = '8d3af3931deff832'
rlm_counter: User=aclice, Counter=30.
rlm_counter: User=aclice, New Counter=60.
rlm_counter: Storing new value in database.
rlm_counter: New value stored successfully.
++[daily] returns ok
So the important thing to remember if you want simulate a user's
session is that the value of Acc-Session-Id needs to be unique for
every simulated session. A session simulation will consist of an
Accounting Start and Stop request (and also may include optional
Accounting Interim-Update requests).
With that in mind, refer again to the description of Acct-Session-Id
on page 131.
Although rlm_counter is primarily used as an introduction here to
better understand the counter modules, the next section covers the
rlm_sqlcounter module. This module is more flexible and preferred.
Hope this helps you.
More information about the Freeradius-Users
mailing list