summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2e1a81e)
raw | patch | inline | side by side (parent: 2e1a81e)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Sun, 16 Jul 2017 15:56:05 +0000 (22:56 +0700) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 20 Jul 2017 05:52:08 +0000 (07:52 +0200) |
* Value from wrong option was passed to rrd_cache_flush()
* Variable cache_flush_timeout was used as cdtime_t type time while value was set as simple seconds
* Added info message about CacheFlush ajusting
* Documentation updated
* Variable cache_flush_timeout was used as cdtime_t type time while value was set as simple seconds
* Added info message about CacheFlush ajusting
* Documentation updated
src/collectd.conf.pod | patch | blob | history | |
src/rrdtool.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index f88430a05d5a6d78555dc10cc36a2c3d7bc85a1d..27acc9974ea7cf8eac852da1ed7c001966fd7ed4 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
When the C<rrdtool> plugin uses a cache (by setting B<CacheTimeout>, see below)
it writes all values for a certain RRD-file if the oldest value is older than
-(or equal to) the number of seconds specified. If some RRD-file is not updated
+(or equal to) the number of seconds specified by B<CacheTimeout>.
+That check happens on new values arriwal. If some RRD-file is not updated
anymore for some reason (the computer was shut down, the network is broken,
etc.) some values may still be in the cache. If B<CacheFlush> is set, then the
entire cache is searched for entries older than B<CacheTimeout> seconds and
900 seconds might be a good value, though setting this to 7200 seconds doesn't
normally do much harm either.
+Default value for this option is 10x of B<CacheTimeout>.
+If value of B<CacheFlush> less than value of B<CacheTimeout> then default value
+used too.
+
=item B<CacheTimeout> I<Seconds>
If this option is set to a value greater than zero, the C<rrdtool plugin> will
diff --git a/src/rrdtool.c b/src/rrdtool.c
index d357cad0f460734f56991e9045f7d148711c8434..2a1a569888bd2fc6b100b2dd9e392d6356533d21 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
CDTIME_T_TO_DOUBLE(timeout));
now = cdtime();
- timeout = TIME_T_TO_CDTIME_T(timeout);
/* Build a list of entries to be flushed */
iter = c_avl_get_iterator(cache);
if ((cache_timeout > 0) &&
((cdtime() - cache_flush_last) > cache_flush_timeout))
- rrd_cache_flush(cache_flush_timeout);
+ rrd_cache_flush(cache_timeout);
pthread_mutex_unlock(&cache_lock);
"be greater than 0.\n");
return (1);
}
- cache_flush_timeout = tmp;
+ cache_flush_timeout = TIME_T_TO_CDTIME_T(tmp);
} else if (strcasecmp("DataDir", key) == 0) {
char *tmp;
size_t len;
cache_flush_last = cdtime();
if (cache_timeout == 0) {
cache_flush_timeout = 0;
- } else if (cache_flush_timeout < cache_timeout)
+ } else if (cache_flush_timeout < cache_timeout) {
+ INFO("rrdtool plugin: \"CacheFlush %u\" is less than \"CacheTimeout %u\". "
+ "Ajusting \"CacheFlush\" to %u seconds.",
+ (unsigned int)CDTIME_T_TO_TIME_T(cache_flush_timeout),
+ (unsigned int)CDTIME_T_TO_TIME_T(cache_timeout),
+ (unsigned int)CDTIME_T_TO_TIME_T(cache_timeout * 10));
cache_flush_timeout = 10 * cache_timeout;
+ }
pthread_mutex_unlock(&cache_lock);