tcp-request content accept if ! too_fast
tcp-request content accept if WAIT_END
+nbproc : integer
+ Returns an integer value corresponding to the number of processes that were
+ started (it equals the global "nbproc" setting). This is useful for logging
+ and debugging purposes.
+
nbsrv([<backend>]) : integer
Returns an integer value corresponding to the number of usable servers of
either the current backend or the named backend. This is mostly used with
to handle some load. It is useful to report a failure when combined with
"monitor fail".
+proc : integer
+ Returns an integer value corresponding to the position of the process calling
+ the function, between 1 and global.nbproc. This is useful for logging and
+ debugging purposes.
+
queue([<backend>]) : integer
Returns the total number of queued connections of the designated backend,
including all the connections in server queues. If no backend name is
acl srv2_full srv_sess_rate(be1/srv2) gt 50
use_backend be2 if srv1_full or srv2_full
+stopping : boolean
+ Returns TRUE if the process calling the function is currently stopping. This
+ can be useful for logging, or for relaxing certain checks or helping close
+ certain connections upon graceful shutdown.
+
table_avl([<table>]) : integer
Returns the total number of available entries in the current proxy's
stick-table or in the designated stick-table. See also table_cnt.
return 1;
}
+/* returns the number of processes */
+static int
+smp_fetch_nbproc(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+ const struct arg *args, struct sample *smp, const char *kw)
+{
+ smp->type = SMP_T_UINT;
+ smp->data.uint = global.nbproc;
+ return 1;
+}
+
+/* returns the number of the current process (between 1 and nbproc */
+static int
+smp_fetch_proc(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+ const struct arg *args, struct sample *smp, const char *kw)
+{
+ smp->type = SMP_T_UINT;
+ smp->data.uint = relative_pid;
+ return 1;
+}
+
/* generate a random 32-bit integer for whatever purpose, with an optional
* range specified in argument.
*/
return 1;
}
+/* returns true if the current process is stopping */
+static int
+smp_fetch_stopping(struct proxy *px, struct session *s, void *l7, unsigned int opt,
+ const struct arg *args, struct sample *smp, const char *kw)
+{
+ smp->type = SMP_T_BOOL;
+ smp->data.uint = stopping;
+ return 1;
+}
+
/* Note: must not be declared <const> as its list will be overwritten.
* Note: fetches that may return multiple types must be declared as the lowest
* common denominator, the type that can be casted into all other ones. For
{ "always_true", smp_fetch_true, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
{ "env", smp_fetch_env, ARG1(1,STR), NULL, SMP_T_STR, SMP_USE_INTRN },
{ "date", smp_fetch_date, ARG1(0,SINT), NULL, SMP_T_UINT, SMP_USE_INTRN },
+ { "nbproc", smp_fetch_nbproc,0, NULL, SMP_T_UINT, SMP_USE_INTRN },
+ { "proc", smp_fetch_proc, 0, NULL, SMP_T_UINT, SMP_USE_INTRN },
{ "rand", smp_fetch_rand, ARG1(0,UINT), NULL, SMP_T_UINT, SMP_USE_INTRN },
+ { "stopping", smp_fetch_stopping, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
{ /* END */ },
}};