]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: cli: split dumpstats.h in stats.h and cli.h
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 21 Nov 2016 16:49:11 +0000 (17:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Nov 2016 15:59:27 +0000 (16:59 +0100)
proto/dumpstats.h has been split in 4 files:

  * proto/cli.h  contains protypes for the CLI
  * proto/stats.h contains prototypes for the stats
  * types/cli.h contains definition for the CLI
  * types/stats.h contains definition for the stats

12 files changed:
include/proto/cli.h [new file with mode: 0644]
include/proto/stats.h [new file with mode: 0644]
include/types/cli.h [new file with mode: 0644]
include/types/stats.h [moved from include/proto/dumpstats.h with 61% similarity]
src/cfgparse.c
src/checks.c
src/cli.c
src/hlua.c
src/hlua_fcn.c
src/proto_http.c
src/stats.c
src/stream.c

diff --git a/include/proto/cli.h b/include/proto/cli.h
new file mode 100644 (file)
index 0000000..25c2ee0
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * include/proto/cli.h
+ * This file contains definitions of some primitives to dedicated to
+ * statistics output.
+ *
+ * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
+ *
+ * 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
+ */
+
+#ifndef _PROTO_CLI_H
+#define _PROTO_CLI_H
+
+
+struct cli_kw* cli_find_kw(char **args);
+void cli_register_kw(struct cli_kw_list *kw_list);
+
+#endif /* _PROTO_CLI_H */
+
diff --git a/include/proto/stats.h b/include/proto/stats.h
new file mode 100644 (file)
index 0000000..dfd8bff
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * include/proto/stats.h
+ * This file contains definitions of some primitives to dedicated to
+ * statistics output.
+ *
+ * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
+ *
+ * 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
+ */
+
+#ifndef _PROTO_STATS_H
+#define _PROTO_STATS_H
+
+#include <common/config.h>
+#include <types/applet.h>
+#include <types/stream_interface.h>
+
+
+static inline enum field_format field_format(const struct field *f, int e)
+{
+       return f[e].type & FF_MASK;
+}
+
+static inline enum field_origin field_origin(const struct field *f, int e)
+{
+       return f[e].type & FO_MASK;
+}
+
+static inline enum field_scope field_scope(const struct field *f, int e)
+{
+       return f[e].type & FS_MASK;
+}
+
+static inline enum field_nature field_nature(const struct field *f, int e)
+{
+       return f[e].type & FN_MASK;
+}
+
+static inline const char *field_str(const struct field *f, int e)
+{
+       return (field_format(f, e) == FF_STR) ? f[e].u.str : "";
+}
+
+static inline struct field mkf_s32(uint32_t type, int32_t value)
+{
+       struct field f = { .type = FF_S32 | type, .u.s32 = value };
+       return f;
+}
+
+static inline struct field mkf_u32(uint32_t type, uint32_t value)
+{
+       struct field f = { .type = FF_U32 | type, .u.u32 = value };
+       return f;
+}
+
+static inline struct field mkf_s64(uint32_t type, int64_t value)
+{
+       struct field f = { .type = FF_S64 | type, .u.s64 = value };
+       return f;
+}
+
+static inline struct field mkf_u64(uint32_t type, uint64_t value)
+{
+       struct field f = { .type = FF_U64 | type, .u.u64 = value };
+       return f;
+}
+
+static inline struct field mkf_str(uint32_t type, const char *value)
+{
+       struct field f = { .type = FF_STR | type, .u.str = value };
+       return f;
+}
+
+/* These two structs contains all field names according with
+ * the the number of entries in "enum stat_field" and
+ * "enum info_field"
+ */
+extern const char *info_field_names[];
+extern const char *stat_field_names[];
+
+int stats_fill_info(struct field *info, int len);
+int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len);
+int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
+                        struct field *stats, int len);
+int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
+                        struct field *stats, int len);
+int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len);
+
+extern struct applet http_stats_applet;
+
+void stats_io_handler(struct stream_interface *si);
+int stats_emit_raw_data_field(struct chunk *out, const struct field *f);
+int stats_emit_typed_data_field(struct chunk *out, const struct field *f);
+int stats_emit_field_tags(struct chunk *out, const struct field *f, char delim);
+int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_auth *uri);
+
+#endif /* _PROTO_STATS_H */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ * End:
+ */
diff --git a/include/types/cli.h b/include/types/cli.h
new file mode 100644 (file)
index 0000000..35c2c67
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * include/types/cli.h
+ * This file provides structures and types for CLI.
+ *
+ * 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
+ */
+
+#ifndef _TYPES_CLI_H
+#define _TYPES_CLI_H
+
+#include <common/mini-clist.h>
+#include <types/applet.h>
+
+struct cli_kw {
+       const char *str_kw[5];   /* keywords ended by NULL, limited to 5
+                                separated keywords combination */
+       const char *usage;   /* usage message */
+       int (*parse)(char **args, struct appctx *appctx, void *private);
+       int (*io_handler)(struct appctx *appctx);
+       void (*io_release)(struct appctx *appctx);
+       void *private;
+};
+
+struct cli_kw_list {
+       struct list list;
+       struct cli_kw kw[VAR_ARRAY];
+};
+
+/* Show Info fields for CLI output. For any field added here, please add the text
+ * representation in the info_field_names array below. Please only append at the end,
+ * before the INF_TOTAL_FIELDS entry, and never insert anything in the middle
+ * nor at the beginning.
+ */
+enum info_field {
+       INF_NAME,
+       INF_VERSION,
+       INF_RELEASE_DATE,
+       INF_NBPROC,
+       INF_PROCESS_NUM,
+       INF_PID,
+       INF_UPTIME,
+       INF_UPTIME_SEC,
+       INF_MEMMAX_MB,
+       INF_POOL_ALLOC_MB,
+       INF_POOL_USED_MB,
+       INF_POOL_FAILED,
+       INF_ULIMIT_N,
+       INF_MAXSOCK,
+       INF_MAXCONN,
+       INF_HARD_MAXCONN,
+       INF_CURR_CONN,
+       INF_CUM_CONN,
+       INF_CUM_REQ,
+       INF_MAX_SSL_CONNS,
+       INF_CURR_SSL_CONNS,
+       INF_CUM_SSL_CONNS,
+       INF_MAXPIPES,
+       INF_PIPES_USED,
+       INF_PIPES_FREE,
+       INF_CONN_RATE,
+       INF_CONN_RATE_LIMIT,
+       INF_MAX_CONN_RATE,
+       INF_SESS_RATE,
+       INF_SESS_RATE_LIMIT,
+       INF_MAX_SESS_RATE,
+       INF_SSL_RATE,
+       INF_SSL_RATE_LIMIT,
+       INF_MAX_SSL_RATE,
+       INF_SSL_FRONTEND_KEY_RATE,
+       INF_SSL_FRONTEND_MAX_KEY_RATE,
+       INF_SSL_FRONTEND_SESSION_REUSE_PCT,
+       INF_SSL_BACKEND_KEY_RATE,
+       INF_SSL_BACKEND_MAX_KEY_RATE,
+       INF_SSL_CACHE_LOOKUPS,
+       INF_SSL_CACHE_MISSES,
+       INF_COMPRESS_BPS_IN,
+       INF_COMPRESS_BPS_OUT,
+       INF_COMPRESS_BPS_RATE_LIM,
+       INF_ZLIB_MEM_USAGE,
+       INF_MAX_ZLIB_MEM_USAGE,
+       INF_TASKS,
+       INF_RUN_QUEUE,
+       INF_IDLE_PCT,
+       INF_NODE,
+       INF_DESCRIPTION,
+
+       /* must always be the last one */
+       INF_TOTAL_FIELDS
+};
+
+
+/* stats socket states */
+enum {
+       STAT_CLI_INIT = 0,   /* initial state, must leave to zero ! */
+       STAT_CLI_END,        /* final state, let's close */
+       STAT_CLI_GETREQ,     /* wait for a request */
+       STAT_CLI_OUTPUT,     /* all states after this one are responses */
+       STAT_CLI_PROMPT,     /* display the prompt (first output, same code) */
+       STAT_CLI_PRINT,      /* display message in cli->msg */
+       STAT_CLI_PRINT_FREE, /* display message in cli->msg. After the display, free the pointer */
+       STAT_CLI_O_INFO,     /* dump info */
+       STAT_CLI_O_SESS,     /* dump streams */
+       STAT_CLI_O_ERR,      /* dump errors */
+       STAT_CLI_O_TAB,      /* dump tables */
+       STAT_CLI_O_CLR,      /* clear tables */
+       STAT_CLI_O_SET,      /* set entries in tables */
+       STAT_CLI_O_STAT,     /* dump stats */
+       STAT_CLI_O_PATS,     /* list all pattern reference available */
+       STAT_CLI_O_PAT,      /* list all entries of a pattern */
+       STAT_CLI_O_MLOOK,    /* lookup a map entry */
+       STAT_CLI_O_POOLS,    /* dump memory pools */
+       STAT_CLI_O_TLSK,     /* list all TLS ticket keys references */
+       STAT_CLI_O_TLSK_ENT, /* list all TLS ticket keys entries for a reference */
+       STAT_CLI_O_RESOLVERS,/* dump a resolver's section nameservers counters */
+       STAT_CLI_O_SERVERS_STATE, /* dump server state and changing information */
+       STAT_CLI_O_BACKEND,  /* dump backend list */
+       STAT_CLI_O_ENV,      /* dump environment */
+       STAT_CLI_O_CUSTOM,   /* custom callback pointer */
+};
+
+
+#endif /* _TYPES_CLI_H */
similarity index 61%
rename from include/proto/dumpstats.h
rename to include/types/stats.h
index 6e0adfaee327e6e38f2398ceed9de50685e43b03..dd52bba10947f550f615c97138f657bb7cd75ccc 100644 (file)
@@ -1,9 +1,6 @@
 /*
- * include/proto/dumpstats.h
- * This file contains definitions of some primitives to dedicated to
- * statistics output.
- *
- * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
+ * include/types/stats.h
+ * This file provides structures and types for stats.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _PROTO_DUMPSTATS_H
-#define _PROTO_DUMPSTATS_H
-
-#include <common/config.h>
-#include <types/applet.h>
-#include <types/stream_interface.h>
+#ifndef _TYPES_STATS_H
+#define _TYPES_STATS_H
 
 /* Flags for applet.ctx.stats.flags */
 #define STAT_FMT_HTML   0x00000001      /* dump the stats in HTML format */
