Willy Tarreau | 9186126 | 2007-10-17 17:06:05 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 2 | * include/proto/dumpstats.h |
| 3 | * This file contains definitions of some primitives to dedicated to |
| 4 | * statistics output. |
| 5 | * |
Willy Tarreau | b24281b | 2011-02-13 13:16:36 +0100 | [diff] [blame] | 6 | * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu |
Willy Tarreau | eb47268 | 2010-05-28 18:46:57 +0200 | [diff] [blame] | 7 | * |
| 8 | * This library is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Lesser General Public |
| 10 | * License as published by the Free Software Foundation, version 2.1 |
| 11 | * exclusively. |
| 12 | * |
| 13 | * This library is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * Lesser General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Lesser General Public |
| 19 | * License along with this library; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ |
Willy Tarreau | 9186126 | 2007-10-17 17:06:05 +0200 | [diff] [blame] | 22 | |
| 23 | #ifndef _PROTO_DUMPSTATS_H |
| 24 | #define _PROTO_DUMPSTATS_H |
| 25 | |
| 26 | #include <common/config.h> |
Willy Tarreau | c7e4238 | 2012-08-24 19:22:53 +0200 | [diff] [blame] | 27 | #include <types/stream_interface.h> |
Willy Tarreau | 9186126 | 2007-10-17 17:06:05 +0200 | [diff] [blame] | 28 | |
Willy Tarreau | 295a837 | 2011-03-10 11:25:07 +0100 | [diff] [blame] | 29 | /* Flags for applet.ctx.stats.flags */ |
Willy Tarreau | 354898b | 2012-12-23 18:15:23 +0100 | [diff] [blame] | 30 | #define STAT_FMT_HTML 0x00000001 /* dump the stats in HTML format */ |
Willy Tarreau | 39f7e6d | 2008-03-17 21:38:24 +0100 | [diff] [blame] | 31 | #define STAT_HIDE_DOWN 0x00000008 /* hide 'down' servers in the stats page */ |
| 32 | #define STAT_NO_REFRESH 0x00000010 /* do not automatically refresh the stats page */ |
Cyril Bonté | 474be41 | 2010-10-12 00:14:36 +0200 | [diff] [blame] | 33 | #define STAT_ADMIN 0x00000020 /* indicate a stats admin level */ |
Willy Tarreau | 39f7e6d | 2008-03-17 21:38:24 +0100 | [diff] [blame] | 34 | #define STAT_BOUND 0x00800000 /* bound statistics to selected proxies/types/services */ |
Willy Tarreau | 55bb845 | 2007-10-17 18:44:57 +0200 | [diff] [blame] | 35 | |
Krzysztof Piotr Oledzki | 2c6962c | 2008-03-02 02:42:14 +0100 | [diff] [blame] | 36 | #define STATS_TYPE_FE 0 |
| 37 | #define STATS_TYPE_BE 1 |
| 38 | #define STATS_TYPE_SV 2 |
Krzysztof Piotr Oledzki | aeebf9b | 2009-10-04 15:43:17 +0200 | [diff] [blame] | 39 | #define STATS_TYPE_SO 3 |
Krzysztof Piotr Oledzki | 2c6962c | 2008-03-02 02:42:14 +0100 | [diff] [blame] | 40 | |
Willy Tarreau | f5a885f | 2009-10-04 14:22:18 +0200 | [diff] [blame] | 41 | /* unix stats socket states */ |
| 42 | #define STAT_CLI_INIT 0 /* initial state */ |
| 43 | #define STAT_CLI_END 1 /* final state, let's close */ |
| 44 | #define STAT_CLI_GETREQ 2 /* wait for a request */ |
| 45 | #define STAT_CLI_OUTPUT 3 /* all states after this one are responses */ |
| 46 | #define STAT_CLI_PROMPT 3 /* display the prompt (first output, same code) */ |
Willy Tarreau | ea1f5fe | 2009-10-11 23:12:51 +0200 | [diff] [blame] | 47 | #define STAT_CLI_PRINT 4 /* display message in cli->msg */ |
Willy Tarreau | f5a885f | 2009-10-04 14:22:18 +0200 | [diff] [blame] | 48 | |
Willy Tarreau | d9bdcd5 | 2012-12-22 20:31:10 +0100 | [diff] [blame] | 49 | #define STAT_CLI_O_INFO 5 /* dump info */ |
Willy Tarreau | f5a885f | 2009-10-04 14:22:18 +0200 | [diff] [blame] | 50 | #define STAT_CLI_O_SESS 6 /* dump sessions */ |
| 51 | #define STAT_CLI_O_ERR 7 /* dump errors */ |
Willy Tarreau | 69f58c8 | 2010-07-12 17:55:33 +0200 | [diff] [blame] | 52 | #define STAT_CLI_O_TAB 8 /* dump tables */ |
Simon Horman | c88b887 | 2011-06-15 15:18:49 +0900 | [diff] [blame] | 53 | #define STAT_CLI_O_CLR 9 /* clear tables */ |
Willy Tarreau | 654694e | 2012-06-07 01:03:16 +0200 | [diff] [blame] | 54 | #define STAT_CLI_O_SET 10 /* set entries in tables */ |
Willy Tarreau | d9bdcd5 | 2012-12-22 20:31:10 +0100 | [diff] [blame] | 55 | #define STAT_CLI_O_STAT 11 /* dump stats */ |
Willy Tarreau | f5a885f | 2009-10-04 14:22:18 +0200 | [diff] [blame] | 56 | |
Willy Tarreau | 96d4491 | 2013-11-22 12:25:24 +0100 | [diff] [blame] | 57 | /* HTTP stats : applet.st0 */ |
| 58 | enum { |
| 59 | STAT_HTTP_DONE = 0, /* finished */ |
Willy Tarreau | 347a35d | 2013-11-22 17:51:09 +0100 | [diff] [blame] | 60 | STAT_HTTP_HEAD, /* send headers before dump */ |
Willy Tarreau | 96d4491 | 2013-11-22 12:25:24 +0100 | [diff] [blame] | 61 | STAT_HTTP_DUMP, /* dumping stats */ |
Willy Tarreau | 347a35d | 2013-11-22 17:51:09 +0100 | [diff] [blame] | 62 | STAT_HTTP_POST, /* waiting post data */ |
| 63 | STAT_HTTP_LAST, /* sending last chunk of response */ |
Willy Tarreau | 96d4491 | 2013-11-22 12:25:24 +0100 | [diff] [blame] | 64 | }; |
| 65 | |
de Lafond Guillaume | 88c278f | 2013-04-15 19:27:10 +0200 | [diff] [blame] | 66 | /* HTML form to limit output scope */ |
| 67 | #define STAT_SCOPE_TXT_MAXLEN 20 /* max len for scope substring */ |
| 68 | #define STAT_SCOPE_INPUT_NAME "scope" /* pattern form scope name <input> in html form */ |
| 69 | #define STAT_SCOPE_PATTERN "?" STAT_SCOPE_INPUT_NAME "=" |
| 70 | |
Willy Tarreau | b24281b | 2011-02-13 13:16:36 +0100 | [diff] [blame] | 71 | extern struct si_applet http_stats_applet; |
Willy Tarreau | b1356cf | 2008-12-07 16:06:43 +0100 | [diff] [blame] | 72 | |
Willy Tarreau | 9a42c0d | 2009-09-22 19:31:03 +0200 | [diff] [blame] | 73 | void stats_io_handler(struct stream_interface *si); |
Willy Tarreau | 9186126 | 2007-10-17 17:06:05 +0200 | [diff] [blame] | 74 | |
| 75 | |
| 76 | #endif /* _PROTO_DUMPSTATS_H */ |
| 77 | |
| 78 | /* |
| 79 | * Local variables: |
| 80 | * c-indent-level: 8 |
| 81 | * c-basic-offset: 8 |
| 82 | * End: |
| 83 | */ |