INTRODUCTION
An executable triggering mechanism feature is part of all SQL plugins
(sql_trigger_exec). Executables may either be spawned each time a cache
purging event occurs or at arbitrary time intervals (that are specified
via sql_trigger_time). Because the triggering mechanism is hooked on top
of the 'lazy deadlines' plugin concept, it should not be preferred method
to run tasks strictly connected to timing issues (use crontab instead).
As a recap, the concept of lazy deadlines was introduced a while ago to
avoid large use of UNIX signals for precise time handling. Information
is being passed to the triggered executable in the form of environment
variables. The list of supported variables follows: 

VAR:		$SQL_DB
DESC:		RDBMS database name.

VAR:		$SQL_TABLE
DESC:		SQL table name.

VAR:		$EFFECTIVE_SQL_TABLE
DESC:		SQL table name. This is defined only if the 'sql_table' value
		contains variables. Variables are replaced here by their actual
		values. This value will be inaccurate if multiple SQL tables
		are written as part of the same purge, ie. as a result of: 1)
		nfacctd daemon but nfacctd_time_new set to false (default); 2)
		$peer_src_ip part of the SQL table name.

VAR:		$SQL_HOST
DESC:		SQL server hostname (if any)

VAR:		$SQL_USER
DESC:		Username when authenticating to the SQL server.

VAR:		$SQL_REFRESH_TIME
DESC:		Time interval at which data is currently purged from the cache
		to the database.

VAR:		$SAMPLING_RATE
DESC:		Packet sampling ratio (1 out of N). It is defined only if packet
		sampling is actually enabled via a 'sampling_rate' configuration
		directive (see CONFIG-KEYS for further details about the key). 

VAR:		$SQL_RECOVERY_BACKUP_HOST
DESC:		SQL server hostname contacted if the primary server fails. This
		is defined only if 'sql_recovery_backup_host' is activated (see
		CONFIG-KEYS for further details about the key).

VAR:		$TOTAL_ELEM_NUMBER
DESC:		Returns the total number of queued elements during the last
		purging event. Elements may be subsequently filtered out. It
		is defined only if 'sql_trigger_time' directive is NOT defined
		(this causes the trigger to be launched each time the purging
		event occurs).

VAR:		$EFFECTIVE_ELEM_NUMBER
DESC:		Returns the effective number of elements (that is, excluding
		those filtered out) on the queue being encapsulated in SQL
		queries during the last purging event. It is defined only if
		'sql_trigger_time' is NOT defined (this causes the trigger to
		be launched each time the purging event occurs).

VAR:		$INSERT_QUERIES_NUMBER
DESC:		Returns the number of elements being successfully incapsulated
		into INSERT queries during the last cache-to-DB purging event.
		It is defined only if 'sql_trigger_time' is NOT defined (this
		causes the trigger to be launched each time the purging event
		occurs).

VAR:		$UPDATE_QUERIES_NUMBER
DESC:           Returns the number of elements being successfully incapsulated
                into UPDATE queries during the last cache-to-DB purging event.
                It is defined only if 'sql_trigger_time' is NOT defined (this
                causes the trigger to be launched each time the purging event
                occurs).

VAR:		$ELAPSED_TIME
DESC:		Returns the number of seconds the last purging event took to
		complete. It is defined only if 'sql_trigger_time' directive is
		NOT defined (this causes the trigger to be launched each time
		the purging event occurs).

VAR:		$SQL_HISTORY_BASETIME
DESC:		Returns the basetime of the current timeslot, if 'sql_history'
		is defined (see CONFIG-KEYS for further details about the key).
		It is the same value being inserted into 'stamp_inserted' field
		and is expressed as unixtime (seconds since Epoch). This is
		defined only if 'sql_trigger_time' is NOT defined (this causes
		the trigger to be launched each time the purging event occurs).

VAR:		$SQL_HISTORY_TIMESLOT
DESC:		Returns the timeslot size (in seconds), if 'sql_history' (see
		CONFIG-KEYS for further details about the key) is defined. Note
		that this value may change (it's recomputed) if monthly timeslot
		are in use. This is defined only if 'sql_trigger_time' is NOT
		defined (this causes the trigger to be launched each time the
		purging event occurs).
 
VAR:		$SQL_MAX_WRITERS
DESC:		Returns the maximum number of concurrent SQL writer processes
		allowed (see CONFIG-KEYS for details about 'sql_max_writers').  

VAR:            $SQL_ACTIVE_WRITERS
DESC:           Returns the active number of concurrent writer processes in
		place (see CONFIG-KEYS for details about 'sql_max_writers'). If
		used in conjunction with $SQL_MAX_WRITERS, this can prevent
		hitting the upper limit of writers by, say, taking corrective
		actions or sending proper warning notifications.
