blob: 89e656e1af2a5a47725f08e11b835c03c5a9cd04 [file] [log] [blame]
Willy Tarreau91861262007-10-17 17:06:05 +02001/*
Willy Tarreaueb472682010-05-28 18:46:57 +02002 * include/proto/dumpstats.h
3 * This file contains definitions of some primitives to dedicated to
4 * statistics output.
5 *
Willy Tarreaub24281b2011-02-13 13:16:36 +01006 * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
Willy Tarreaueb472682010-05-28 18:46:57 +02007 *
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 Tarreau91861262007-10-17 17:06:05 +020022
23#ifndef _PROTO_DUMPSTATS_H
24#define _PROTO_DUMPSTATS_H
25
26#include <common/config.h>
27#include <types/buffers.h>
28#include <types/session.h>
29
Willy Tarreau295a8372011-03-10 11:25:07 +010030/* Flags for applet.ctx.stats.flags */
Willy Tarreau39f7e6d2008-03-17 21:38:24 +010031#define STAT_FMT_CSV 0x00000001 /* dump the stats in CSV format instead of HTML */
32#define STAT_SHOW_STAT 0x00000002 /* dump the stats part */
33#define STAT_SHOW_INFO 0x00000004 /* dump the info part */
34#define STAT_HIDE_DOWN 0x00000008 /* hide 'down' servers in the stats page */
35#define STAT_NO_REFRESH 0x00000010 /* do not automatically refresh the stats page */
Cyril Bonté474be412010-10-12 00:14:36 +020036#define STAT_ADMIN 0x00000020 /* indicate a stats admin level */
Willy Tarreau39f7e6d2008-03-17 21:38:24 +010037#define STAT_BOUND 0x00800000 /* bound statistics to selected proxies/types/services */
Willy Tarreau55bb8452007-10-17 18:44:57 +020038
Krzysztof Piotr Oledzki2c6962c2008-03-02 02:42:14 +010039#define STATS_TYPE_FE 0
40#define STATS_TYPE_BE 1
41#define STATS_TYPE_SV 2
Krzysztof Piotr Oledzkiaeebf9b2009-10-04 15:43:17 +020042#define STATS_TYPE_SO 3
Krzysztof Piotr Oledzki2c6962c2008-03-02 02:42:14 +010043
Willy Tarreauf5a885f2009-10-04 14:22:18 +020044/* unix stats socket states */
45#define STAT_CLI_INIT 0 /* initial state */
46#define STAT_CLI_END 1 /* final state, let's close */
47#define STAT_CLI_GETREQ 2 /* wait for a request */
48#define STAT_CLI_OUTPUT 3 /* all states after this one are responses */
49#define STAT_CLI_PROMPT 3 /* display the prompt (first output, same code) */
Willy Tarreauea1f5fe2009-10-11 23:12:51 +020050#define STAT_CLI_PRINT 4 /* display message in cli->msg */
Willy Tarreauf5a885f2009-10-04 14:22:18 +020051
Willy Tarreauf5a885f2009-10-04 14:22:18 +020052#define STAT_CLI_O_INFO 5 /* dump info/stats */
53#define STAT_CLI_O_SESS 6 /* dump sessions */
54#define STAT_CLI_O_ERR 7 /* dump errors */
Willy Tarreau69f58c82010-07-12 17:55:33 +020055#define STAT_CLI_O_TAB 8 /* dump tables */
Willy Tarreauf5a885f2009-10-04 14:22:18 +020056
Cyril Bonté70be45d2010-10-12 00:14:35 +020057/* status codes (strictly 4 chars) used in the URL to display a message */
58#define STAT_STATUS_UNKN "UNKN" /* an unknown error occured, shouldn't happen */
59#define STAT_STATUS_DONE "DONE" /* the action is successful */
60#define STAT_STATUS_NONE "NONE" /* nothing happened (no action chosen or servers state didn't change) */
61#define STAT_STATUS_EXCD "EXCD" /* an error occured becayse the buffer couldn't store all data */
Cyril Bonté474be412010-10-12 00:14:36 +020062#define STAT_STATUS_DENY "DENY" /* action denied */
Cyril Bonté70be45d2010-10-12 00:14:35 +020063
Willy Tarreaub24281b2011-02-13 13:16:36 +010064extern struct si_applet http_stats_applet;
65extern struct si_applet cli_applet;
Willy Tarreaub1356cf2008-12-07 16:06:43 +010066
Willy Tarreaudecd14d2010-06-01 18:03:19 +020067int stats_accept(struct session *s);
Willy Tarreau9a42c0d2009-09-22 19:31:03 +020068int stats_sock_parse_request(struct stream_interface *si, char *line);
69void stats_io_handler(struct stream_interface *si);
Willy Tarreau5ec29ff2011-02-13 15:27:22 +010070int stats_dump_raw_to_buffer(struct stream_interface *si);
71int stats_dump_http(struct stream_interface *si, struct uri_auth *uri);
72int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_auth *uri);
73int stats_dump_sess_to_buffer(struct stream_interface *si);
74int stats_dump_table_to_buffer(struct stream_interface *si);
75int stats_dump_errors_to_buffer(struct stream_interface *si);
Willy Tarreau91861262007-10-17 17:06:05 +020076
77
78#endif /* _PROTO_DUMPSTATS_H */
79
80/*
81 * Local variables:
82 * c-indent-level: 8
83 * c-basic-offset: 8
84 * End:
85 */