mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-26 14:42:21 +00:00
MEDIUM: stats: define stats-file keyword
This commit is the final to implement preloading of haproxy internal counters via stats-file parsing. Define a global keyword "stats-file". It allows to specify the path to the stats-file which will be parsed on process startup.
This commit is contained in:
parent
782be288ca
commit
e4a29447ce
@ -1318,6 +1318,7 @@ The following keywords are supported in the "global" section :
|
||||
- ssl-server-verify
|
||||
- ssl-skip-self-issued-ca
|
||||
- stats
|
||||
- stats-file
|
||||
- strict-limits
|
||||
- uid
|
||||
- ulimit-n
|
||||
@ -2661,6 +2662,11 @@ stats timeout <timeout, in milliseconds>
|
||||
to change this value with "stats timeout". The value must be passed in
|
||||
milliseconds, or be suffixed by a time unit among { us, ms, s, m, h, d }.
|
||||
|
||||
stats-file <path>
|
||||
Path to a generated haproxy stats-file. On startup haproxy will preload the
|
||||
values to its internal counters. Use the CLI command "dump stats-file" to
|
||||
produce such stats-file. See the management manual for more details.
|
||||
|
||||
strict-limits
|
||||
Makes process fail at startup when a setrlimit fails. HAProxy tries to set the
|
||||
best setrlimit according to what has been calculated. If it fails, it will
|
||||
|
@ -52,6 +52,7 @@ static const char *common_kw_list[] = {
|
||||
"presetenv", "unsetenv", "resetenv", "strict-limits", "localpeer",
|
||||
"numa-cpu-mapping", "defaults", "listen", "frontend", "backend",
|
||||
"peers", "resolvers", "cluster-secret", "no-quic", "limited-quic",
|
||||
"stats-file",
|
||||
NULL /* must be last */
|
||||
};
|
||||
|
||||
@ -1031,6 +1032,21 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
global.server_state_file = strdup(args[1]);
|
||||
}
|
||||
else if (strcmp(args[0], "stats-file") == 0) { /* path to the file where HAProxy can load the server states */
|
||||
if (global.stats_file != NULL) {
|
||||
ha_alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
|
||||
err_code |= ERR_ALERT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!*(args[1])) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expect one argument: a file path.\n", file, linenum, args[0]);
|
||||
err_code |= ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
global.stats_file = strdup(args[1]);
|
||||
}
|
||||
else if (strcmp(args[0], "log-tag") == 0) { /* tag to report to syslog */
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user