Debian Codegraph @

doc/antora/modules/howto/pages/monitoring/statistics.adoc

raw
1 = Server statistics
2
3 FreeRADIUS collects statistics internally about certain operations
4 it is doing, such as the number of authentication and accounting
5 requests, how many accepts and failures, and server queue lengths.
6 These can be queried by sending a specially-crafted RADIUS
7 `Status-Server` packet to a "status" virtual server.
8
9 == Configuring the status virtual server
10
11 The `status` virtual server is present in the default
12 configuration, but needs to be enabled before it can be used. To
13 do this, create a symlink from `sites-enabled/status` to
14 `../sites-available/status`:
15
16 [source,shell]
17 ----
18 # cd raddb/sites-enabled
19 # ln -s ../sites-available/status
20 ----
21
22 [NOTE]
23 ====
24 If you are not starting from the default configuration, check that
25 `status_server` is still set to `yes` in `raddb/radiusd.conf` as
26 well.
27 ====
28
29 While the default configuration will work for most setups, you may
30 edit the virtual server configuration in `sites-enabled/status`.
31 No major changes are necessary here, though the default secret,
32 `adminsecret`, should be changed. Other possible changes may be
33 the listening IP address and port, and the clients that are
34 allowed to connect. By default, connections are restricted to the
35 local host only.
36
37 Having enabled and configured the status server, restart
38 FreeRADIUS to make it active.
39
40 == Querying the server
41
42 To get the current statistics from the server, send a RADIUS
43 request of type `Status-Server` to the status port. Unless edited
44 above, the request must come from the same server that FreeRADIUS
45 is running on, and be sent to port 18121 with the secret
46 'adminsecret' . At a minimum, the `FreeRADIUS-Statistics-Type`
47 attribute must be set. For example:
48
49 $ cat <<EOF | radclient -x localhost:18121 status adminsecret
50 > FreeRADIUS-Statistics-Type = 0x01
51 > Message-Authenticator = 0x00
52 > EOF
53 Sent Status-Server Id 145 from 0.0.0.0:b852 to 127.0.0.1:18121 length 62
54 FreeRADIUS-Statistics-Type = Authentication
55 Message-Authenticator = 0x00
56 Received Access-Accept Id 145 from 127.0.0.1:46c9 to 127.0.0.1:47186 length 152
57 FreeRADIUS-Total-Access-Requests = 27
58 FreeRADIUS-Total-Access-Accepts = 20
59 FreeRADIUS-Total-Access-Rejects = 1
60 FreeRADIUS-Total-Access-Challenges = 0
61 FreeRADIUS-Total-Auth-Responses = 5
62 FreeRADIUS-Total-Auth-Duplicate-Requests = 0
63 FreeRADIUS-Total-Auth-Malformed-Requests = 0
64 FreeRADIUS-Total-Auth-Invalid-Requests = 0
65 FreeRADIUS-Total-Auth-Dropped-Requests = 0
66 FreeRADIUS-Total-Auth-Unknown-Types = 0
67 FreeRADIUS-Total-Auth-Conflicts = 0
68
69 The `FreeRADIUS-Statistics-Type` attribute is a bitmask - add
70 together the following numbers to select the statistics required.
71 Some options are mutually exclusive, so it might be necessary to
72 send multiple requests to collect all information.
73
74 [%header,cols="2,1,1,5"]
75 |===
76 |Name|Hex value|Decimal value|Description
77
78 |Authentication
79 |0x01
80 |1
81 |Stats about authentications
82
83 |Accounting
84 |0x02
85 |2
86 |Stats about accounting
87
88 |Proxy Auth
89 |0x04
90 |4
91 |Proxied authentication requests
92
93 |Proxy Accounting
94 |0x08
95 |8
96 |Proxied accounting requests
97
98 |Internal
99 |0x10
100 |16
101 |Queue lengths, thread information etc.
102
103 |Client
104 |0x20
105 |32
106 |Statistics about RADIUS clients e.g. defined in `clients.conf`
107
108 |Server
109 |0x40
110 |64
111 |Statistics about server 'listen' sockets e.g. in `sites-enabled/*`
112
113 |Home Server
114 |0x80
115 |128
116 |Statistics about a proxy home servers e.g. in `proxy.conf`
117 |===
118
119 == Worked examples
120
121 To show the statistics available, a few examples follow.
122
123 === Global server authentications
124
125 Using `FreeRADIUS-Statistics-Type = 0x01` requests stats about
126 authentications. Because, for example, no "Client" qualifier has
127 been added (`0x20`) the numbers are global to the server.
128
129 [source,shell]
130 ----
131 # cat <<EOF | radclient -x localhost:18121 status adminsecret
132 FreeRADIUS-Statistics-Type = 0x01
133 Message-Authenticator=0x00
134 EOF
135 Sent Status-Server Id 90 from 0.0.0.0:e008 to 127.0.0.1:18121 length 50
136 FreeRADIUS-Statistics-Type = Authentication
137 Message-Authenticator = 0x00
138 Received Access-Accept Id 90 from 127.0.0.1:46c9 to 127.0.0.1:57352 length 152
139 FreeRADIUS-Total-Access-Requests = 133
140 FreeRADIUS-Total-Access-Accepts = 114
141 FreeRADIUS-Total-Access-Rejects = 13
142 FreeRADIUS-Total-Access-Challenges = 0
143 FreeRADIUS-Total-Auth-Responses = 127
144 FreeRADIUS-Total-Auth-Duplicate-Requests = 0
145 FreeRADIUS-Total-Auth-Malformed-Requests = 0
146 FreeRADIUS-Total-Auth-Invalid-Requests = 0
147 FreeRADIUS-Total-Auth-Dropped-Requests = 0
148 FreeRADIUS-Total-Auth-Unknown-Types = 0
149 FreeRADIUS-Total-Auth-Conflicts = 0
150 ----
151
152 === Global server authentication and accounting requests
153
154 Sending `0x01` requests authentication statistics, and `0x02`
155 requests accounting stats. To get both in one result, add them
156 together, so we requst `0x03`. In this example we send decimal
157 rather than hexadecimal.
158
159 [source,shell]
160 ----
161 # cat <<EOF | radclient -x localhost:18121 status adminsecret
162 FreeRADIUS-Statistics-Type = 3
163 Message-Authenticator=0x00
164 EOF
165 Sent Status-Server Id 216 from 0.0.0.0:ce7b to 127.0.0.1:18121 length 50
166 FreeRADIUS-Statistics-Type = Auth-Acct
167 Message-Authenticator = 0x00
168 Received Access-Accept Id 216 from 127.0.0.1:46c9 to 127.0.0.1:52859 length 248
169 FreeRADIUS-Total-Access-Requests = 542
170 FreeRADIUS-Total-Access-Accepts = 451
171 FreeRADIUS-Total-Access-Rejects = 81
172 FreeRADIUS-Total-Access-Challenges = 0
173 FreeRADIUS-Total-Auth-Responses = 532
174 FreeRADIUS-Total-Auth-Duplicate-Requests = 0
175 FreeRADIUS-Total-Auth-Malformed-Requests = 0
176 FreeRADIUS-Total-Auth-Invalid-Requests = 0
177 FreeRADIUS-Total-Auth-Dropped-Requests = 0
178 FreeRADIUS-Total-Auth-Unknown-Types = 0
179 FreeRADIUS-Total-Auth-Conflicts = 0
180 FreeRADIUS-Total-Accounting-Requests = 0
181 FreeRADIUS-Total-Accounting-Responses = 0
182 FreeRADIUS-Total-Acct-Duplicate-Requests = 0
183 FreeRADIUS-Total-Acct-Malformed-Requests = 0
184 FreeRADIUS-Total-Acct-Invalid-Requests = 0
185 FreeRADIUS-Total-Acct-Dropped-Requests = 0
186 FreeRADIUS-Total-Acct-Unknown-Types = 0
187 FreeRADIUS-Total-Acct-Conflicts = 0
188 ----
189
190 === Internal server stats
191
192 The value `0x10` requests information about the server such as queue
193 lengths and thread state.
194
195 [source,shell]
196 ----
197 # cat <<EOF | radclient -x localhost:18121 status adminsecret
198 FreeRADIUS-Statistics-Type = 0x10
199 Message-Authenticator=0x00
200 EOF
201 Sent Status-Server Id 158 from 0.0.0.0:a090 to 127.0.0.1:18121 length 50
202 FreeRADIUS-Statistics-Type = Internal
203 Message-Authenticator = 0x00
204 Received Access-Accept Id 158 from 127.0.0.1:46c9 to 127.0.0.1:41104 length 164
205 FreeRADIUS-Stats-Start-Time = "Aug 3 2023 13:36:24 UTC"
206 FreeRADIUS-Stats-HUP-Time = "Aug 3 2023 13:36:24 UTC"
207 FreeRADIUS-Queue-Len-Internal = 0
208 FreeRADIUS-Queue-Len-Proxy = 0
209 FreeRADIUS-Queue-Len-Auth = 0
210 FreeRADIUS-Queue-Len-Acct = 0
211 FreeRADIUS-Queue-Len-Detail = 0
212 FreeRADIUS-Queue-PPS-In = 0
213 FreeRADIUS-Queue-PPS-Out = 0
214 FreeRADIUS-Stats-Threads-Active = 0
215 FreeRADIUS-Stats-Threads-Total = 0
216 FreeRADIUS-Stats-Threads-Max = 0
217 ----
218
219 === Complete global server information
220
221 A useful common request is all information about the server on a
222 global basis: internal stats (16 / `0x10`) plus authentications (1
223 / `0x01`), accounting (2 / `0x02`), proxy authentications (4 /
224 `0x04`) and proxy accounting (8 / `0x08`). The value `All` is
225 defined in the dictionary as `0x1f` (decimal 31) to cover
226 this common eventuality, and is what we demonstrate here.
227
228 [source,shell]
229 ----
230 # cat <<EOF | radclient -x localhost:18121 status adminsecret
231 FreeRADIUS-Statistics-Type = All
232 Message-Authenticator=0x00
233 EOF
234 Sent Status-Server Id 4 from 0.0.0.0:9ee4 to 127.0.0.1:18121 length 50
235 FreeRADIUS-Statistics-Type = All
236 Message-Authenticator = 0x00
237 Received Access-Accept Id 4 from 127.0.0.1:46c9 to 127.0.0.1:40676 length 596
238 FreeRADIUS-Total-Access-Requests = 792
239 FreeRADIUS-Total-Access-Accepts = 659
240 FreeRADIUS-Total-Access-Rejects = 122
241 FreeRADIUS-Total-Access-Challenges = 0
242 FreeRADIUS-Total-Auth-Responses = 781
243 FreeRADIUS-Total-Auth-Duplicate-Requests = 0
244 FreeRADIUS-Total-Auth-Malformed-Requests = 0
245 FreeRADIUS-Total-Auth-Invalid-Requests = 0
246 FreeRADIUS-Total-Auth-Dropped-Requests = 0
247 FreeRADIUS-Total-Auth-Unknown-Types = 0
248 FreeRADIUS-Total-Auth-Conflicts = 0
249 FreeRADIUS-Total-Accounting-Requests = 0
250 FreeRADIUS-Total-Accounting-Responses = 0
251 FreeRADIUS-Total-Acct-Duplicate-Requests = 0
252 FreeRADIUS-Total-Acct-Malformed-Requests = 0
253 FreeRADIUS-Total-Acct-Invalid-Requests = 0
254 FreeRADIUS-Total-Acct-Dropped-Requests = 0
255 FreeRADIUS-Total-Acct-Unknown-Types = 0
256 FreeRADIUS-Total-Acct-Conflicts = 0
257 FreeRADIUS-Total-Proxy-Access-Requests = 0
258 FreeRADIUS-Total-Proxy-Access-Accepts = 0
259 FreeRADIUS-Total-Proxy-Access-Rejects = 0
260 FreeRADIUS-Total-Proxy-Access-Challenges = 0
261 FreeRADIUS-Total-Proxy-Auth-Responses = 0
262 FreeRADIUS-Total-Proxy-Auth-Duplicate-Requests = 0
263 FreeRADIUS-Total-Proxy-Auth-Malformed-Requests = 0
264 FreeRADIUS-Total-Proxy-Auth-Invalid-Requests = 0
265 FreeRADIUS-Total-Proxy-Auth-Dropped-Requests = 0
266 FreeRADIUS-Total-Proxy-Auth-Unknown-Types = 0
267 FreeRADIUS-Total-Proxy-Accounting-Requests = 0
268 FreeRADIUS-Total-Proxy-Accounting-Responses = 0
269 FreeRADIUS-Total-Proxy-Acct-Duplicate-Requests = 0
270 FreeRADIUS-Total-Proxy-Acct-Malformed-Requests = 0
271 FreeRADIUS-Total-Proxy-Acct-Invalid-Requests = 0
272 FreeRADIUS-Total-Proxy-Acct-Dropped-Requests = 0
273 FreeRADIUS-Total-Proxy-Acct-Unknown-Types = 0
274 FreeRADIUS-Stats-Start-Time = "Aug 3 2023 13:36:24 UTC"
275 FreeRADIUS-Stats-HUP-Time = "Aug 3 2023 13:36:24 UTC"
276 FreeRADIUS-Queue-Len-Internal = 0
277 FreeRADIUS-Queue-Len-Proxy = 0
278 FreeRADIUS-Queue-Len-Auth = 0
279 FreeRADIUS-Queue-Len-Acct = 0
280 FreeRADIUS-Queue-Len-Detail = 0
281 FreeRADIUS-Queue-PPS-In = 0
282 FreeRADIUS-Queue-PPS-Out = 0
283 FreeRADIUS-Stats-Threads-Active = 0
284 FreeRADIUS-Stats-Threads-Total = 0
285 FreeRADIUS-Stats-Threads-Max = 0
286 ----
287
288 === Client statistics
289
290 Data can be provided about each RADIUS client defined in the
291 server. Note that this is for the client definition, not for each
292 client that connects - if a client definition has a wide netmask
293 and permits multiple clients to connect, the statistics will be
294 aggregate for all clients using that definition.
295
296 [NOTE]
297 ====
298 It is not possible to request global server statistics
299 concurrently with client statistics as both use the same reply
300 attributes.
301 ====
302
303 Here we request accounting data for one particular client by IP
304 address.
305
306 [source,shell]
307 ----
308 # cat <<EOF | radclient -x localhost:18121 status adminsecret
309 FreeRADIUS-Statistics-Type = 0x2f
310 FreeRADIUS-Stats-Client-IP-Address = 172.16.0.10
311 Message-Authenticator=0x00
312 EOF
313 Sent Status-Server Id 194 from 0.0.0.0:d897 to 127.0.0.1:18121 length 62
314 FreeRADIUS-Statistics-Type = 47
315 FreeRADIUS-Stats-Client-IP-Address = 172.16.0.10
316 Message-Authenticator = 0x00
317 Received Access-Accept Id 194 from 127.0.0.1:46c9 to 127.0.0.1:55447 length 236
318 FreeRADIUS-Stats-Client-IP-Address = 172.16.0.10
319 FreeRADIUS-Total-Access-Requests = 1491
320 FreeRADIUS-Total-Access-Accepts = 1240
321 FreeRADIUS-Total-Access-Rejects = 246
322 FreeRADIUS-Total-Access-Challenges = 0
323 FreeRADIUS-Total-Auth-Responses = 1486
324 FreeRADIUS-Total-Auth-Duplicate-Requests = 0
325 FreeRADIUS-Total-Auth-Malformed-Requests = 0
326 FreeRADIUS-Total-Auth-Invalid-Requests = 0
327 FreeRADIUS-Total-Auth-Dropped-Requests = 0
328 FreeRADIUS-Total-Auth-Unknown-Types = 0
329 FreeRADIUS-Total-Accounting-Requests = 0
330 FreeRADIUS-Total-Accounting-Responses = 0
331 FreeRADIUS-Total-Acct-Duplicate-Requests = 0
332 FreeRADIUS-Total-Acct-Malformed-Requests = 0
333 FreeRADIUS-Total-Acct-Invalid-Requests = 0
334 FreeRADIUS-Total-Acct-Dropped-Requests = 0
335 FreeRADIUS-Total-Acct-Unknown-Types = 0
336 ----