diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2023-03-08 17:21:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 17:21:58 +0200 |
commit | eaa64624fe3b1fa6c071539854cfb22c2370e5bf (patch) | |
tree | 18479b5223a3db5a2ee1a2075ebab1d5e0c91640 /collectors/plugins.d | |
parent | 34737e3fda17312a4c73ff4d5c3154e733edac8b (diff) |
Send an EOF from charts.d.plugin before exit (#14680)
* send an EOF before exit
* use empty
* make an EXIT keyword
Diffstat (limited to 'collectors/plugins.d')
-rw-r--r-- | collectors/plugins.d/plugins_d.h | 2 | ||||
-rw-r--r-- | collectors/plugins.d/pluginsd_parser.c | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/collectors/plugins.d/plugins_d.h b/collectors/plugins.d/plugins_d.h index 865488d379..68ed4940f3 100644 --- a/collectors/plugins.d/plugins_d.h +++ b/collectors/plugins.d/plugins_d.h @@ -43,6 +43,8 @@ #define PLUGINSD_KEYWORD_HOST_LABEL "HOST_LABEL" #define PLUGINSD_KEYWORD_HOST "HOST" +#define PLUGINSD_KEYWORD_EXIT "EXIT" + #define PLUGINS_FUNCTIONS_TIMEOUT_DEFAULT 10 // seconds #define PLUGINSD_LINE_MAX_SSL_READ 512 diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c index 70a147f25b..787f85d358 100644 --- a/collectors/plugins.d/pluginsd_parser.c +++ b/collectors/plugins.d/pluginsd_parser.c @@ -1902,6 +1902,12 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp_plugi return count; } +PARSER_RC pluginsd_exit(char **words __maybe_unused, size_t num_words __maybe_unused, void *user __maybe_unused) +{ + info("PLUGINSD: plugin called EXIT."); + return PARSER_RC_STOP; +} + static void pluginsd_keywords_init_internal(PARSER *parser, PLUGINSD_KEYWORDS types, void (*add_func)(PARSER *parser, char *keyword, keyword_function func)) { if (types & PARSER_INIT_PLUGINSD) { @@ -1912,6 +1918,8 @@ static void pluginsd_keywords_init_internal(PARSER *parser, PLUGINSD_KEYWORDS ty add_func(parser, PLUGINSD_KEYWORD_HOST_DEFINE_END, pluginsd_host_define_end); add_func(parser, PLUGINSD_KEYWORD_HOST_LABEL, pluginsd_host_labels); add_func(parser, PLUGINSD_KEYWORD_HOST, pluginsd_host); + + add_func(parser, PLUGINSD_KEYWORD_EXIT, pluginsd_exit); } if (types & (PARSER_INIT_PLUGINSD | PARSER_INIT_STREAMING)) { |