@@ -55,160 +48,60 @@ enum {
 #define STAT_SCOPE_INPUT_NAME "scope" /* pattern form scope name <input> in html form */
 #define STAT_SCOPE_PATTERN    "?" STAT_SCOPE_INPUT_NAME "="
 
-/* Show Info fields for CLI output. For any field added here, please add the text
- * representation in the info_field_names array below. Please only append at the end,
- * before the INF_TOTAL_FIELDS entry, and never insert anything in the middle
- * nor at the beginning.
- */
-enum info_field {
-       INF_NAME,
-       INF_VERSION,
-       INF_RELEASE_DATE,
-       INF_NBPROC,
-       INF_PROCESS_NUM,
-       INF_PID,
-       INF_UPTIME,
-       INF_UPTIME_SEC,
-       INF_MEMMAX_MB,
-       INF_POOL_ALLOC_MB,
-       INF_POOL_USED_MB,
-       INF_POOL_FAILED,
-       INF_ULIMIT_N,
-       INF_MAXSOCK,
-       INF_MAXCONN,
-       INF_HARD_MAXCONN,
-       INF_CURR_CONN,
-       INF_CUM_CONN,
-       INF_CUM_REQ,
-       INF_MAX_SSL_CONNS,
-       INF_CURR_SSL_CONNS,
-       INF_CUM_SSL_CONNS,
-       INF_MAXPIPES,
-       INF_PIPES_USED,
-       INF_PIPES_FREE,
-       INF_CONN_RATE,
-       INF_CONN_RATE_LIMIT,
-       INF_MAX_CONN_RATE,
-       INF_SESS_RATE,
-       INF_SESS_RATE_LIMIT,
-       INF_MAX_SESS_RATE,
-       INF_SSL_RATE,
-       INF_SSL_RATE_LIMIT,
-       INF_MAX_SSL_RATE,
-       INF_SSL_FRONTEND_KEY_RATE,
-       INF_SSL_FRONTEND_MAX_KEY_RATE,
-       INF_SSL_FRONTEND_SESSION_REUSE_PCT,
-       INF_SSL_BACKEND_KEY_RATE,
-       INF_SSL_BACKEND_MAX_KEY_RATE,
-       INF_SSL_CACHE_LOOKUPS,
-       INF_SSL_CACHE_MISSES,
-       INF_COMPRESS_BPS_IN,
-       INF_COMPRESS_BPS_OUT,
-       INF_COMPRESS_BPS_RATE_LIM,
-       INF_ZLIB_MEM_USAGE,
-       INF_MAX_ZLIB_MEM_USAGE,
-       INF_TASKS,
-       INF_RUN_QUEUE,
-       INF_IDLE_PCT,
-       INF_NODE,
-       INF_DESCRIPTION,
+/* Actions available for the stats admin forms */
+enum {
+       ST_ADM_ACTION_NONE = 0,
 
-       /* must always be the last one */
-       INF_TOTAL_FIELDS
+       /* enable/disable health checks */
+       ST_ADM_ACTION_DHLTH,
+       ST_ADM_ACTION_EHLTH,
+
+       /* force health check status */
+       ST_ADM_ACTION_HRUNN,
+       ST_ADM_ACTION_HNOLB,
+       ST_ADM_ACTION_HDOWN,
+
+       /* enable/disable agent checks */
+       ST_ADM_ACTION_DAGENT,
+       ST_ADM_ACTION_EAGENT,
+
+       /* force agent check status */
+       ST_ADM_ACTION_ARUNN,
+       ST_ADM_ACTION_ADOWN,
+
+       /* set admin state */
+       ST_ADM_ACTION_READY,
+       ST_ADM_ACTION_DRAIN,
+       ST_ADM_ACTION_MAINT,
+       ST_ADM_ACTION_SHUTDOWN,
+       /* these are the ancient actions, still available for compatibility */
+       ST_ADM_ACTION_DISABLE,
+       ST_ADM_ACTION_ENABLE,
+       ST_ADM_ACTION_STOP,
+       ST_ADM_ACTION_START,
 };
 
-/* Stats fields for CSV output. For any field added here, please add the text
- * representation in the stat_field_names array below. Please only append at the end,
- * before the ST_F_TOTAL_FIELDS entry, and never insert anything in the middle
- * nor at the beginning.
- */
-enum stat_field {
-       ST_F_PXNAME,
-       ST_F_SVNAME,
-       ST_F_QCUR,
-       ST_F_QMAX,
-       ST_F_SCUR,
-       ST_F_SMAX,
-       ST_F_SLIM,
-       ST_F_STOT,
-       ST_F_BIN ,
-       ST_F_BOUT,
-       ST_F_DREQ,
-       ST_F_DRESP,
-       ST_F_EREQ,
-       ST_F_ECON,
-       ST_F_ERESP,
-       ST_F_WRETR,
-       ST_F_WREDIS,
-       ST_F_STATUS,
-       ST_F_WEIGHT,
-       ST_F_ACT,
-       ST_F_BCK,
-       ST_F_CHKFAIL,
-       ST_F_CHKDOWN,
-       ST_F_LASTCHG,
-       ST_F_DOWNTIME,
-       ST_F_QLIMIT,
-       ST_F_PID,
-       ST_F_IID,
-       ST_F_SID,
-       ST_F_THROTTLE,
-       ST_F_LBTOT,
-       ST_F_TRACKED,
-       ST_F_TYPE,
-       ST_F_RATE,
-       ST_F_RATE_LIM,
-       ST_F_RATE_MAX,
-       ST_F_CHECK_STATUS,
-       ST_F_CHECK_CODE,
-       ST_F_CHECK_DURATION,
-       ST_F_HRSP_1XX,
-       ST_F_HRSP_2XX,
-       ST_F_HRSP_3XX,
-       ST_F_HRSP_4XX,
-       ST_F_HRSP_5XX,
-       ST_F_HRSP_OTHER,
-       ST_F_HANAFAIL,
-       ST_F_REQ_RATE,
-       ST_F_REQ_RATE_MAX,
-       ST_F_REQ_TOT,
-       ST_F_CLI_ABRT,
-       ST_F_SRV_ABRT,
-       ST_F_COMP_IN,
-       ST_F_COMP_OUT,
-       ST_F_COMP_BYP,
-       ST_F_COMP_RSP,
-       ST_F_LASTSESS,
-       ST_F_LAST_CHK,
-       ST_F_LAST_AGT,
-       ST_F_QTIME,
-       ST_F_CTIME,
-       ST_F_RTIME,
-       ST_F_TTIME,
-       ST_F_AGENT_STATUS,
-       ST_F_AGENT_CODE,
-       ST_F_AGENT_DURATION,
-       ST_F_CHECK_DESC,
-       ST_F_AGENT_DESC,
-       ST_F_CHECK_RISE,
-       ST_F_CHECK_FALL,
-       ST_F_CHECK_HEALTH,
-       ST_F_AGENT_RISE,
-       ST_F_AGENT_FALL,
-       ST_F_AGENT_HEALTH,
-       ST_F_ADDR,
-       ST_F_COOKIE,
-       ST_F_MODE,
-       ST_F_ALGO,
-       ST_F_CONN_RATE,
-       ST_F_CONN_RATE_MAX,
-       ST_F_CONN_TOT,
-       ST_F_INTERCEPTED,
-       ST_F_DCON,
-       ST_F_DSES,
 
-       /* must always be the last one */
-       ST_F_TOTAL_FIELDS
+/* data transmission states for the stats responses */
+enum {
+       STAT_ST_INIT = 0,
+       STAT_ST_HEAD,
+       STAT_ST_INFO,
+       STAT_ST_LIST,
+       STAT_ST_END,
+       STAT_ST_FIN,
+};
+
+/* data transmission states for the stats responses inside a proxy */
+enum {
+       STAT_PX_ST_INIT = 0,
+       STAT_PX_ST_TH,
+       STAT_PX_ST_FE,
+       STAT_PX_ST_LI,
+       STAT_PX_ST_SV,
+       STAT_PX_ST_BE,
+       STAT_PX_ST_END,
+       STAT_PX_ST_FIN,
 };
 
 /* This level of detail is needed to let the stats consumer know how to
@@ -331,195 +224,99 @@ struct field {
        } u;
 };
 
-static inline enum field_format field_format(const struct field *f, int e)
-{
-       return f[e].type & FF_MASK;
-}
-
-static inline enum field_origin field_origin(const struct field *f, int e)
-{
-       return f[e].type & FO_MASK;
-}
-
-static inline enum field_scope field_scope(const struct field *f, int e)
-{
-       return f[e].type & FS_MASK;
-}
-
-static inline enum field_nature field_nature(const struct field *f, int e)
-{
-       return f[e].type & FN_MASK;
-}
-
-static inline const char *field_str(const struct field *f, int e)
-{
-       return (field_format(f, e) == FF_STR) ? f[e].u.str : "";
-}
-
-static inline struct field mkf_s32(uint32_t type, int32_t value)
-{
-       struct field f = { .type = FF_S32 | type, .u.s32 = value };
-       return f;
-}
-
-static inline struct field mkf_u32(uint32_t type, uint32_t value)
-{
-       struct field f = { .type = FF_U32 | type, .u.u32 = value };
-       return f;
-}
-
-static inline struct field mkf_s64(uint32_t type, int64_t value)
-{
-       struct field f = { .type = FF_S64 | type, .u.s64 = value };
-       return f;
-}
-
-static inline struct field mkf_u64(uint32_t type, uint64_t value)
-{
-       struct field f = { .type = FF_U64 | type, .u.u64 = value };
-       return f;
-}
-
-static inline struct field mkf_str(uint32_t type, const char *value)
-{
-       struct field f = { .type = FF_STR | type, .u.str = value };
-       return f;
-}
-
-/* These two structs contains all field names according with
- * the the number of entries in "enum stat_field" and
- * "enum info_field"
+/* Stats fields for CSV output. For any field added here, please add the text
+ * representation in the stat_field_names array below. Please only append at the end,
+ * before the ST_F_TOTAL_FIELDS entry, and never insert anything in the middle
+ * nor at the beginning.
  */
-extern const char *info_field_names[];
-extern const char *stat_field_names[];
-
-int stats_fill_info(struct field *info, int len);
-int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len);
-int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
-                        struct field *stats, int len);
-int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
-                        struct field *stats, int len);
-int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len);
-
-extern struct applet http_stats_applet;
-
-void stats_io_handler(struct stream_interface *si);
-int stats_emit_raw_data_field(struct chunk *out, const struct field *f);
-int stats_emit_typed_data_field(struct chunk *out, const struct field *f);
-int stats_emit_field_tags(struct chunk *out, const struct field *f, char delim);
-
-
-struct cli_kw {
-       const char *str_kw[5];   /* keywords ended by NULL, limited to 5
-                                separated keywords combination */
-       const char *usage;   /* usage message */
-       int (*parse)(char **args, struct appctx *appctx, void *private);
-       int (*io_handler)(struct appctx *appctx);
-       void (*io_release)(struct appctx *appctx);
-       void *private;
-};
-
-struct cli_kw_list {
-       struct list list;
-       struct cli_kw kw[VAR_ARRAY];
-};
-
-struct cli_kw* cli_find_kw(char **args);
-void cli_register_kw(struct cli_kw_list *kw_list);
-
-/* stats socket states */
-enum {
-       STAT_CLI_INIT = 0,   /* initial state, must leave to zero ! */
-       STAT_CLI_END,        /* final state, let's close */
-       STAT_CLI_GETREQ,     /* wait for a request */
-       STAT_CLI_OUTPUT,     /* all states after this one are responses */
-       STAT_CLI_PROMPT,     /* display the prompt (first output, same code) */
-       STAT_CLI_PRINT,      /* display message in cli->msg */
-       STAT_CLI_PRINT_FREE, /* display message in cli->msg. After the display, free the pointer */
-       STAT_CLI_O_INFO,     /* dump info */
-       STAT_CLI_O_SESS,     /* dump streams */
-       STAT_CLI_O_ERR,      /* dump errors */
-       STAT_CLI_O_TAB,      /* dump tables */
-       STAT_CLI_O_CLR,      /* clear tables */
-       STAT_CLI_O_SET,      /* set entries in tables */
-       STAT_CLI_O_STAT,     /* dump stats */
-       STAT_CLI_O_PATS,     /* list all pattern reference available */
-       STAT_CLI_O_PAT,      /* list all entries of a pattern */
-       STAT_CLI_O_MLOOK,    /* lookup a map entry */
-       STAT_CLI_O_POOLS,    /* dump memory pools */
-       STAT_CLI_O_TLSK,     /* list all TLS ticket keys references */
-       STAT_CLI_O_TLSK_ENT, /* list all TLS ticket keys entries for a reference */
-       STAT_CLI_O_RESOLVERS,/* dump a resolver's section nameservers counters */
-       STAT_CLI_O_SERVERS_STATE, /* dump server state and changing information */
-       STAT_CLI_O_BACKEND,  /* dump backend list */
-       STAT_CLI_O_ENV,      /* dump environment */
-       STAT_CLI_O_CUSTOM,   /* custom callback pointer */
-};
-
-/* Actions available for the stats admin forms */
-enum {
-       ST_ADM_ACTION_NONE = 0,
-
-       /* enable/disable health checks */
-       ST_ADM_ACTION_DHLTH,
-       ST_ADM_ACTION_EHLTH,
-
-       /* force health check status */
-       ST_ADM_ACTION_HRUNN,
-       ST_ADM_ACTION_HNOLB,
-       ST_ADM_ACTION_HDOWN,
-
-       /* enable/disable agent checks */
-       ST_ADM_ACTION_DAGENT,
-       ST_ADM_ACTION_EAGENT,
-
-       /* force agent check status */
-       ST_ADM_ACTION_ARUNN,
-       ST_ADM_ACTION_ADOWN,
-
-       /* set admin state */
-       ST_ADM_ACTION_READY,
-       ST_ADM_ACTION_DRAIN,
-       ST_ADM_ACTION_MAINT,
-       ST_ADM_ACTION_SHUTDOWN,
-       /* these are the ancient actions, still available for compatibility */
-       ST_ADM_ACTION_DISABLE,
-       ST_ADM_ACTION_ENABLE,
-       ST_ADM_ACTION_STOP,
-       ST_ADM_ACTION_START,
-};
-
-
-/* data transmission states for the stats responses */
-enum {
-       STAT_ST_INIT = 0,
-       STAT_ST_HEAD,
-       STAT_ST_INFO,
-       STAT_ST_LIST,
-       STAT_ST_END,
-       STAT_ST_FIN,
-};
+enum stat_field {
+       ST_F_PXNAME,
+       ST_F_SVNAME,
+       ST_F_QCUR,
+       ST_F_QMAX,
+       ST_F_SCUR,
+       ST_F_SMAX,
+       ST_F_SLIM,
+       ST_F_STOT,
+       ST_F_BIN ,
+       ST_F_BOUT,
+       ST_F_DREQ,
+       ST_F_DRESP,
+       ST_F_EREQ,
+       ST_F_ECON,
+       ST_F_ERESP,
+       ST_F_WRETR,
+       ST_F_WREDIS,
+       ST_F_STATUS,
+       ST_F_WEIGHT,
+       ST_F_ACT,
+       ST_F_BCK,
+       ST_F_CHKFAIL,
+       ST_F_CHKDOWN,
+       ST_F_LASTCHG,
+       ST_F_DOWNTIME,
+       ST_F_QLIMIT,
+       ST_F_PID,
+       ST_F_IID,
+       ST_F_SID,
+       ST_F_THROTTLE,
+       ST_F_LBTOT,
+       ST_F_TRACKED,
+       ST_F_TYPE,
+       ST_F_RATE,
+       ST_F_RATE_LIM,
+       ST_F_RATE_MAX,
+       ST_F_CHECK_STATUS,
+       ST_F_CHECK_CODE,
+       ST_F_CHECK_DURATION,
+       ST_F_HRSP_1XX,
+       ST_F_HRSP_2XX,
+       ST_F_HRSP_3XX,
+       ST_F_HRSP_4XX,
+       ST_F_HRSP_5XX,
+       ST_F_HRSP_OTHER,
+       ST_F_HANAFAIL,
+       ST_F_REQ_RATE,
+       ST_F_REQ_RATE_MAX,
+       ST_F_REQ_TOT,
+       ST_F_CLI_ABRT,
+       ST_F_SRV_ABRT,
+       ST_F_COMP_IN,
+       ST_F_COMP_OUT,
+       ST_F_COMP_BYP,
+       ST_F_COMP_RSP,
+       ST_F_LASTSESS,
+       ST_F_LAST_CHK,
+       ST_F_LAST_AGT,
+       ST_F_QTIME,
+       ST_F_CTIME,
+       ST_F_RTIME,
+       ST_F_TTIME,
+       ST_F_AGENT_STATUS,
+       ST_F_AGENT_CODE,
+       ST_F_AGENT_DURATION,
+       ST_F_CHECK_DESC,
+       ST_F_AGENT_DESC,
+       ST_F_CHECK_RISE,
+       ST_F_CHECK_FALL,
+       ST_F_CHECK_HEALTH,
+       ST_F_AGENT_RISE,
+       ST_F_AGENT_FALL,
+       ST_F_AGENT_HEALTH,
+       ST_F_ADDR,
+       ST_F_COOKIE,
+       ST_F_MODE,
+       ST_F_ALGO,
+       ST_F_CONN_RATE,
+       ST_F_CONN_RATE_MAX,
+       ST_F_CONN_TOT,
+       ST_F_INTERCEPTED,
+       ST_F_DCON,
+       ST_F_DSES,
 
-/* data transmission states for the stats responses inside a proxy */
-enum {
-       STAT_PX_ST_INIT = 0,
-       STAT_PX_ST_TH,
-       STAT_PX_ST_FE,
-       STAT_PX_ST_LI,
-       STAT_PX_ST_SV,
-       STAT_PX_ST_BE,
-       STAT_PX_ST_END,
-       STAT_PX_ST_FIN,
+       /* must always be the last one */
+       ST_F_TOTAL_FIELDS
 };
 
 
-int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_auth *uri);
-
-#endif /* _PROTO_DUMPSTATS_H */
-
-/*
- * Local variables:
- *  c-indent-level: 8
- *  c-basic-offset: 8
- * End:
- */
+#endif /* _TYPES_STATS_H */
index 7b05727a77f19ddec3679e4ec768f8da19856260..b0e636ce83ad8a55005f0566db44281e097bdea2 100644 (file)
@@ -51,6 +51,7 @@
 #include <types/peers.h>
 #include <types/mailers.h>
 #include <types/dns.h>
