2006-06-15 19:48:13 +00:00
|
|
|
/*
|
2006-06-26 00:48:02 +00:00
|
|
|
include/proto/checks.h
|
|
|
|
Functions prototypes for the checks.
|
|
|
|
|
2009-03-08 08:38:41 +00:00
|
|
|
Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu
|
MEDIUM: checks: Implement smtp check using tcp-check rules
A share tcp-check ruleset is now created to support smtp checks. This way no
extra memory is used if several backends use a smtp check.
The following sequence is used :
tcp-check connect default linger
tcp-check expect rstring "^[0-9]{3}[ \r]" min-recv 4 \
error-status "L7RSP" on-error "%[check.payload(),cut_crlf]"
tcp-check expect rstring "^2[0-9]{2}[ \r]" min-recv 4 \
error-status "L7STS" \
on-error %[check.payload(4,0),ltrim(' '),cut_crlf] \
status-code "check.payload(0,3)"
tcp-echeck send "%[var(check.smtp_cmd)]\r\n" log-format
tcp-check expect rstring "^2[0-9]{2}[- \r]" min-recv 4 \
error-status "L7STS" \
on-error %[check.payload(4,0),ltrim(' '),cut_crlf] \
on-success "%[check.payload(4,0),ltrim(' '),cut_crlf]" \
status-code "check.payload(0,3)"
The variable check.smtp_cmd is by default the string "HELO localhost" by may be
customized setting <helo> and <domain> parameters on the option smtpchk
line. Note there is a difference with the old smtp check. The server gretting
message is checked before send the HELO/EHLO comand.
2020-04-01 18:54:05 +00:00
|
|
|
|
2006-06-15 19:48:13 +00:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation, version 2.1
|
|
|
|
exclusively.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2006-06-26 00:48:02 +00:00
|
|
|
#ifndef _PROTO_CHECKS_H
|
|
|
|
#define _PROTO_CHECKS_H
|
|
|
|
|
2020-02-21 17:13:44 +00:00
|
|
|
#include <types/action.h>
|
2020-04-29 11:32:21 +00:00
|
|
|
#include <types/mailers.h>
|
|
|
|
#include <types/checks.h>
|
2020-02-21 17:13:44 +00:00
|
|
|
|
2009-09-23 20:09:24 +00:00
|
|
|
const char *get_check_status_description(short check_status);
|
|
|
|
const char *get_check_status_info(short check_status);
|
2013-12-31 22:47:37 +00:00
|
|
|
void __health_adjust(struct server *s, short status);
|
2006-06-15 19:48:13 +00:00
|
|
|
|
2013-12-31 22:47:37 +00:00
|
|
|
/* Use this one only. This inline version only ensures that we don't
|
|
|
|
* call the function when the observe mode is disabled.
|
|
|
|
*/
|
|
|
|
static inline void health_adjust(struct server *s, short status)
|
|
|
|
{
|
2017-11-07 09:42:54 +00:00
|
|
|
HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
|
2013-12-31 22:47:37 +00:00
|
|
|
/* return now if observing nor health check is not enabled */
|
2017-10-23 12:39:51 +00:00
|
|
|
if (!s->observe || !s->check.task) {
|
2017-11-07 09:42:54 +00:00
|
|
|
HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
|
2013-12-31 22:47:37 +00:00
|
|
|
return;
|
2017-10-23 12:39:51 +00:00
|
|
|
}
|
2013-12-31 22:47:37 +00:00
|
|
|
|
2017-10-23 12:39:51 +00:00
|
|
|
__health_adjust(s, status);
|
2017-11-07 09:42:54 +00:00
|
|
|
HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
|
2013-12-31 22:47:37 +00:00
|
|
|
}
|
|
|
|
|
2015-01-30 02:22:55 +00:00
|
|
|
void free_check(struct check *check);
|
2015-01-30 02:22:54 +00:00
|
|
|
|
2017-10-20 19:34:32 +00:00
|
|
|
int init_email_alert(struct mailers *mailers, struct proxy *p, char **err);
|
2015-02-06 02:11:57 +00:00
|
|
|
void send_email_alert(struct server *s, int priority, const char *format, ...)
|
|
|
|
__attribute__ ((format(printf, 3, 4)));
|
2016-11-07 20:07:38 +00:00
|
|
|
|
2020-02-21 17:14:59 +00:00
|
|
|
extern struct action_kw_list tcp_check_keywords;
|
|
|
|
static inline void tcp_check_keywords_register(struct action_kw_list *kw_list)
|
|
|
|
{
|
|
|
|
LIST_ADDQ(&tcp_check_keywords.list, &kw_list->list);
|
|
|
|
}
|
|
|
|
|
2020-03-30 18:34:34 +00:00
|
|
|
void deinit_proxy_tcpcheck(struct proxy *px);
|
2020-04-02 16:05:11 +00:00
|
|
|
int dup_tcpcheck_vars(struct list *dst, struct list *src);
|
|
|
|
|
2016-11-07 20:07:38 +00:00
|
|
|
/* Declared here, but the definitions are in flt_spoe.c */
|
2017-02-20 21:56:03 +00:00
|
|
|
int spoe_prepare_healthcheck_request(char **req, int *len);
|
|
|
|
int spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen);
|
2016-11-07 20:07:38 +00:00
|
|
|
|
2020-04-09 13:28:16 +00:00
|
|
|
int proxy_parse_tcp_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
2020-04-01 09:08:50 +00:00
|
|
|
int proxy_parse_redis_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
2020-04-01 09:10:27 +00:00
|
|
|
int proxy_parse_ssl_hello_chk_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
MEDIUM: checks: Implement smtp check using tcp-check rules
A share tcp-check ruleset is now created to support smtp checks. This way no
extra memory is used if several backends use a smtp check.
The following sequence is used :
tcp-check connect default linger
tcp-check expect rstring "^[0-9]{3}[ \r]" min-recv 4 \
error-status "L7RSP" on-error "%[check.payload(),cut_crlf]"
tcp-check expect rstring "^2[0-9]{2}[ \r]" min-recv 4 \
error-status "L7STS" \
on-error %[check.payload(4,0),ltrim(' '),cut_crlf] \
status-code "check.payload(0,3)"
tcp-echeck send "%[var(check.smtp_cmd)]\r\n" log-format
tcp-check expect rstring "^2[0-9]{2}[- \r]" min-recv 4 \
error-status "L7STS" \
on-error %[check.payload(4,0),ltrim(' '),cut_crlf] \
on-success "%[check.payload(4,0),ltrim(' '),cut_crlf]" \
status-code "check.payload(0,3)"
The variable check.smtp_cmd is by default the string "HELO localhost" by may be
customized setting <helo> and <domain> parameters on the option smtpchk
line. Note there is a difference with the old smtp check. The server gretting
message is checked before send the HELO/EHLO comand.
2020-04-01 18:54:05 +00:00
|
|
|
int proxy_parse_smtpchk_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
2020-04-02 09:44:39 +00:00
|
|
|
const char *file, int line);
|
|
|
|
int proxy_parse_pgsql_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
2020-04-02 16:07:37 +00:00
|
|
|
int proxy_parse_mysql_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
2020-04-03 21:13:50 +00:00
|
|
|
int proxy_parse_ldap_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
2020-04-04 08:27:09 +00:00
|
|
|
int proxy_parse_spop_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
2020-04-09 12:48:48 +00:00
|
|
|
int proxy_parse_httpchk_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
2020-04-09 13:58:50 +00:00
|
|
|
int proxy_parse_external_check_opt(char **args, int cur_arg, struct proxy *curpx, struct proxy *defpx,
|
|
|
|
const char *file, int line);
|
2020-04-01 09:10:27 +00:00
|
|
|
|
2020-04-06 15:54:24 +00:00
|
|
|
int set_srv_agent_send(struct server *srv, const char *send);
|
|
|
|
|
2006-06-26 00:48:02 +00:00
|
|
|
#endif /* _PROTO_CHECKS_H */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* c-indent-level: 8
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* End:
|
|
|
|
*/
|