X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fplugin.c;h=4ad7366cd0c5d9ff8244fb64866211f6d9ef27bd;hb=34c428c660281bff45ad4c98b609e4b0799648a4;hp=b00433623f9cd40c3fb66346abe794e64915714c;hpb=1a0d78fa7ea83b9913f5aa0146009f06846de6d1;p=collectd.git diff --git a/src/plugin.c b/src/plugin.c index b0043362..4ad7366c 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -36,6 +36,7 @@ #include "utils_llist.h" #include "utils_cache.h" #include "utils_threshold.h" +#include "filter_chain.h" /* * Private structures @@ -705,7 +706,7 @@ int plugin_write (const char *plugin, /* {{{ */ int success = 0; int failure = 0; - le = llist_head (list_flush); + le = llist_head (list_write); while (le != NULL) { callback = le->value; @@ -725,7 +726,7 @@ int plugin_write (const char *plugin, /* {{{ */ } else /* plugin != NULL */ { - le = llist_head (list_flush); + le = llist_head (list_write); while (le != NULL) { if (strcasecmp (plugin, le->key) == 0) @@ -800,9 +801,6 @@ int plugin_dispatch_values (value_list_t *vl) static c_complain_t no_write_complaint = C_COMPLAIN_INIT_STATIC; data_set_t *ds; - llentry_t *le; - - int filter = 0; if ((vl == NULL) || (*vl->type == '\0')) { ERROR ("plugin_dispatch_values: Invalid value list."); @@ -865,39 +863,10 @@ int plugin_dispatch_values (value_list_t *vl) escape_slashes (vl->type, sizeof (vl->type)); escape_slashes (vl->type_instance, sizeof (vl->type_instance)); - le = llist_head (list_filter); - while (le != NULL) - { - int (*filter_callback) (const data_set_t *, value_list_t *) = - (int (*) (const data_set_t *, value_list_t *)) le->value; - - filter |= (*filter_callback) (ds, vl); - - if (filter == FILTER_IGNORE) - return (-1); - - le = le->next; - } - /* Update the value cache */ uc_update (ds, vl); - if ((filter & FILTER_NOTHRESHOLD_CHECK) == 0) - ut_check_threshold (ds, vl); - - if (filter & FILTER_NOWRITE) - return (0); - - le = llist_head (list_write); - while (le != NULL) - { - int (*write_callback) (const data_set_t *, const value_list_t *) = - (int (*) (const data_set_t *, const value_list_t *)) le->value; - - (*write_callback) (ds, vl); - - le = le->next; - } + fc_process (ds, vl); return (0); } /* int plugin_dispatch_values */ @@ -1002,8 +971,8 @@ static int plugin_notification_meta_add (notification_t *n, { case NM_TYPE_STRING: { - meta->value_string = strdup ((const char *) value); - if (meta->value_string == NULL) + meta->nm_value.nm_string = strdup ((const char *) value); + if (meta->nm_value.nm_string == NULL) { ERROR ("plugin_notification_meta_add: strdup failed."); sfree (meta); @@ -1013,22 +982,22 @@ static int plugin_notification_meta_add (notification_t *n, } case NM_TYPE_SIGNED_INT: { - meta->value_signed_int = *((int64_t *) value); + meta->nm_value.nm_signed_int = *((int64_t *) value); break; } case NM_TYPE_UNSIGNED_INT: { - meta->value_unsigned_int = *((uint64_t *) value); + meta->nm_value.nm_unsigned_int = *((uint64_t *) value); break; } case NM_TYPE_DOUBLE: { - meta->value_double = *((double *) value); + meta->nm_value.nm_double = *((double *) value); break; } case NM_TYPE_BOOLEAN: { - meta->value_boolean = *((bool *) value); + meta->nm_value.nm_boolean = *((bool *) value); break; } default: @@ -1101,19 +1070,19 @@ int plugin_notification_meta_copy (notification_t *dst, { if (meta->type == NM_TYPE_STRING) plugin_notification_meta_add_string (dst, meta->name, - meta->value_string); + meta->nm_value.nm_string); else if (meta->type == NM_TYPE_SIGNED_INT) plugin_notification_meta_add_signed_int (dst, meta->name, - meta->value_signed_int); + meta->nm_value.nm_signed_int); else if (meta->type == NM_TYPE_UNSIGNED_INT) plugin_notification_meta_add_unsigned_int (dst, meta->name, - meta->value_unsigned_int); + meta->nm_value.nm_unsigned_int); else if (meta->type == NM_TYPE_DOUBLE) plugin_notification_meta_add_double (dst, meta->name, - meta->value_double); + meta->nm_value.nm_double); else if (meta->type == NM_TYPE_BOOLEAN) plugin_notification_meta_add_boolean (dst, meta->name, - meta->value_boolean); + meta->nm_value.nm_boolean); } return (0); @@ -1138,8 +1107,8 @@ int plugin_notification_meta_free (notification_t *n) if (this->type == NM_TYPE_STRING) { - free ((char *)this->value_string); - this->value_string = NULL; + free ((char *)this->nm_value.nm_string); + this->nm_value.nm_string = NULL; } sfree (this);