+#include <types/stats.h>
 
 #include <proto/acl.h>
 #include <proto/auth.h>
@@ -58,7 +59,7 @@
 #include <proto/channel.h>
 #include <proto/checks.h>
 #include <proto/compression.h>
-#include <proto/dumpstats.h>
+#include <proto/stats.h>
 #include <proto/filters.h>
 #include <proto/frontend.h>
 #include <proto/hdr_idx.h>
index a9b89d0908480182176c252f615c32270b622306..61d376852221a60224c2a27c3f1df9b3e48dc265 100644 (file)
@@ -39,6 +39,7 @@
 #include <types/global.h>
 #include <types/mailers.h>
 #include <types/dns.h>
+#include <types/stats.h>
 
 #ifdef USE_OPENSSL
 #include <types/ssl_sock.h>
@@ -47,7 +48,7 @@
 
 #include <proto/backend.h>
 #include <proto/checks.h>
-#include <proto/dumpstats.h>
+#include <proto/stats.h>
 #include <proto/fd.h>
 #include <proto/log.h>
 #include <proto/queue.h>
index d7de7cb0699981876ae0a9664672d31ea70a05fa..e15fc8af7384226bc397da5068c2e37619e4c890 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
 #include <common/base64.h>
 
 #include <types/applet.h>
