[MINOR] acl: add be_id/srv_id to match backend's and server's id

These ones can be useful in responses.
This commit is contained in:
Herv COMMOWICK 2010-12-15 14:04:51 +01:00 committed by Willy Tarreau
parent 02ff8ef677
commit 35ed8019e3
2 changed files with 40 additions and 7 deletions

View File

@ -6966,6 +6966,10 @@ be_conn(backend) <integer>
backend. It can be used to use a specific farm when the nominal one is full.
See also the "fe_conn", "queue" and "be_sess_rate" criteria.
be_id <integer>
Applies to the backend's id. Can be used in frontends to check from which
backend it was called.
be_sess_rate <integer>
be_sess_rate(backend) <integer>
Returns true when the sessions creation rate on the backend matches the
@ -7329,6 +7333,9 @@ src_updt_conn_cnt(table) <integer>
tcp-request content reject if { src_update_count gt 3 }
server local 127.0.0.1:22
srv_id <integer>
Applies to the server's id. Can be used in frontends or backends.
srv_is_up(<server>)
srv_is_up(<backend>/<server>)
Returns true when the designated server is UP, and false when it is either

View File

@ -1386,6 +1386,30 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
return 1;
}
/* set test->i to the id of the backend */
static int
acl_fetch_be_id(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test) {
test->flags = ACL_TEST_F_READ_ONLY;
test->i = l4->be->uuid;
return 1;
}
/* set test->i to the id of the server */
static int
acl_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, int dir,
struct acl_expr *expr, struct acl_test *test) {
test->flags = ACL_TEST_F_READ_ONLY;
test->i = l4->srv->puid;
return 1;
}
/* set test->i to the number of connections per second reaching the backend */
static int
acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
@ -1484,11 +1508,13 @@ acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir
static struct acl_kw_list acl_kws = {{ },{
{ "nbsrv", acl_parse_int, acl_fetch_nbsrv, acl_match_int, ACL_USE_NOTHING },
{ "connslots", acl_parse_int, acl_fetch_connslots, acl_match_int, ACL_USE_NOTHING },
{ "be_id", acl_parse_int, acl_fetch_be_id, acl_match_int, ACL_USE_NOTHING },
{ "be_sess_rate", acl_parse_int, acl_fetch_be_sess_rate, acl_match_int, ACL_USE_NOTHING },
{ "be_conn", acl_parse_int, acl_fetch_be_conn, acl_match_int, ACL_USE_NOTHING },
{ "queue", acl_parse_int, acl_fetch_queue_size, acl_match_int, ACL_USE_NOTHING },
{ "avg_queue", acl_parse_int, acl_fetch_avg_queue_size, acl_match_int, ACL_USE_NOTHING },
{ "srv_is_up", acl_parse_nothing, acl_fetch_srv_is_up, acl_match_nothing, ACL_USE_NOTHING },
{ "srv_id", acl_parse_int, acl_fetch_srv_id, acl_match_int, ACL_USE_NOTHING },
{ NULL, NULL, NULL, NULL },
}};