summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 65e9edc)
raw | patch | inline | side by side (parent: 65e9edc)
author | Doug MacEachern <dougm@hyperic.com> | |
Fri, 2 Jan 2009 21:26:01 +0000 (13:26 -0800) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 17 Jan 2009 09:45:34 +0000 (10:45 +0100) |
Signed-off-by: Doug MacEachern <dougm@hyperic.com>
Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
src/collectd.conf.pod | patch | blob | history | |
src/csv.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 5a2536893db6270e8dedac884ffa07214a47bf79..1b07fa832db84d46656794babe1f8b24487a6923 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Set the directory to store CSV-files under. Per default CSV-files are generated
beneath the daemon's working directory, i.E<nbsp>e. the B<BaseDir>.
+The special strings B<stdout> and B<stderr> can be used to write to the standard
+output and standard error channels, respectively. This, of course, only makes
+much sense when collectd is running in foreground- or non-daemon-mode.
=item B<StoreRates> B<true|false>
diff --git a/src/csv.c b/src/csv.c
index a94b7001025419602961980efa993506e9755b33..b5333b436faa1ceb236d1b114e6905875b9316b2 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
static char *datadir = NULL;
static int store_rates = 0;
+static int use_stdio = 0;
static int value_list_to_string (char *buffer, int buffer_len,
const data_set_t *ds, const value_list_t *vl)
return (-1);
offset += status;
+ if (!use_stdio)
{
time_t now;
struct tm stm;
{
if (datadir != NULL)
free (datadir);
+ if (strcasecmp ("stdout", value) == 0)
+ {
+ use_stdio = 1;
+ return (0);
+ }
+ else if (strcasecmp ("stderr", value) == 0)
+ {
+ use_stdio = 2;
+ return (0);
+ }
datadir = strdup (value);
if (datadir != NULL)
{
if (value_list_to_string (values, sizeof (values), ds, vl) != 0)
return (-1);
+ if (use_stdio)
+ {
+ fprintf (use_stdio == 1 ? stdout : stderr,
+ "%s=%s\n", filename, values);
+ return (0);
+ }
+
if (stat (filename, &statbuf) == -1)
{
if (errno == ENOENT)