X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fplugin.h;h=3c301586c4b6340ad3e639d7589d916d128e7c1b;hb=b4986d880987dd36f89cc866877a692111ca548e;hp=0369067887ada3cab2c851cc7f99d5ad42b24ed8;hpb=3f4d0cbd79ca46e1b98edb10ddee3a723d69a6bb;p=collectd.git diff --git a/src/daemon/plugin.h b/src/daemon/plugin.h index 03690678..3c301586 100644 --- a/src/daemon/plugin.h +++ b/src/daemon/plugin.h @@ -31,9 +31,10 @@ #include "collectd.h" #include "configfile.h" -#include "meta_data.h" +#include "utils/metadata/meta_data.h" #include "utils_time.h" +#include #include #define DS_TYPE_COUNTER 0 @@ -171,6 +172,7 @@ struct user_data_s { typedef struct user_data_s user_data_t; struct plugin_ctx_s { + char *name; cdtime_t interval; cdtime_t flush_interval; cdtime_t flush_timeout; @@ -231,6 +233,7 @@ void plugin_set_dir(const char *dir); * this case. */ int plugin_load(const char *name, bool global); +bool plugin_is_loaded(char const *name); int plugin_init_all(void); void plugin_read_all(void); @@ -243,7 +246,7 @@ int plugin_shutdown_all(void); * * DESCRIPTION * Calls the write function of the given plugin with the provided data set and - * value list. It differs from `plugin_dispatch_value' in that it does not + * value list. It differs from `plugin_dispatch_values' in that it does not * update the cache, does not do threshold checking, call the chain subsystem * and so on. It looks up the requested plugin and invokes the function, end * of story. @@ -398,6 +401,15 @@ int parse_notif_severity(const char *severity); #define DEBUG(...) /* noop */ #endif /* ! COLLECT_DEBUG */ +/* This will log messages, prefixed by plugin name */ +void daemon_log(int level, const char *format, ...) + __attribute__((format(printf, 2, 3))); + +#define P_ERROR(...) daemon_log(LOG_ERR, __VA_ARGS__) +#define P_WARNING(...) daemon_log(LOG_WARNING, __VA_ARGS__) +#define P_NOTICE(...) daemon_log(LOG_NOTICE, __VA_ARGS__) +#define P_INFO(...) daemon_log(LOG_INFO, __VA_ARGS__) + const data_set_t *plugin_get_ds(const char *name); int plugin_notification_meta_add_string(notification_t *n, const char *name,