blob: a41463062fec9c08e94c0302a18ea6a5f44f6d21 [file] [log] [blame]
Krzysztof Piotr Oledzki09605412009-09-23 22:09:24 +02001/*
2 * Health-checks.
3 *
4 * Copyright 2008-2009 Krzysztof Piotr Oledzki <ole@ans.pl>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13/* check status */
14enum {
15 HCHK_STATUS_UNKNOWN = 0, /* Unknown */
16 HCHK_STATUS_INI, /* Initializing */
Krzysztof Piotr Oledzki213014e2009-09-27 15:50:02 +020017 HCHK_STATUS_START, /* Check started - SPECIAL STATUS */
Krzysztof Piotr Oledzki09605412009-09-23 22:09:24 +020018
Krzysztof Piotr Oledzki213014e2009-09-27 15:50:02 +020019 /* Below we have finished checks */
Krzysztof Piotr Oledzki09605412009-09-23 22:09:24 +020020 HCHK_STATUS_CHECKED, /* DUMMY STATUS */
Krzysztof Piotr Oledzki97f07b82009-12-15 22:31:24 +010021
22 HCHK_STATUS_HANA, /* Healt analyze detected enough consecutive errors */
23
Krzysztof Piotr Oledzki09605412009-09-23 22:09:24 +020024 HCHK_STATUS_SOCKERR, /* Socket error */
25
26 HCHK_STATUS_L4OK, /* L4 check passed, for example tcp connect */
27 HCHK_STATUS_L4TOUT, /* L4 timeout */
28 HCHK_STATUS_L4CON, /* L4 connection problem, for example: */
29 /* "Connection refused" (tcp rst) or "No route to host" (icmp) */
30
31 HCHK_STATUS_L6OK, /* L6 check passed */
32 HCHK_STATUS_L6TOUT, /* L6 (SSL) timeout */
33 HCHK_STATUS_L6RSP, /* L6 invalid response - protocol error */
34
35 HCHK_STATUS_L7TOUT, /* L7 (HTTP/SMTP) timeout */
36 HCHK_STATUS_L7RSP, /* L7 invalid response - protocol error */
37
38 /* Below we have layer 5-7 data avaliable */
39 HCHK_STATUS_L57DATA, /* DUMMY STATUS */
40 HCHK_STATUS_L7OKD, /* L7 check passed */
41 HCHK_STATUS_L7OKCD, /* L7 check conditionally passed */
42 HCHK_STATUS_L7STS, /* L7 response error, for example HTTP 5xx */
43
44 HCHK_STATUS_SIZE
45};
Krzysztof Piotr Oledzki213014e2009-09-27 15:50:02 +020046
Krzysztof Piotr Oledzki97f07b82009-12-15 22:31:24 +010047
48/* health status for response tracking */
49enum {
50 HANA_STATUS_UNKNOWN = 0,
51
52 HANA_STATUS_L4_OK, /* L4 successful connection */
53 HANA_STATUS_L4_ERR, /* L4 unsuccessful connection */
54
55 HANA_STATUS_HTTP_OK, /* Correct http response */
56 HANA_STATUS_HTTP_STS, /* Wrong http response, for example HTTP 5xx */
57 HANA_STATUS_HTTP_HDRRSP, /* Invalid http response (headers) */
58 HANA_STATUS_HTTP_RSP, /* Invalid http response */
59
60 HANA_STATUS_HTTP_READ_ERROR, /* Read error */
61 HANA_STATUS_HTTP_READ_TIMEOUT, /* Read timeout */
62 HANA_STATUS_HTTP_BROKEN_PIPE, /* Unexpected close from server */
63
64 HANA_STATUS_SIZE
65};
66
67enum {
68 HANA_ONERR_UNKNOWN = 0,
69
70 HANA_ONERR_FASTINTER, /* Force fastinter*/
71 HANA_ONERR_FAILCHK, /* Simulate a failed check */
72 HANA_ONERR_SUDDTH, /* Enters sudden death - one more failed check will mark this server down */
73 HANA_ONERR_MARKDWN, /* Mark this server down, now! */
74};
75
76enum {
Simon Hormane0d1bfb2011-06-21 14:34:58 +090077 HANA_ONMARKEDDOWN_NONE = 0,
78
79 HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS, /* Shutdown peer sessions */
80};
81
82enum {
Krzysztof Piotr Oledzki97f07b82009-12-15 22:31:24 +010083 HANA_OBS_NONE = 0,
84
85 HANA_OBS_LAYER4, /* Observe L4 - for example tcp */
86 HANA_OBS_LAYER7, /* Observe L7 - for example http */
87
88 HANA_OBS_SIZE
89};
90
Krzysztof Piotr Oledzki213014e2009-09-27 15:50:02 +020091struct check_status {
92 short result; /* one of SRV_CHK_* */
93 char *info; /* human readable short info */
94 char *desc; /* long description */
95};
Krzysztof Piotr Oledzki97f07b82009-12-15 22:31:24 +010096
97struct analyze_status {
98 char *desc; /* description */
99 unsigned char lr[HANA_OBS_SIZE]; /* result for l4/l7: 0 = ignore, 1 - error, 2 - OK */
100};