summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2020-11-24 20:00:02 +0200
committerGitHub <noreply@github.com>2020-11-24 20:00:02 +0200
commite9d59e37d98db379fcbeeffeb6046af0f9cb2d2f (patch)
treec3021cf3e74efe8c47f63a39ad581347604bc404 /collectors
parentab3b4c6ff82f2cbbcaf5816b9d599abce5ac2160 (diff)
Migrate metadata log to SQLite (#10139)
Diffstat (limited to 'collectors')
-rw-r--r--collectors/plugins.d/pluginsd_parser.c13
-rw-r--r--collectors/plugins.d/pluginsd_parser.h2
-rw-r--r--collectors/statsd.plugin/statsd.c4
3 files changed, 10 insertions, 9 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;
diff --git a/collectors/statsd.plugin/statsd.c b/collectors/statsd.plugin/statsd.c
index d9b326f605..a8f94130ab 100644
--- a/collectors/statsd.plugin/statsd.c
+++ b/collectors/statsd.plugin/statsd.c
@@ -1464,8 +1464,6 @@ static inline RRDSET *statsd_private_rrdset_create(
, chart_type // chart type
, memory_mode // memory mode
, history // history
- , 0 // not archived
- , NULL // no known UUID
);
rrdset_flag_set(st, RRDSET_FLAG_STORE_FIRST);
@@ -2004,8 +2002,6 @@ static inline void statsd_update_app_chart(STATSD_APP *app, STATSD_APP_CHART *ch
, chart->chart_type // chart type
, app->rrd_memory_mode // memory mode
, app->rrd_history_entries // history
- , 0 // not archived
- , NULL // no known UUID
);
rrdset_flag_set(chart->st, RRDSET_FLAG_STORE_FIRST);