# MaxConns 5
#</Plugin>
+#<Plugin exec>
+# Exec user "/path/to/exec"
+#</Plugin>
+
#<Plugin hddtemp>
# Host "127.0.0.1"
# Port 7634
=back
+=head2 Plugin C<exec>
+
+Please make sure to read L<collectd/"SPECIAL PLUGINS"> before using this
+plugin. It containes valueable information on when the executable is executed
+and the output that is expected from it.
+
+=over 4
+
+=item B<Exec> I<User> I<Executable>
+
+Execute the executable I<Executable> as user I<User>.
+
+=back
+
=head2 Plugin C<hddtemp>
=over 4
Each line is limited to 256 characters (including the newline character).
Longer lines will be ignored.
+=head2 exec
+
+The C<exec> plugin forks of an executable and reads back values that it writes
+to C<STDOUT>. The executable is forked kind of as L<init> does: It is forked
+once and not again until it exits. If it exited, it will be forked again after
+at most I<Interval> seconds. It is perfectly legal for the executable to run
+for a long time and continuously write values to C<STDOUT>.
+
+The forked executable is expected to print values to C<STDOUT>. The expected
+format is as follows:
+
+=over 4
+
+=item
+
+Each line beginning with a C<#> (hash mark) is ignored.
+
+=item
+
+Any other line must be of the form C<I<type>,I<type-instance>,I<value>>, where
+I<type> is either B<counter> or B<gauge>, I<type-instance> may not contain
+C<,> (comma), C</> (slash) and C<\0> (null byte) and I<value> is either an
+integer (if I<type> is B<counter>) or a floating-point number (if I<type> is
+B<gauge>).
+
+=back
+
+The values are always considered to be "fresh", i.E<nbsp>e. the time is set to
+"now".
+
+When collectd exits it sends a B<SIGTERM> to all still running
+child-processes upon which they have to quit.
+
=head2 mysql
Requires B<mysqlclient> to be installed. It connects to the database when
if (value_list_to_filename (filename, sizeof (filename), ds, vl) != 0)
return (-1);
- DEBUG ("filename = %s;", filename);
+ DEBUG ("csv plugin: csv_write: filename = %s;", filename);
if (value_list_to_string (values, sizeof (values), ds, vl) != 0)
return (-1);
#include <sys/types.h>
#include <pwd.h>
+#include <signal.h>
#include <pthread.h>
pl->pid = 0;
pthread_exit ((void *) 0);
+ return (NULL);
} /* void *exec_read_one */
static int exec_read (void)
return (0);
} /* int exec_read */
+static int exec_shutdown (void)
+{
+ program_list_t *pl;
+ program_list_t *next;
+
+ pl = pl_head;
+ while (pl != NULL)
+ {
+ next = pl->next;
+
+ if (pl->pid > 0)
+ {
+ kill (pl->pid, SIGTERM);
+ INFO ("exec plugin: Sent SIGTERM to %hu", (unsigned short int) pl->pid);
+ }
+
+ sfree (pl->user);
+ sfree (pl);
+
+ pl = next;
+ } /* while (pl) */
+ pl_head = NULL;
+
+ return (0);
+} /* int exec_shutdown */
+
void module_register (modreg_e load)
{
if (load & MR_DATASETS)
{
plugin_register_config ("exec", exec_config, config_keys, config_keys_num);
plugin_register_read ("exec", exec_read);
+ plugin_register_shutdown ("exec", exec_shutdown);
}
} /* void module_register */
value_cache_t *vc;
int i;
- DEBUG ("ds->ds_num = %i; vl->values_len = %i;",
+ DEBUG ("unixsock plugin: cache_insert: ds->ds_num = %i;"
+ " vl->values_len = %i;",
ds->ds_num, vl->values_len);
assert (ds->ds_num == vl->values_len);