char buffer[1024];
#ifdef HAVE_SETENV
- ssnprintf (buffer, sizeof (buffer), "%i", interval_g);
+ ssnprintf (buffer, sizeof (buffer), "%.3f",
+ CDTIME_T_TO_DOUBLE (plugin_get_interval ()));
setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
ssnprintf (buffer, sizeof (buffer), "%s", hostname_g);
setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
#else
- ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%i", interval_g);
+ ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%.3f",
+ CDTIME_T_TO_DOUBLE (plugin_get_interval ()));
putenv (buffer);
ssnprintf (buffer, sizeof (buffer), "COLLECTD_HOSTNAME=%s", hostname_g);
close (fd_pipe_out[1]);
}
- /* Now connect the `out' pipe to STDOUT */
+ /* Now connect the `err' pipe to STDERR */
if (fd_pipe_err[1] != STDERR_FILENO)
{
dup2 (fd_pipe_err[1], STDERR_FILENO);
return (handle_putnotif (stdout, buffer));
else
{
- /* For backwards compatibility */
- char tmp[1220];
- /* Let's annoy the user a bit.. */
- INFO ("exec plugin: Prepending `PUTVAL' to this line: %s", buffer);
- ssnprintf (tmp, sizeof (tmp), "PUTVAL %s", buffer);
- return (handle_putval (stdout, tmp));
+ ERROR ("exec plugin: Unable to parse command, ignoring line: \"%s\"",
+ buffer);
+ return (-1);
}
} /* int parse_line }}} */
fprintf (fh,
"Severity: %s\n"
- "Time: %u\n",
- severity, (unsigned int) n->time);
+ "Time: %.3f\n",
+ severity, CDTIME_T_TO_DOUBLE (n->time));
/* Print the optional fields */
if (strlen (n->host) > 0)
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- pthread_create (&t, &attr, exec_read_one, (void *) pl);
+ plugin_thread_create (&t, &attr, exec_read_one, (void *) pl);
pthread_attr_destroy (&attr);
} /* for (pl) */
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- pthread_create (&t, &attr, exec_notification_one, (void *) pln);
+ plugin_thread_create (&t, &attr, exec_notification_one, (void *) pln);
pthread_attr_destroy (&attr);
} /* for (pl) */