X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fceph.c;fp=src%2Fceph.c;h=1b1f40b458c44f9eb573f54c74730bb0056d13e3;hp=4ae6e54b34b432deae4478a8c21aa8287b2bfa80;hb=0febfbd11d87acd8a0f10bbcf5d4a58bb68b8dc0;hpb=82f7cee169bd303db5a1e80ca8125bcdcba48d4d diff --git a/src/ceph.c b/src/ceph.c index 4ae6e54b..1b1f40b4 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -114,7 +114,7 @@ struct ceph_daemon uint32_t *ds_types; /** Track ds names to match with types */ char **ds_names; - + /** * Keep track of last data for latency values so we can calculate rate * since last poll. @@ -255,7 +255,7 @@ static int ceph_cb_boolean(void *ctx, int bool_val) return CEPH_CB_CONTINUE; } -static int +static int ceph_cb_number(void *ctx, const char *number_val, yajl_len_t number_len) { yajl_struct *yajl = (yajl_struct*)ctx; @@ -320,7 +320,7 @@ ceph_cb_number(void *ctx, const char *number_val, yajl_len_t number_len) return CEPH_CB_CONTINUE; } -static int ceph_cb_string(void *ctx, const unsigned char *string_val, +static int ceph_cb_string(void *ctx, const unsigned char *string_val, yajl_len_t string_len) { return CEPH_CB_CONTINUE; @@ -528,7 +528,7 @@ static int parse_keys(const char *key_str, char *ds_name) int max_str_len = 100; char tmp_ds_name[max_str_len]; memset(tmp_ds_name, 0, sizeof(tmp_ds_name)); - if(ds_name == NULL || key_str == NULL || key_str[0] == '\0' || + if(ds_name == NULL || key_str == NULL || key_str[0] == '\0' || ds_name[0] != '\0') { return -1; @@ -539,7 +539,7 @@ static int parse_keys(const char *key_str, char *ds_name) memcpy(tmp_ds_name, key_str, max_str_len - 1); goto compact; } - + ds_name_len = (rptr - ptr) > max_str_len ? max_str_len : (rptr - ptr); if((ds_name_len == 0) || strncmp(rptr + 1, "type", 4)) { /** copy whole key **/ @@ -550,7 +550,7 @@ static int parse_keys(const char *key_str, char *ds_name) memcpy(tmp_ds_name, key_str, ((rptr - key_str) > (max_str_len - 1) ? (max_str_len - 1) : (rptr - key_str))); } - + compact: compact_ds_name(tmp_ds_name, ds_name); return 0; } @@ -565,7 +565,7 @@ static int ceph_daemon_add_ds_entry(struct ceph_daemon *d, const char *name, uint32_t type; char ds_name[DATA_MAX_NAME_LEN]; memset(ds_name, 0, sizeof(ds_name)); - + if(convert_special_metrics) { /** @@ -611,7 +611,7 @@ static int ceph_daemon_add_ds_entry(struct ceph_daemon *d, const char *name, sstrncpy(d->ds_names[d->ds_num], ds_name, DATA_MAX_NAME_LEN -1); d->ds_num = (d->ds_num + 1); - + return 0; } @@ -707,7 +707,7 @@ static int cc_add_daemon_config(oconfig_item_t *ci) "with '/' or './' Can't parse: '%s'\n", cd.name, cd.asok_path); return -EINVAL; } - + array = realloc(g_daemons, sizeof(struct ceph_daemon *) * (g_num_daemons + 1)); if(array == NULL) @@ -812,7 +812,7 @@ node_handler_define_schema(void *arg, const char *val, const char *key) /** * Latency counter does not yet have an entry in last poll data - add it. */ -static int add_last(struct ceph_daemon *d, const char *ds_n, double cur_sum, +static int add_last(struct ceph_daemon *d, const char *ds_n, double cur_sum, uint64_t cur_count) { d->last_poll_data[d->last_idx] = malloc(1 * sizeof(struct last_data)); @@ -965,7 +965,7 @@ static int node_handler_fetch_data(void *arg, const char *val, const char *key) //don't overflow bounds of array index = (vtmp->d->ds_num - 1); } - + /** * counters should remain in same order we parsed schema... we maintain the * index variable to keep track of current point in list of counters. first @@ -1009,7 +1009,7 @@ static int node_handler_fetch_data(void *arg, const char *val, const char *key) { vtmp->avgcount = 1; } - + /** User wants latency values as long run avg */ if(long_run_latency_avg) {