#include <sys/types.h>
#include <pwd.h>
+#include <signal.h>
#include <pthread.h>
/*
* Private variables
*/
-static data_source_t dsrc_counter[1] =
-{
- {"value", DS_TYPE_COUNTER, NAN, NAN}
-};
-
-static data_set_t ds_counter =
-{
- "counter", STATIC_ARRAY_SIZE (dsrc_counter), dsrc_counter
-};
-
-static data_source_t dsrc_gauge[1] =
-{
- {"value", DS_TYPE_GAUGE, NAN, NAN}
-};
-
-static data_set_t ds_gauge =
-{
- "gauge", STATIC_ARRAY_SIZE (dsrc_gauge), dsrc_gauge
-};
-
static const char *config_keys[] =
{
"Exec"
pl->pid = 0;
pthread_exit ((void *) 0);
+ return (NULL);
} /* void *exec_read_one */
static int exec_read (void)
return (0);
} /* int exec_read */
-void module_register (modreg_e load)
+static int exec_shutdown (void)
{
- if (load & MR_DATASETS)
- {
- plugin_register_data_set (&ds_counter);
- plugin_register_data_set (&ds_gauge);
- }
+ program_list_t *pl;
+ program_list_t *next;
- if (load & MR_READ)
+ pl = pl_head;
+ while (pl != NULL)
{
- plugin_register_config ("exec", exec_config, config_keys, config_keys_num);
- plugin_register_read ("exec", exec_read);
- }
+ 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 (void)
+{
+ 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 */
/*