RRDgraph
--------
* VDEF PERCENTNAN (PRECENT that ignores NAN)
+
+RRDflush
+--------
+* instruct the rrdcached to flush all its data
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},
RRDs::times(start, end)
RRDs::dump ...
RRDs::restore ...
+ RRDs::flush ...
=head1 DESCRIPTION
OUTPUT:
RETVAL
+int
+rrd_flush(...)
+ PROTOTYPE: @
+ PREINIT:
+ int i;
+ char **argv;
+ CODE:
+ rrdcode(rrd_cmd_flush);
+ OUTPUT:
+ RETVAL
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}
};
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);
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 */
=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>
{
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 */