/**
- * collectd - src/plugin.h
+ * collectd - src/daemon/plugin.h
* Copyright (C) 2005-2014 Florian octo Forster
*
* Permission is hereby granted, free of charge, to any person obtaining a
#include "meta_data.h"
#include "utils_time.h"
+#include <pthread.h>
+
#define PLUGIN_FLAGS_GLOBAL 0x0001
-#define DATA_MAX_NAME_LEN 64
+#ifndef DATA_MAX_NAME_LEN
+# define DATA_MAX_NAME_LEN 64
+#endif
#define DS_TYPE_COUNTER 0
#define DS_TYPE_GAUGE 1
struct value_list_s
{
value_t *values;
- int values_len;
+ size_t values_len;
cdtime_t time;
cdtime_t interval;
char host[DATA_MAX_NAME_LEN];
struct data_set_s
{
char type[DATA_MAX_NAME_LEN];
- int ds_num;
+ size_t ds_num;
data_source_t *ds;
};
typedef struct data_set_s data_set_t;
struct plugin_ctx_s
{
cdtime_t interval;
+ cdtime_t flush_interval;
+ cdtime_t flush_timeout;
};
typedef struct plugin_ctx_s plugin_ctx_t;
*/
int plugin_load (const char *name, uint32_t flags);
-void plugin_init_all (void);
+int plugin_init_all (void);
void plugin_read_all (void);
int plugin_read_all_once (void);
-void plugin_shutdown_all (void);
+int plugin_shutdown_all (void);
/*
* NAME
* "plugin_register_complex_read" returns an error (non-zero). */
int plugin_register_complex_read (const char *group, const char *name,
plugin_read_cb callback,
- const struct timespec *interval,
+ cdtime_t interval,
user_data_t *user_data);
int plugin_register_write (const char *name,
plugin_write_cb callback, user_data_t *user_data);
int plugin_unregister_log (const char *name);
int plugin_unregister_notification (const char *name);
+/*
+ * NAME
+ * plugin_log_available_writers
+ *
+ * DESCRIPTION
+ * This function can be called to output a list of _all_ registered
+ * writers to the logfacility.
+ * Since some writers dynamically build their name it can be hard for
+ * the configuring person to know it. This function will fill this gap.
+ */
+void plugin_log_available_writers (void);
/*
* NAME
* plugin_dispatch_multivalue
*
* SYNOPSIS
- * plugin_dispatch_multivalue (vl, 1,
+ * plugin_dispatch_multivalue (vl, 1, DS_TYPE_GAUGE,
* "free", 42.0,
* "used", 58.0,
* NULL);
* calculated and dispatched, rather than the absolute values. Values that are
* NaN are dispatched as NaN and will not influence the total.
*
- * The variadic arguments is a list of type_instance / gauge pairs, that are
- * interpreted as type "char const *" and "gauge_t". The last argument must be
+ * The variadic arguments is a list of type_instance / type pairs, that are
+ * interpreted as type "char const *" and type, encoded by their corresponding
+ * "store_type":
+ *
+ * - "gauge_t" when "DS_TYPE_GAUGE"
+ * - "absolute_t" when "DS_TYPE_ABSOLUTE"
+ * - "derive_t" when "DS_TYPE_DERIVE"
+ * - "counter_t" when "DS_TYPE_COUNTER"
+ *
+ * The last argument must be
* a NULL pointer to signal end-of-list.
*
* RETURNS
*/
__attribute__((sentinel))
int plugin_dispatch_multivalue (value_list_t const *vl,
- _Bool store_percentage, ...);
+ _Bool store_percentage, int store_type, ...);
int plugin_dispatch_missing (const value_list_t *vl);
int plugin_thread_create (pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
+/*
+ * Plugins need to implement this
+ */
+
+void module_register (void);
+
#endif /* PLUGIN_H */