+#include <types/cli.h>
 #include <types/global.h>
 #include <types/dns.h>
+#include <types/stats.h>
 
 #include <proto/backend.h>
 #include <proto/channel.h>
 #include <proto/checks.h>
 #include <proto/compression.h>
-#include <proto/dumpstats.h>
+#include <proto/stats.h>
 #include <proto/fd.h>
 #include <proto/freq_ctr.h>
 #include <proto/frontend.h>
index 5594484042123a584302dc40bcea4ab7367a757b..5595446c093ba94ec33fd4b930d0126b42d6aab8 100644 (file)
 
 #include <common/cfgparse.h>
 
+#include <types/cli.h>
 #include <types/hlua.h>
 #include <types/proxy.h>
+#include <types/stats.h>
 
 #include <proto/arg.h>
 #include <proto/applet.h>
 #include <proto/channel.h>
+#include <proto/cli.h>
 #include <proto/connection.h>
-#include <proto/dumpstats.h>
+#include <proto/stats.h>
 #include <proto/hdr_idx.h>
 #include <proto/hlua.h>
 #include <proto/hlua_fcn.h>
index a21065dc3472698ed0876c51105c27da4df84e95..3af4f6e20997e09075e37538adb6c199f6ece5b3 100644 (file)
 #include <common/time.h>
 #include <common/uri_auth.h>
 
