2 * collectd - src/rrdc.c
3 * Copyright (C) 2008 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; only version 2 of the License is applicable.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Florian octo Forster <octo at verplant.org>
27 static void exit_usage (char *name)
29 printf ("Usage: %s <command> [options]\n"
31 "Commands handled by rrdc:\n"
35 "All other commands are passed to rrdtool(1).\n"
36 "\n", basename (name));
38 } /* void exit_usage */
40 int main (int argc, char **argv)
49 || (strcmp (argv[1], "help") == 0))
52 /* rrdc update <file> <value> [<value> ..] */
53 if ((argc >= 4) && (strcmp (argv[1], "update") == 0))
55 status = rrdd_connect (/* path = */ NULL);
58 fprintf (stderr, "rrdd_connect failed: %s\n",
63 status = rrdd_update (argv[2], argc - 3, (void *) (argv + 3));
66 fprintf (stderr, "rrdd_update failed.\n");
71 fprintf (stderr, "rrdd_update failed: %s\n",
81 fprintf (stdout, "RRDc %s Copyright 2008 by Florian Forster "
82 "<octo at verplant.org>\n\n",
86 assert (argv[argc] == NULL);
88 status = execvp ("rrdtool", argv);
89 fprintf (stderr, "execv failed with status %i.\n", status);
95 * vim: set sw=2 sts=2 ts=8 et fdm=marker :