summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9c15c06)
raw | patch | inline | side by side (parent: 9c15c06)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 28 Sep 2008 19:12:22 +0000 (19:12 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 28 Sep 2008 19:12:22 +0000 (19:12 +0000) |
program/doc/rrdcached.pod | patch | blob | history | |
program/src/rrd_daemon.c | patch | blob | history |
index bf289c592d7aff9e5d195104dcf39e0d2bb55c53..9254888e8306b2d6dad7a087a78837072516fc90 100644 (file)
(possibly moving it there if the node is already enqueued). The answer will be
sent B<after> the node has been dequeued.
+=item B<FLUSHALL>
+
+Causes the daemon to start flushing ALL pending values to disk. This
+returns immediately, even though the writes may take a long time.
+
=item B<HELP> [I<command>]
Returns a short usage message. If no command is given, or I<command> is
index f746a35c876680920dc7329aca82b26163c68ebf..0e29f131ab1387fa657ae0160e2e6d956de4bab7 100644 (file)
--- a/program/src/rrd_daemon.c
+++ b/program/src/rrd_daemon.c
char *help_help[] =
{
- "4 Command overview\n",
+ "5 Command overview\n",
"FLUSH <filename>\n",
+ "FLUSHALL\n",
"HELP [<command>]\n",
"UPDATE <filename> <values> [<values> ...]\n",
"STATS\n"
};
size_t help_flush_len = sizeof (help_flush) / sizeof (help_flush[0]);
+ char *help_flushall[] =
+ {
+ "3 Help for FLUSHALL\n",
+ "Usage: FLUSHALL\n",
+ "\n",
+ "Triggers writing of all pending updates. Returns immediately.\n"
+ };
+ size_t help_flushall_len = sizeof(help_flushall) / sizeof(help_flushall[0]);
+
char *help_update[] =
{
"9 Help for UPDATE\n",
help_text = help_flush;
help_text_len = help_flush_len;
}
+ else if (strcasecmp (command, "flushall") == 0)
+ {
+ help_text = help_flushall;
+ help_text_len = help_flushall_len;
+ }
else if (strcasecmp (command, "stats") == 0)
{
help_text = help_stats;
return (0);
} /* }}} int handle_request_flush */
+static int handle_request_flushall(int fd) /* {{{ */
+{
+ int status;
+ char answer[] ="0 Started flush.\n";
+
+ RRDD_LOG(LOG_DEBUG, "Received FLUSHALL");
+
+ pthread_mutex_lock(&cache_lock);
+ flush_old_values(-1);
+ pthread_mutex_unlock(&cache_lock);
+
+ status = swrite(fd, answer, strlen(answer));
+ if (status < 0)
+ {
+ status = errno;
+ RRDD_LOG(LOG_INFO, "handle_request_flushall: swrite returned an error.");
+ }
+
+ return (status);
+}
+
static int handle_request_update (int fd, /* {{{ */
char *buffer, size_t buffer_size)
{
@@ -1222,6 +1258,10 @@ static int handle_request (int fd, char *buffer, size_t buffer_size) /* {{{ */
{
return (handle_request_flush (fd, buffer_ptr, buffer_size));
}
+ else if (strcasecmp (command, "flushall") == 0)
+ {
+ return (handle_request_flushall(fd));
+ }
else if (strcasecmp (command, "stats") == 0)
{
return (handle_request_stats (fd, buffer_ptr, buffer_size));