summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 52c0d63)
raw | patch | inline | side by side (parent: 52c0d63)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 7 Mar 2009 10:31:51 +0000 (10:31 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 7 Mar 2009 10:31:51 +0000 (10:31 +0000) |
diff --git a/program/NEWS b/program/NEWS
index 2c26f685c185ac4d80dd134e3a884c5516a1006b..7d0c920499ec453888a27d7ab3f51d6538b9c04e 100644 (file)
--- a/program/NEWS
+++ b/program/NEWS
RRDgraph
--------
* VDEF PERCENTNAN (PRECENT that ignores NAN)
+
+RRDflush
+--------
+* instruct the rrdcached to flush all its data
index a5b9fb75b12884e855d80320a795364a96788bf8..2060f3bf62bf3c77fb875c1e01124785444fe506 100644 (file)
return 3;
}
+static int
+lua_rrd_flush(lua_State *L)
+{
+ return rrd_common_call(L, "flush", rrd_cmd_flush);
+}
+
#if defined(DINF)
static int
lua_rrd_info (lua_State * L)
{"restore", lua_rrd_restore},
{"tune", lua_rrd_tune},
{"update", lua_rrd_update},
+ {"flush", lua_rrd_flush},
#if defined(DINF)
{"info", lua_rrd_info},
{"updatev", lua_rrd_updatev},
index ba2abfbf5d37f18fc8d099dce868041daa1ec53d..3f88c92b08f52e47ed47a850d4c06a4c156b35f1 100644 (file)
RRDs::times(start, end)
RRDs::dump ...
RRDs::restore ...
+ RRDs::flush ...
=head1 DESCRIPTION
index 25d44a51c555aa30312608e803fd4c121998dfc8..3cf1d2470f1bb08eff09f84464ca5079a9aed6f2 100644 (file)
OUTPUT:
RETVAL
+int
+rrd_flush(...)
+ PROTOTYPE: @
+ PREINIT:
+ int i;
+ char **argv;
+ CODE:
+ rrdcode(rrd_cmd_flush);
+ OUTPUT:
+ RETVAL
index 2771720711310ab670cfc1e0ac2589122cae0c2d..bd16da17e69ffee7f30c29210dc7569c4001caa6 100644 (file)
return r;
}
+static char PyRRD_flush__doc__[] =
+ "flush(args..): flush RRD files from memory\n"
+ " flush [--daemon address] file [file ...]";
+
+static PyObject *PyRRD_flush(
+ PyObject UNUSED(*self),
+ PyObject * args)
+{
+ PyObject *r;
+ int argc;
+ char **argv;
+
+ if (create_args("flush", args, &argc, &argv) < 0)
+ return NULL;
+
+ if (rrd_cmd_flush(argc, argv) != 0) {
+ PyErr_SetString(ErrorObject, rrd_get_error());
+ rrd_clear_error();
+ r = NULL;
+ } else {
+ Py_INCREF(Py_None);
+ r = Py_None;
+ }
+
+ destroy_args(&argv);
+ return r;
+}
+
/* List of methods defined in the module */
#define meth(name, func, doc) {name, (PyCFunction)func, METH_VARARGS, doc}
meth("info", PyRRD_info, PyRRD_info__doc__),
meth("graphv", PyRRD_graphv, PyRRD_graphv__doc__),
meth("updatev", PyRRD_updatev, PyRRD_updatev__doc__),
+ meth("flush", PyRRD_flush, PyRRD_flush__doc__),
{NULL, NULL, 0, NULL}
};
index 551203bf8626a10ce1159a113fb1275635646edf..408994f18bf6b3215093c02232e309950e976059 100644 (file)
return rrd_call(rrd_update, args);
}
+VALUE rb_rrd_flush(
+ VALUE self,
+ VALUE args)
+{
+ return rrd_call(rrd_cmd_flush, args);
+}
+
/* Calls Returning Data via the Info Interface */
rb_define_module_function(mRRD, "restore", rb_rrd_restore, -2);
rb_define_module_function(mRRD, "tune", rb_rrd_tune, -2);
rb_define_module_function(mRRD, "update", rb_rrd_update, -2);
+ rb_define_module_function(mRRD, "flush", rb_rrd_flush, -2);
rb_define_module_function(mRRD, "info", rb_rrd_info, -2);
rb_define_module_function(mRRD, "updatev", rb_rrd_updatev, -2);
rb_define_module_function(mRRD, "graphv", rb_rrd_graphv, -2);
index 7f604d980e96b6bb7138ed042dd6ef01b471848f..f8a3c84582571554ca2f913edcc47f59db98fde1 100644 (file)
return TCL_OK;
}
+/* Thread-safe version */
+static int Rrd_Flush(
+ ClientData __attribute__((unused)) clientData,
+ Tcl_Interp *interp,
+ int argc,
+ CONST84 char *argv[])
+{
+ if (argc < 2) {
+ Tcl_AppendResult(interp, "RRD Error: needs rrd filename",
+ (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ rrd_cmd_flush(argc, (char**)argv);
+
+ if (rrd_test_error()) {
+ Tcl_AppendResult(interp, "RRD Error: ",
+ rrd_get_error(), (char *) NULL);
+ rrd_clear_error();
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
/* Thread-safe version */
static CmdInfo rrdCmds[] = {
{"Rrd::create", Rrd_Create, 1}, /* Thread-safe version */
{"Rrd::dump", Rrd_Dump, 0}, /* Thread-safe version */
+ {"Rrd::flush", Rrd_Flush, 0},
{"Rrd::last", Rrd_Last, 0}, /* Thread-safe version */
{"Rrd::lastupdate", Rrd_Lastupdate, 0}, /* Thread-safe version */
{"Rrd::update", Rrd_Update, 1}, /* Thread-safe version */
index 514bd35fe95a6f19147591443c4ab58cdb095390..5dbc60a7a502994a63d5f85438c15bc54a706ed9 100644 (file)
--- a/program/doc/rrdflush.pod
+++ b/program/doc/rrdflush.pod
=head1 SYNOPSIS
-B<rrdtool> B<flush> I<filename>
+B<rrdtool> B<flush>
S<[B<--daemon> I<address>]>
+I<filename> [I<filename> ...]
=head1 DESCRIPTION
-The B<flush> function connects to L<rrdcached>, the RRD caching daemon, and
-issues a "flush" command for the given file. The daemon will put this file to
-the head of the update queue so it is written "soon". The status will be
-returned only after the file's pending updates have been written to disk.
+The B<flush> function connects to L<rrdcached>, the RRD caching daemon,
+and issues a "flush" command for the given files. The daemon will put the
+files to the head of the update queue so they are written "soon". The
+status will be returned only after the files' pending updates have been
+written to disk.
=over 8
=item I<filename>
-The name of the B<RRD> that is to be written to disk.
+The name(s) of the B<RRD> file(s) that are to be written to disk.
=item B<--daemon> I<address>
index 218a65a4f0a8660a60a831b27f3ba629773a2baf..2d8df3aeed16585305832ce75db0e65ca15735ff 100644 (file)
--- a/program/src/rrd_flush.c
+++ b/program/src/rrd_flush.c
{
char *opt_daemon = NULL;
int status;
+ int i;
/* initialize getopt */
optind = 0;
}
} /* while (42) */
- if ((argc - optind) != 1)
+ if ((argc - optind) < 1)
{
- rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file>", argv[0]);
+ rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file> [<file> ...]", argv[0]);
return (-1);
}
return (-1);
}
- status = rrdc_flush(argv[optind]);
+ status = 0;
+ for (int i = optind; i < argc; i++)
+ {
+ status = rrdc_flush(argv[i]);
+ if (status) break;
+ }
return ((status == 0) ? 0 : -1);
} /* int rrd_flush */