2 * collectd - src/utils_cmd_flush.c
3 * Copyright (C) 2008 Sebastian Harl
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 * Sebastian "tokkee" Harl <sh at tokkee.org>
25 int handle_flush (FILE *fh, char **fields, int fields_num)
29 if ((fields_num != 1) && (fields_num != 2))
31 DEBUG ("unixsock plugin: us_handle_flush: "
32 "Wrong number of fields: %i", fields_num);
33 fprintf (fh, "-1 Wrong number of fields: Got %i, expected 1 or 2.\n",
40 timeout = atoi (fields[1]);
42 INFO ("unixsock plugin: flushing all data");
43 plugin_flush_all (timeout);
44 INFO ("unixsock plugin: finished flushing all data");
46 fprintf (fh, "0 Done\n");
49 } /* int handle_flush */
51 /* vim: set sw=4 ts=4 tw=78 noexpandtab : */