From: Florian Forster Date: Sat, 22 Mar 2008 08:41:42 +0000 (+0100) Subject: Merge branch 'collectd-4.3' X-Git-Tag: collectd-4.4.0~82 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a813e8af8379bd0f55a2b46fc7918fa31de9522e;p=collectd.git Merge branch 'collectd-4.3' Conflicts: src/utils_cache.c --- a813e8af8379bd0f55a2b46fc7918fa31de9522e diff --cc src/utils_cache.c index ad8fb199,b9b89621..c471ee28 --- a/src/utils_cache.c +++ b/src/utils_cache.c @@@ -399,46 -434,44 +434,45 @@@ int uc_update (const data_set_t *ds, co pthread_mutex_unlock (&cache_lock); + if (send_okay_notification == 0) + return (0); + /* Do not send okay notifications for uninteresting values, i. e. values for * which no threshold is configured. */ - if (send_okay_notification > 0) - { - int status; - - status = ut_check_interesting (name); - if (status <= 0) - send_okay_notification = 0; - } - - if (send_okay_notification > 0) - { - notification_t n; - memset (&n, '\0', sizeof (n)); + status = ut_check_interesting (name); + if (status <= 0) + return (0); - /* Copy the associative members */ - NOTIFICATION_INIT_VL (&n, vl, ds); + /* Initialize the notification */ + memset (&n, '\0', sizeof (n)); + NOTIFICATION_INIT_VL (&n, vl, ds); - n.severity = NOTIF_OKAY; - n.time = vl->time; + n.severity = NOTIF_OKAY; + n.time = vl->time; - snprintf (n.message, sizeof (n.message), - "Received a value for %s. It was missing for %i seconds.", - name, send_okay_notification); - n.message[sizeof (n.message) - 1] = '\0'; + snprintf (n.message, sizeof (n.message), + "Received a value for %s. It was missing for %u seconds.", + name, (unsigned int) update_delay); + n.message[sizeof (n.message) - 1] = '\0'; - plugin_dispatch_notification (&n); - } + plugin_dispatch_notification (&n); return (0); - } /* int uc_insert */ + } /* int uc_update */ -gauge_t *uc_get_rate (const data_set_t *ds, const value_list_t *vl) +int uc_get_rate_by_name (const char *name, gauge_t **ret_values, size_t *ret_values_num) { - char name[6 * DATA_MAX_NAME_LEN]; gauge_t *ret = NULL; + size_t ret_num = 0; cache_entry_t *ce = NULL; + int status = 0; + if (FORMAT_VL (name, sizeof (name), vl, ds) != 0) + { + ERROR ("uc_get_rate: FORMAT_VL failed."); + return (NULL); + } + pthread_mutex_lock (&cache_lock); if (c_avl_get (cache_tree, name, (void *) &ce) == 0)