From: Alan T. DeKok Date: Tue, 17 Jan 2023 15:28:50 +0000 (-0500) Subject: first pass of fixing statistics X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31ee1a354b210273752caa9eda78fc0dbb6e9eea;p=thirdparty%2Ffreeradius-server.git first pass of fixing statistics They still don't work, but at least there's a path forward --- diff --git a/raddb/sites-available/status b/raddb/sites-available/status index 19132718ced..4d6c7254abd 100644 --- a/raddb/sites-available/status +++ b/raddb/sites-available/status @@ -58,9 +58,13 @@ server status { } # - # Simple authorize section. The "Autz-Type Status-Server" - # section will work here, too. See "raddb/sites-available/default". + # Receive a Status-Server packet + # recv Status-Server { + # + # Add statistics based on the Vendor-Specific.FreeRADIUS.Stats4-* queries. + # + status ok } } @@ -68,53 +72,19 @@ server status { # Statistics can be queried via a number of methods: # # All packets received/sent by the server (1 = auth, 2 = acct) -# FreeRADIUS-Statistics-Type = 3 -# -# All packets proxied by the server (4 = proxy-auth, 8 = proxy-acct) -# FreeRADIUS-Statistics-Type = 12 -# -# All packets sent && received: -# FreeRADIUS-Statistics-Type = 15 -# -# Internal server statistics: -# FreeRADIUS-Statistics-Type = 16 +# Vendor-Specific.FreeRADIUS.Stats4-Type = Global # # All packets for a particular client (globally defined) -# FreeRADIUS-Statistics-Type = 35 -# FreeRADIUS-Stats-Client-IP-Address = 192.0.2.1 +# Vendor-Specific.FreeRADIUS.Stats4-Type = Client +# Vendor-Specific.FreeRADIUS.Stats4-IPv4-Address = 192.0.2.1 # # All packets for a client attached to a "listen" ip/port -# FreeRADIUS-Statistics-Type = 35 -# FreeRADIUS-Stats-Client-IP-Address = 192.0.2.1 -# FreeRADIUS-Stats-Server-IP-Address = 127.0.0.1 -# FreeRADIUS-Stats-Server-Port = 1812 -# -# All packets for a "listen" IP/port -# FreeRADIUS-Statistics-Type = 67 -# FreeRADIUS-Stats-Server-IP-Address = 127.0.0.1 -# FreeRADIUS-Stats-Server-Port = 1812 +# Vendor-Specific.FreeRADIUS.Stats4-Type = Listener +# Vendor-Specific.FreeRADIUS.Stats4-IPv4-Address = 192.0.2.1 +# Vendor-Specific.FreeRADIUS.Stats4-port = 1812 # -# All packets for a home server IP / port -# FreeRADIUS-Statistics-Type = 131 -# FreeRADIUS-Stats-Server-IP-Address = 192.0.2.2 -# FreeRADIUS-Stats-Server-Port = 1812 -# -# By default it is zero (don't calculate it). Useful values -# are between 100, and 10,000. The server will calculate and -# remember the moving average for this window, and for 10 times -# that window. -# - -# -# Some of this could have been simplified. e.g. the proxy-auth and -# proxy-acct bits aren't completely necessary. But using them permits -# the server to be queried for ALL inbound && outbound packets at once. -# This gives a good snapshot of what the server is doing. # # Due to internal limitations, the statistics might not be exactly up # to date. Do not expect all of the numbers to add up perfectly. -# The Status-Server packets are also counted in the total requests && -# responses. The responses are counted only AFTER the response has -# been sent. # diff --git a/src/modules/rlm_stats/rlm_stats.c b/src/modules/rlm_stats/rlm_stats.c index d84a4cb4f8e..822a9479215 100644 --- a/src/modules/rlm_stats/rlm_stats.c +++ b/src/modules/rlm_stats/rlm_stats.c @@ -320,6 +320,10 @@ static unlang_action_t CC_HINT(nonnull) mod_stats(rlm_rcode_t *p_result, module_ } } + /* + * @todo - do this only for RADIUS + * key off of packet ID, and Stats4-Packet-Counters TLV. + */ strcpy(buffer, "FreeRADIUS-Stats4-"); for (i = 0; i < FR_RADIUS_CODE_MAX; i++) {