= Server statistics FreeRADIUS collects statistics internally about certain operations it is doing, such as the number of authentication and accounting requests, how many accepts and failures, and server queue lengths. These can be queried by sending a specially-crafted RADIUS `Status-Server` packet to a "status" virtual server. == Configuring the status virtual server The `status` virtual server is present in the default configuration, but needs to be enabled before it can be used. To do this, create a symlink from `sites-enabled/status` to `../sites-available/status`: [source,shell] ---- # cd raddb/sites-enabled # ln -s ../sites-available/status ---- [NOTE] ==== If you are not starting from the default configuration, check that `status_server` is still set to `yes` in `raddb/radiusd.conf` as well. ==== While the default configuration will work for most setups, you may edit the virtual server configuration in `sites-enabled/status`. No major changes are necessary here, though the default secret, `adminsecret`, should be changed. Other possible changes may be the listening IP address and port, and the clients that are allowed to connect. By default, connections are restricted to the local host only. Having enabled and configured the status server, restart FreeRADIUS to make it active. == Querying the server To get the current statistics from the server, send a RADIUS request of type `Status-Server` to the status port. Unless edited above, the request must come from the same server that FreeRADIUS is running on, and be sent to port 18121 with the secret 'adminsecret' . At a minimum, the `FreeRADIUS-Statistics-Type` attribute must be set. For example: $ cat < FreeRADIUS-Statistics-Type = 0x01 > Message-Authenticator = 0x00 > EOF Sent Status-Server Id 145 from 0.0.0.0:b852 to 127.0.0.1:18121 length 62 FreeRADIUS-Statistics-Type = Authentication Message-Authenticator = 0x00 Received Access-Accept Id 145 from 127.0.0.1:46c9 to 127.0.0.1:47186 length 152 FreeRADIUS-Total-Access-Requests = 27 FreeRADIUS-Total-Access-Accepts = 20 FreeRADIUS-Total-Access-Rejects = 1 FreeRADIUS-Total-Access-Challenges = 0 FreeRADIUS-Total-Auth-Responses = 5 FreeRADIUS-Total-Auth-Duplicate-Requests = 0 FreeRADIUS-Total-Auth-Malformed-Requests = 0 FreeRADIUS-Total-Auth-Invalid-Requests = 0 FreeRADIUS-Total-Auth-Dropped-Requests = 0 FreeRADIUS-Total-Auth-Unknown-Types = 0 FreeRADIUS-Total-Auth-Conflicts = 0 The `FreeRADIUS-Statistics-Type` attribute is a bitmask - add together the following numbers to select the statistics required. Some options are mutually exclusive, so it might be necessary to send multiple requests to collect all information. [%header,cols="2,1,1,5"] |=== |Name|Hex value|Decimal value|Description |Authentication |0x01 |1 |Stats about authentications |Accounting |0x02 |2 |Stats about accounting |Proxy Auth |0x04 |4 |Proxied authentication requests |Proxy Accounting |0x08 |8 |Proxied accounting requests |Internal |0x10 |16 |Queue lengths, thread information etc. |Client |0x20 |32 |Statistics about RADIUS clients e.g. defined in `clients.conf` |Server |0x40 |64 |Statistics about server 'listen' sockets e.g. in `sites-enabled/*` |Home Server |0x80 |128 |Statistics about a proxy home servers e.g. in `proxy.conf` |=== == Worked examples To show the statistics available, a few examples follow. === Global server authentications Using `FreeRADIUS-Statistics-Type = 0x01` requests stats about authentications. Because, for example, no "Client" qualifier has been added (`0x20`) the numbers are global to the server. [source,shell] ---- # cat <