mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-03 20:39:41 -05:00
This patch adds health logging so it possible to check what was happening before a crash. Failed healt checks are logged if server is UP and succeeded healt checks if server is DOWN, so the amount of additional information is limited. I also reworked the code a little: - check_status_description[] and check_status_info[] is now joined into check_statuses[] - set_server_check_status updates not only s->check_status and s->check_duration but also s->result making the code simpler Changes in v3: - for now calculate and use local versions of health/rise/fall/state, it is a slow path, no harm should be done. One day we may centralize processing of the checks and remove the duplicated code. - also log checks that are restoring current state - use "conditionally succeeded" for 404 with disable-on-404
48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
/*
|
|
* Health-checks.
|
|
*
|
|
* Copyright 2008-2009 Krzysztof Piotr Oledzki <ole@ans.pl>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*
|
|
*/
|
|
|
|
/* check status */
|
|
enum {
|
|
HCHK_STATUS_UNKNOWN = 0, /* Unknown */
|
|
HCHK_STATUS_INI, /* Initializing */
|
|
HCHK_STATUS_START, /* Check started - SPECIAL STATUS */
|
|
|
|
/* Below we have finished checks */
|
|
HCHK_STATUS_CHECKED, /* DUMMY STATUS */
|
|
HCHK_STATUS_SOCKERR, /* Socket error */
|
|
|
|
HCHK_STATUS_L4OK, /* L4 check passed, for example tcp connect */
|
|
HCHK_STATUS_L4TOUT, /* L4 timeout */
|
|
HCHK_STATUS_L4CON, /* L4 connection problem, for example: */
|
|
/* "Connection refused" (tcp rst) or "No route to host" (icmp) */
|
|
|
|
HCHK_STATUS_L6OK, /* L6 check passed */
|
|
HCHK_STATUS_L6TOUT, /* L6 (SSL) timeout */
|
|
HCHK_STATUS_L6RSP, /* L6 invalid response - protocol error */
|
|
|
|
HCHK_STATUS_L7TOUT, /* L7 (HTTP/SMTP) timeout */
|
|
HCHK_STATUS_L7RSP, /* L7 invalid response - protocol error */
|
|
|
|
/* Below we have layer 5-7 data avaliable */
|
|
HCHK_STATUS_L57DATA, /* DUMMY STATUS */
|
|
HCHK_STATUS_L7OKD, /* L7 check passed */
|
|
HCHK_STATUS_L7OKCD, /* L7 check conditionally passed */
|
|
HCHK_STATUS_L7STS, /* L7 response error, for example HTTP 5xx */
|
|
|
|
HCHK_STATUS_SIZE
|
|
};
|
|
|
|
struct check_status {
|
|
short result; /* one of SRV_CHK_* */
|
|
char *info; /* human readable short info */
|
|
char *desc; /* long description */
|
|
};
|