+#include <types/cli.h>
 #include <types/hlua.h>
 #include <types/proxy.h>
+#include <types/stats.h>
 
-#include <proto/dumpstats.h>
 #include <proto/proto_http.h>
 #include <proto/proxy.h>
 #include <proto/server.h>
+#include <proto/stats.h>
 
 /* Contains the class reference of the concat object. */
 static int class_concat_ref;
index 650e02a29306681568366d32a8cc7335601cb879..181dfc2bf30ef12f5735f9ab09bb770d021353ea 100644 (file)
@@ -41,6 +41,7 @@
 #include <types/capture.h>
 #include <types/filters.h>
 #include <types/global.h>
+#include <types/stats.h>
 
 #include <proto/acl.h>
 #include <proto/action.h>
@@ -50,7 +51,7 @@
 #include <proto/channel.h>
 #include <proto/checks.h>
 #include <proto/compression.h>
-#include <proto/dumpstats.h>
+#include <proto/stats.h>
 #include <proto/fd.h>
 #include <proto/filters.h>
 #include <proto/frontend.h>
index 713629e61b42f180f1a7a375487751f227762f08..aef6299f7af1fa1012bcbb61b3f111068542e3f0 100644 (file)
 #include <types/applet.h>
 #include <types/global.h>
 #include <types/dns.h>
+#include <types/stats.h>
 
 #include <proto/backend.h>
 #include <proto/channel.h>
 #include <proto/checks.h>
 #include <proto/compression.h>
-#include <proto/dumpstats.h>
+#include <proto/stats.h>
 #include <proto/fd.h>
 #include <proto/freq_ctr.h>
 #include <proto/frontend.h>
index 288d36defea98d742ae222a7a5abf6d01ef05baf..346e7b61b4e24072ad531d88145cb95b1a9dec0a 100644 (file)
@@ -24,6 +24,7 @@
 #include <types/capture.h>
 #include <types/filters.h>
 #include <types/global.h>
+#include <types/stats.h>
 
 #include <proto/acl.h>
 #include <proto/action.h>
@@ -32,7 +33,7 @@
 #include <proto/channel.h>
 #include <proto/checks.h>
 #include <proto/connection.h>
-#include <proto/dumpstats.h>
+#include <proto/stats.h>
 #include <proto/fd.h>
 #include <proto/filters.h>
 #include <proto/freq_ctr.h>