X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fwrite_sensu.c;h=bd7a56d010eaa5af144b27b3aff672901b816e25;hp=51f962202df42e3e8db0aeebdacee064911124bb;hb=1159cb5d383c55a80a0db100b8f7aadcf44740a5;hpb=be126043c2be20399d7670fe194645292018bde0 diff --git a/src/write_sensu.c b/src/write_sensu.c index 51f96220..bd7a56d0 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -28,14 +28,15 @@ #include "collectd.h" +#include "common.h" +#include "plugin.h" +#include "utils_cache.h" + #include #include #include #include #include -#include "common.h" -#include "plugin.h" -#include "utils_cache.h" #include #define SENSU_HOST "localhost" @@ -421,7 +422,7 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */ if ((ds->ds[index].type != DS_TYPE_GAUGE) && (rates != NULL)) { char ds_type[DATA_MAX_NAME_LEN]; snprintf(ds_type, sizeof(ds_type), "%s:rate", - DS_TYPE_TO_STRING(ds->ds[index].type)); + DS_TYPE_TO_STRING(ds->ds[index].type)); res = my_asprintf(&temp_str, "%s, \"collectd_data_source_type\": \"%s\"", ret_str, ds_type); free(ret_str); @@ -535,16 +536,16 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */ if (host->always_append_ds || (ds->ds_num > 1)) { if (host->event_service_prefix == NULL) snprintf(service_buffer, sizeof(service_buffer), "%s.%s", name_buffer, - ds->ds[index].name); + ds->ds[index].name); else snprintf(service_buffer, sizeof(service_buffer), "%s%s.%s", - host->event_service_prefix, name_buffer, ds->ds[index].name); + host->event_service_prefix, name_buffer, ds->ds[index].name); } else { if (host->event_service_prefix == NULL) sstrncpy(service_buffer, name_buffer, sizeof(service_buffer)); else snprintf(service_buffer, sizeof(service_buffer), "%s%s", - host->event_service_prefix, name_buffer); + host->event_service_prefix, name_buffer); } // Replace collectd sensor name reserved characters so that time series DB is @@ -998,7 +999,10 @@ static void sensu_free(void *p) /* {{{ */ sfree(host->separator); free_str_list(&(host->metric_handlers)); free_str_list(&(host->notification_handlers)); + + pthread_mutex_unlock(&host->lock); pthread_mutex_destroy(&host->lock); + sfree(host); } /* }}} void sensu_free */