projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Treewide: use bool instead of _Bool
[collectd.git]
/
src
/
write_riemann.c
diff --git
a/src/write_riemann.c
b/src/write_riemann.c
index
9e07e75
..
6515fd4
100644
(file)
--- a/
src/write_riemann.c
+++ b/
src/write_riemann.c
@@
-48,11
+48,11
@@
struct riemann_host {
char *name;
char *event_service_prefix;
pthread_mutex_t lock;
char *name;
char *event_service_prefix;
pthread_mutex_t lock;
-
_B
ool batch_mode;
-
_B
ool notifications;
-
_B
ool check_thresholds;
-
_B
ool store_rates;
-
_B
ool always_append_ds;
+
b
ool batch_mode;
+
b
ool notifications;
+
b
ool check_thresholds;
+
b
ool store_rates;
+
b
ool always_append_ds;
char *node;
int port;
riemann_client_type_t client_type;
char *node;
int port;
riemann_client_type_t client_type;
@@
-214,6
+214,11
@@
wrr_notification_to_message(struct riemann_host *host, /* {{{ */
RIEMANN_EVENT_FIELD_SERVICE, &service_buffer[1],
RIEMANN_EVENT_FIELD_NONE);
RIEMANN_EVENT_FIELD_SERVICE, &service_buffer[1],
RIEMANN_EVENT_FIELD_NONE);
+#if RCC_VERSION_NUMBER >= 0x010A00
+ riemann_event_set(event, RIEMANN_EVENT_FIELD_TIME_MICROS,
+ (int64_t)CDTIME_T_TO_US(n->time));
+#endif
+
if (n->host[0] != 0)
riemann_event_string_attribute_add(event, "host", n->host);
if (n->plugin[0] != 0)
if (n->host[0] != 0)
riemann_event_string_attribute_add(event, "host", n->host);
if (n->plugin[0] != 0)
@@
-288,18
+293,17
@@
wrr_value_to_event(struct riemann_host const *host, /* {{{ */
vl->type_instance);
if (host->always_append_ds || (ds->ds_num > 1)) {
if (host->event_service_prefix == NULL)
vl->type_instance);
if (host->always_append_ds || (ds->ds_num > 1)) {
if (host->event_service_prefix == NULL)
- s
snprintf(service_buffer, sizeof(service_buffer), "%s/%s"
,
-
&name_buffer[1],
ds->ds[index].name);
+ s
nprintf(service_buffer, sizeof(service_buffer), "%s/%s", &name_buffer[1]
,
+ ds->ds[index].name);
else
else
- ssnprintf(service_buffer, sizeof(service_buffer), "%s%s/%s",
- host->event_service_prefix, &name_buffer[1],
- ds->ds[index].name);
+ snprintf(service_buffer, sizeof(service_buffer), "%s%s/%s",
+ host->event_service_prefix, &name_buffer[1], ds->ds[index].name);
} else {
if (host->event_service_prefix == NULL)
sstrncpy(service_buffer, &name_buffer[1], sizeof(service_buffer));
else
} else {
if (host->event_service_prefix == NULL)
sstrncpy(service_buffer, &name_buffer[1], sizeof(service_buffer));
else
- s
s
nprintf(service_buffer, sizeof(service_buffer), "%s%s",
-
host->event_service_prefix, &name_buffer[1]);
+ snprintf(service_buffer, sizeof(service_buffer), "%s%s",
+ host->event_service_prefix, &name_buffer[1]);
}
riemann_event_set(
}
riemann_event_set(
@@
-310,6
+314,11
@@
wrr_value_to_event(struct riemann_host const *host, /* {{{ */
vl->type, "ds_name", ds->ds[index].name, NULL,
RIEMANN_EVENT_FIELD_SERVICE, service_buffer, RIEMANN_EVENT_FIELD_NONE);
vl->type, "ds_name", ds->ds[index].name, NULL,
RIEMANN_EVENT_FIELD_SERVICE, service_buffer, RIEMANN_EVENT_FIELD_NONE);
+#if RCC_VERSION_NUMBER >= 0x010A00
+ riemann_event_set(event, RIEMANN_EVENT_FIELD_TIME_MICROS,
+ (int64_t)CDTIME_T_TO_US(vl->time));
+#endif
+
if (host->check_thresholds) {
const char *state = NULL;
if (host->check_thresholds) {
const char *state = NULL;
@@
-342,8
+351,8
@@
wrr_value_to_event(struct riemann_host const *host, /* {{{ */
if ((ds->ds[index].type != DS_TYPE_GAUGE) && (rates != NULL)) {
char ds_type[DATA_MAX_NAME_LEN];
if ((ds->ds[index].type != DS_TYPE_GAUGE) && (rates != NULL)) {
char ds_type[DATA_MAX_NAME_LEN];
- s
s
nprintf(ds_type, sizeof(ds_type), "%s:rate",
-
DS_TYPE_TO_STRING(ds->ds[index].type));
+ snprintf(ds_type, sizeof(ds_type), "%s:rate",
+ DS_TYPE_TO_STRING(ds->ds[index].type));
riemann_event_string_attribute_add(event, "ds_type", ds_type);
} else {
riemann_event_string_attribute_add(event, "ds_type",
riemann_event_string_attribute_add(event, "ds_type", ds_type);
} else {
riemann_event_string_attribute_add(event, "ds_type",
@@
-353,7
+362,7
@@
wrr_value_to_event(struct riemann_host const *host, /* {{{ */
{
char ds_index[DATA_MAX_NAME_LEN];
{
char ds_index[DATA_MAX_NAME_LEN];
- s
snprintf(ds_index, sizeof(ds_index), "%zu"
, index);
+ s
nprintf(ds_index, sizeof(ds_index), "%" PRIsz
, index);
riemann_event_string_attribute_add(event, "ds_index", ds_index);
}
riemann_event_string_attribute_add(event, "ds_index", ds_index);
}
@@
-601,6
+610,7
@@
static void wrr_free(void *p) /* {{{ */
wrr_disconnect(host);
wrr_disconnect(host);
+ pthread_mutex_lock(&host->lock);
pthread_mutex_destroy(&host->lock);
sfree(host);
} /* }}} void wrr_free */
pthread_mutex_destroy(&host->lock);
sfree(host);
} /* }}} void wrr_free */
@@
-792,8
+802,8
@@
static int wrr_config_node(oconfig_item_t *ci) /* {{{ */
return status;
}
return status;
}
- s
s
nprintf(callback_name, sizeof(callback_name), "write_riemann/%s",
-
host->name);
+ snprintf(callback_name, sizeof(callback_name), "write_riemann/%s",
+ host->name);
user_data_t ud = {.data = host, .free_func = wrr_free};
user_data_t ud = {.data = host, .free_func = wrr_free};