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
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);