summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3ecf7e1)
raw | patch | inline | side by side (parent: 3ecf7e1)
author | Florian Forster <octo@collectd.org> | |
Tue, 29 Nov 2016 08:22:51 +0000 (09:22 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 29 Nov 2016 08:22:51 +0000 (09:22 +0100) |
The defaults have been set to the more reasonable 1*interval.
src/collectd.conf.pod | patch | blob | history | |
src/write_tsdb.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 489b7e0b0397be5ef52b91d12d6ffe6885dddeb7..ebd9d27fb2726c32be9bb1d796300adb3140f23a 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
DNS. This can become a problem if the TSDB node is unavailable or badly
configured because collectd will request DNS in order to reconnect for every
metric, which can flood your DNS. So you can cache the last value for
-I<ResolveInterval> seconds (default: B<600>, i.e. 10 minutes).
+I<ResolveInterval> seconds.
+Defaults to the I<Interval> of the I<write_tsdb plugin>, e.g. 10E<nbsp>seconds.
You can also define a jitter, a random interval to wait in addition to
I<ResolveInterval>. This prevents all your collectd servers to resolve the
-hostname at the same time when the connection fails. Default value is 15 * the
-interval of the I<write_tsdb plugin> (defaults to 10 seconds).
+hostname at the same time when the connection fails.
+Defaults to the I<Interval> of the I<write_tsdb plugin>, e.g. 10E<nbsp>seconds.
B<Note:> If the DNS resolution has already been successful when the socket
closes, the plugin will try to reconnect immediately with the cached
diff --git a/src/write_tsdb.c b/src/write_tsdb.c
index fea2b68629a93c03f61ee5eed61cb7dd1a3dab0f..a3b3c3d4d755b6eb9eac36b17c91a0da83800217 100644 (file)
--- a/src/write_tsdb.c
+++ b/src/write_tsdb.c
#define WT_SEND_BUF_SIZE 1428
#endif
-/* Default configuration */
-
-/* WRITE_TSDB_DEFAULT_DNS_TTL is the time we keep the dns cached info
- * (seconds)
- */
-#define WRITE_TSDB_DEFAULT_DNS_TTL 600
-
-/* WRITE_TSDB_DEFAULT_DNS_RANDOM_TTL helps define the max random
- * time we keep the dns cached info :
- * min = 0
- * max = WRITE_TSDB_DEFAULT_DNS_RANDOM_TTL * get_plugin_interval()
- */
-#define WRITE_TSDB_DEFAULT_DNS_RANDOM_TTL 15
-
/*
* Private variables
*/
cdtime_t next_random_ttl;
};
-static cdtime_t resolve_interval =
- TIME_T_TO_CDTIME_T_STATIC(WRITE_TSDB_DEFAULT_DNS_TTL);
+static cdtime_t resolve_interval = 0;
static cdtime_t resolve_jitter = 0;
/*
}
static int wt_config(oconfig_item_t *ci) {
- _Bool config_random_ttl = 0;
+ if ((resolve_interval == 0) && (resolve_jitter == 0))
+ resolve_interval = resolve_jitter = plugin_get_interval();
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
wt_config_tsd(child);
else if (strcasecmp("ResolveInterval", child->key) == 0)
cf_util_get_cdtime(child, &resolve_interval);
- else if (strcasecmp("ResolveJitter", child->key) == 0) {
- config_random_ttl = 1;
+ else if (strcasecmp("ResolveJitter", child->key) == 0)
cf_util_get_cdtime(child, &resolve_jitter);
- } else {
+ else {
ERROR("write_tsdb plugin: Invalid configuration "
"option: %s.",
child->key);
}
}
- if (!config_random_ttl)
- resolve_jitter = CDTIME_T_TO_DOUBLE(WRITE_TSDB_DEFAULT_DNS_RANDOM_TTL *
- plugin_get_interval());
-
return 0;
}