diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2020-11-24 20:00:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 20:00:02 +0200 |
commit | e9d59e37d98db379fcbeeffeb6046af0f9cb2d2f (patch) | |
tree | c3021cf3e74efe8c47f63a39ad581347604bc404 /collectors/plugins.d | |
parent | ab3b4c6ff82f2cbbcaf5816b9d599abce5ac2160 (diff) |
Migrate metadata log to SQLite (#10139)
Diffstat (limited to 'collectors/plugins.d')
-rw-r--r-- | collectors/plugins.d/pluginsd_parser.c | 13 | ||||
-rw-r--r-- | collectors/plugins.d/pluginsd_parser.h | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c index a02dcf006e..aee8d33434 100644 --- a/collectors/plugins.d/pluginsd_parser.c +++ b/collectors/plugins.d/pluginsd_parser.c @@ -274,7 +274,7 @@ PARSER_RC pluginsd_end(char **words, void *user, PLUGINSD_ACTION *plugins_actio PARSER_RC pluginsd_chart(char **words, void *user, PLUGINSD_ACTION *plugins_action) { RRDHOST *host = ((PARSER_USER_OBJECT *) user)->host; - if (unlikely(!host)) { + if (unlikely(!host && !((PARSER_USER_OBJECT *) user)->host_exists)) { debug(D_PLUGINSD, "Ignoring chart belonging to missing or ignored host."); return PARSER_RC_OK; } @@ -303,7 +303,10 @@ PARSER_RC pluginsd_chart(char **words, void *user, PLUGINSD_ACTION *plugins_act // make sure we have the required variables if (unlikely((!type || !*type || !id || !*id))) { - error("requested a CHART, without a type.id, on host '%s'. Disabling it.", host->hostname); + if (likely(host)) + error("requested a CHART, without a type.id, on host '%s'. Disabling it.", host->hostname); + else + error("requested a CHART, without a type.id. Disabling it."); ((PARSER_USER_OBJECT *) user)->enabled = 0; return PARSER_RC_ERROR; } @@ -375,7 +378,7 @@ PARSER_RC pluginsd_dimension(char **words, void *user, PLUGINSD_ACTION *plugins RRDSET *st = ((PARSER_USER_OBJECT *) user)->st; RRDHOST *host = ((PARSER_USER_OBJECT *) user)->host; - if (unlikely(!host)) { + if (unlikely(!host && !((PARSER_USER_OBJECT *) user)->host_exists)) { debug(D_PLUGINSD, "Ignoring dimension belonging to missing or ignored host."); return PARSER_RC_OK; } @@ -387,7 +390,7 @@ PARSER_RC pluginsd_dimension(char **words, void *user, PLUGINSD_ACTION *plugins goto disable; } - if (unlikely(!st)) { + if (unlikely(!st && !((PARSER_USER_OBJECT *) user)->st_exists)) { error("requested a DIMENSION, without a CHART, on host '%s'. Disabling it.", host->hostname); goto disable; } @@ -409,7 +412,7 @@ PARSER_RC pluginsd_dimension(char **words, void *user, PLUGINSD_ACTION *plugins if (unlikely(!algorithm || !*algorithm)) algorithm = "absolute"; - if (unlikely(rrdset_flag_check(st, RRDSET_FLAG_DEBUG))) + if (unlikely(st && rrdset_flag_check(st, RRDSET_FLAG_DEBUG))) debug( D_PLUGINSD, "creating dimension in chart %s, id='%s', name='%s', algorithm='%s', multiplier=%ld, divisor=%ld, hidden='%s'", diff --git a/collectors/plugins.d/pluginsd_parser.h b/collectors/plugins.d/pluginsd_parser.h index ba79373cd6..61e9c9babb 100644 --- a/collectors/plugins.d/pluginsd_parser.h +++ b/collectors/plugins.d/pluginsd_parser.h @@ -16,6 +16,8 @@ typedef struct parser_user_object { struct label *new_labels; size_t count; int enabled; + uint8_t st_exists; + uint8_t host_exists; void *private; // the user can set this for private use } PARSER_USER_OBJECT; |