]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
LDAP and SQL triggers are now driven by trunk code
authorNick Porter <nick@portercomputing.co.uk>
Mon, 25 Aug 2025 12:18:03 +0000 (13:18 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 25 Aug 2025 13:56:15 +0000 (14:56 +0100)
Which use fixed names of `pool.<trigger name>` rather than
`modules.<module name>.<trigger name>`

doc/antora/modules/reference/pages/raddb/trigger.conf.adoc
raddb/trigger.conf

index 13b548229fd10c08dc5124dd9d6fe6be45bd1f9c..f9094fc0859804af59e83139587a521dcb64c689 100644 (file)
@@ -139,59 +139,81 @@ configuration.  Not all modules support a `trigger`
 subsection.
 
 
-#### rlm_ldap: The LDAP module
 
 
-Define common arguments to use below:
+### Trunk connection triggers
+
+The following modules use trunk connections:
+
+  - ldap
+  - sql
+  - radius
+  - tacacs
+
+and these all support the following triggers relating to trunk
+connection state changes.
 
+Instead of globally configuring these triggers here, they should be configured per module instance
+by including a `trigger` section within the module instance `pool` section.  That allows for
+the `${.:name}` and `${.:instance}` expansions to reference the correct module name and instance name.
+
+In addition to either enabling the triggers here or within the module `pool` section, for triggers
+to be enabled for a specific module instance, the `triggers` option within the `pool` section needs
+to be set to `yes`.
+
+
+Define common arguments to use below:
 
 
-open:: A new connection to the directory has been opened.
 
+connection_halted:: A connection has entered the "halted" state.
 
+All connections start in this state, and return to it after closing.
 
-close:: A connection to the directory has been closed.
 
 
+connection_init:: A connection is being initialised
 
-min:: Connection was released too quickly.
 
 
+connection_connecting::  A connection has started connecting to the remote server
 
-max:: Connection was held for too long.
 
 
+active::  A connection has become active (able to service requests)
 
-#### rlm_sql: The SQL module
+  *Note:* This trigger should not be configured for SQL since due to the limitation of
+one query per connection, every SQL query results in the connection switching from
+`active` to `full` and then back again.
 
 
-args:: Define common arguments to use below:
 
+connection_closed::  A connection has been closed.
 
 
-open:: A new connection to the database has been opened.
 
+connection_full::  A connection has become full.
 
+A full connection is one which has reached the maximum number of requests per connection.
 
-close:: A connection to the database has been closed.
+  *Note:* This trigger should not be configured for SQL as every query results in the
+connection becoming full, due to the limit of one query per connection.
 
 
 
-fail:: Failed to open a new connection to the database.
+connection_inactive::  A connection has become inactive (unable to accept new requests)
 
 
 
-min:: A connection was released too quickly.
+connection_inactive_draining::  A connection has become inactive and is draining its requests.
 
 
 
-max:: A connection was held for too long.
+connection_draining::  A connection is draining its outstanding requests
 
 
 
-NOTE: You can also use connection pool's start/stop/open/close triggers
-for any module which uses the `pool` section, both here and under
-`pool.trigger` in module configuration.
+connection_draining_to_free:: A connection is draining its outstanding requests before feeing.
 
 
 
@@ -224,22 +246,20 @@ trigger {
                max_requests = `${snmptrap}::serverMaxRequests`
        }
        modules {
-               ldap {
-                       args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'"
-                       open = `${snmptrap}::serverModuleConnectionUp ${args}`
-                       close = `${snmptrap}::serverModuleConnectionDown ${args}`
-                       min = `${snmptrap}::serverModuleConnectionReservedPeriodMin ${args}`
-                       max = `${snmptrap}::serverModuleConnectionReservedPeriodMax ${args}`
-               }
-               sql {
-                       args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'"
-                       open = `${snmptrap}::serverModuleConnectionUp ${args}`
-                       close = `${snmptrap}::serverModuleConnectionDown ${args}`
-                       fail = `${snmptrap}::serverModuleConnectionFail ${args}`
-                       min = `${snmptrap}::serverModuleConnectionReservedPeriodMin ${args}`
-                       max = `${snmptrap}::serverModuleConnectionReservedPeriodMax ${args}`
-               }
        }
+#      pool {
+#              args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'"
+#              connection_halted = `${snmptrap}::serverModuleConnectionHalted ${args}`
+#              connection_init = `${snmptrap}::serverModuleConnectionInit ${args}`
+#              connection_connecting = `${snmptrap}::serverModuleConnectionInit ${args}`
+#              connection_active = `${snmptrap}::serverModuleConnectionUp ${args}`
+#              connection_closed = `${snmptrap}::serverModuleConnectionDown ${args}`
+#              connection_full = `${snmptrap}::serverModuleConnectionFull ${args}`
+#              connection_inactive = `${snmptrap}::serverModuleConnectionInactive ${args}`
+#              connection_inactive_draining = `${snmptrap}::serverModuleConnectionInactiveDraining ${args}`
+#              connection_draining = `${snmptrap}::serverModuleConnectionDraining ${args}`
+#              connection_draining_to_free = `${snmptrap}::serverModuleConnectionDrainingToFree ${args}`
+#      }
 }
 ```
 
index b2a0cdfcb51e30fd2c007cc887bfd708f75e4a95..4c89614f0c541516a52bed4027eaa9930cdcae8c 100644 (file)
@@ -156,77 +156,97 @@ trigger {
        #  subsection.
        #
        modules {
+
+       }
+
+       #
+       #  ### Trunk connection triggers
+       #
+       #  The following modules use trunk connections:
+       #
+       #    - ldap
+       #    - sql
+       #    - radius
+       #    - tacacs
+       #
+       #  and these all support the following triggers relating to trunk
+       #  connection state changes.
+       #
+       #  Instead of globally configuring these triggers here, they should be configured per module instance
+       #  by including a `trigger` section within the module instance `pool` section.  That allows for
+       #  the `${.:name}` and `${.:instance}` expansions to reference the correct module name and instance name.
+       #
+       #  In addition to either enabling the triggers here or within the module `pool` section, for triggers
+       #  to be enabled for a specific module instance, the `triggers` option within the `pool` section needs
+       #  to be set to `yes`.
+       #
+#      pool {
                #
-               #  #### rlm_ldap: The LDAP module
+               #  Define common arguments to use below:
                #
-               ldap {
-                       #
-                       #  Define common arguments to use below:
-                       #
-                       args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'"
+#              args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'"
 
-                       #
-                       #  open:: A new connection to the directory has been opened.
-                       #
-                       open = `${snmptrap}::serverModuleConnectionUp ${args}`
-
-                       #
-                       #  close:: A connection to the directory has been closed.
-                       #
-                       close = `${snmptrap}::serverModuleConnectionDown ${args}`
+               #
+               #  connection_halted:: A connection has entered the "halted" state.
+               #
+               #  All connections start in this state, and return to it after closing.
+               #
+#              connection_halted = `${snmptrap}::serverModuleConnectionHalted ${args}`
 
-                       #
-                       #  min:: Connection was released too quickly.
-                       #
-                       min = `${snmptrap}::serverModuleConnectionReservedPeriodMin ${args}`
+               #
+               #  connection_init:: A connection is being initialised
+               #
+#              connection_init = `${snmptrap}::serverModuleConnectionInit ${args}`
 
-                       #
-                       #  max:: Connection was held for too long.
-                       #
-                       max = `${snmptrap}::serverModuleConnectionReservedPeriodMax ${args}`
-               }
+               #
+               #  connection_connecting::  A connection has started connecting to the remote server
+               #
+#              connection_connecting = `${snmptrap}::serverModuleConnectionInit ${args}`
 
                #
-               #  #### rlm_sql: The SQL module
+               #  active::  A connection has become active (able to service requests)
                #
-               sql {
-                       #
-                       #  args:: Define common arguments to use below:
-                       #
-                       args = "radiusdModuleName s '${.:name}' radiusdModuleInstance s '${.:instance}'"
+               #  *Note:* This trigger should not be configured for SQL since due to the limitation of
+               #  one query per connection, every SQL query results in the connection switching from
+               #  `active` to `full` and then back again.
+               #
+#              connection_active = `${snmptrap}::serverModuleConnectionUp ${args}`
 
-                       #
-                       #  open:: A new connection to the database has been opened.
-                       #
-                       open = `${snmptrap}::serverModuleConnectionUp ${args}`
+               #
+               #  connection_closed::  A connection has been closed.
+               #
+#              connection_closed = `${snmptrap}::serverModuleConnectionDown ${args}`
 
-                       #
-                       #  close:: A connection to the database has been closed.
-                       #
-                       close = `${snmptrap}::serverModuleConnectionDown ${args}`
+               #
+               #  connection_full::  A connection has become full.
+               #
+               #  A full connection is one which has reached the maximum number of requests per connection.
+               #
+               #  *Note:* This trigger should not be configured for SQL as every query results in the
+               #  connection becoming full, due to the limit of one query per connection.
+               #
+#              connection_full = `${snmptrap}::serverModuleConnectionFull ${args}`
 
-                       #
-                       #  fail:: Failed to open a new connection to the database.
-                       #
-                       fail = `${snmptrap}::serverModuleConnectionFail ${args}`
+               #
+               #  connection_inactive::  A connection has become inactive (unable to accept new requests)
+               #
+#              connection_inactive = `${snmptrap}::serverModuleConnectionInactive ${args}`
 
-                       #
-                       #  min:: A connection was released too quickly.
-                       #
-                       min = `${snmptrap}::serverModuleConnectionReservedPeriodMin ${args}`
+               #
+               #  connection_inactive_draining::  A connection has become inactive and is draining its requests.
+               #
+#              connection_inactive_draining = `${snmptrap}::serverModuleConnectionInactiveDraining ${args}`
 
-                       #
-                       #  max:: A connection was held for too long.
-                       #
-                       max = `${snmptrap}::serverModuleConnectionReservedPeriodMax ${args}`
-               }
+               #
+               #  connection_draining::  A connection is draining its outstanding requests
+               #
+#              connection_draining = `${snmptrap}::serverModuleConnectionDraining ${args}`
 
                #
-               #  NOTE: You can also use connection pool's start/stop/open/close triggers
-               #  for any module which uses the `pool` section, both here and under
-               #  `pool.trigger` in module configuration.
+               #  connection_draining_to_free:: A connection is draining its outstanding requests before feeing.
                #
-       }
+#              connection_draining_to_free = `${snmptrap}::serverModuleConnectionDrainingToFree ${args}`
+#      }
 }
 
 #