Changing ssnprintf to snprintf changed the indentation.
sstrncpy(inst->ident.plugin_instance, AGG_FUNC_PLACEHOLDER,
sizeof(inst->ident.plugin_instance));
else if (strcmp("", tmp_plugin) != 0)
- snprintf(inst->ident.plugin_instance,
- sizeof(inst->ident.plugin_instance), "%s-%s", tmp_plugin,
- AGG_FUNC_PLACEHOLDER);
+ snprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
+ "%s-%s", tmp_plugin, AGG_FUNC_PLACEHOLDER);
else if (strcmp("", tmp_plugin_instance) != 0)
- snprintf(inst->ident.plugin_instance,
- sizeof(inst->ident.plugin_instance), "%s-%s",
- tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
+ snprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
+ "%s-%s", tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
else
- snprintf(inst->ident.plugin_instance,
- sizeof(inst->ident.plugin_instance), "%s-%s-%s", tmp_plugin,
- tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
+ snprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
+ "%s-%s-%s", tmp_plugin, tmp_plugin_instance,
+ AGG_FUNC_PLACEHOLDER);
}
/* Type */
amqp_connection_close_t *m = r.reply.decoded;
char *tmp = camqp_bytes_cstring(&m->reply_text);
snprintf(buffer, buffer_size, "Server connection error %d: %s",
- m->reply_code, tmp);
+ m->reply_code, tmp);
sfree(tmp);
} else if (r.reply.id == AMQP_CHANNEL_CLOSE_METHOD) {
amqp_channel_close_t *m = r.reply.decoded;
char *tmp = camqp_bytes_cstring(&m->reply_text);
snprintf(buffer, buffer_size, "Server channel error %d: %s",
- m->reply_code, tmp);
+ m->reply_code, tmp);
sfree(tmp);
} else {
snprintf(buffer, buffer_size, "Server error method %#" PRIx32,
- r.reply.id);
+ r.reply.id);
}
break;
sstrncpy(routing_key, conf->routing_key, sizeof(routing_key));
} else {
snprintf(routing_key, sizeof(routing_key), "collectd/%s/%s/%s/%s/%s",
- vl->host, vl->plugin, vl->plugin_instance, vl->type,
- vl->type_instance);
+ vl->host, vl->plugin, vl->plugin_instance, vl->type,
+ vl->type_instance);
/* Switch slashes (the only character forbidden by collectd) and dots
* (the separation character used by AMQP). */
char callback_name[3 * DATA_MAX_NAME_LEN];
snprintf(callback_name, sizeof(callback_name), "apache/%s/%s",
- (st->host != NULL) ? st->host : hostname_g,
- (st->name != NULL) ? st->name : "default");
+ (st->host != NULL) ? st->host : hostname_g,
+ (st->name != NULL) ? st->name : "default");
status = plugin_register_complex_read(
/* group = */ NULL,
/* name = */ callback_name,
/* callback = */ apache_read_host,
- /* interval = */ 0, &(user_data_t){
- .data = st, .free_func = apache_free,
- });
+ /* interval = */ 0,
+ &(user_data_t){
+ .data = st, .free_func = apache_free,
+ });
}
if (status != 0) {
int status;
status = snprintf(credentials, sizeof(credentials), "%s:%s", st->user,
- (st->pass == NULL) ? "" : st->pass);
+ (st->pass == NULL) ? "" : st->pass);
if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
ERROR("apache plugin: init_host: Returning an error "
"because the credentials have been "
int status;
status = snprintf(credentials, sizeof(credentials), "%s:%s", user,
- (pass == NULL) ? "" : pass);
+ (pass == NULL) ? "" : pass);
if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
ERROR("ascent plugin: ascent_init: Returning an error because the "
"credentials have been truncated.");
char filename[PATH_MAX];
int status;
- snprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply,
- basename);
+ snprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply, basename);
status = (int)read_file_contents(filename, buffer, buffer_size - 1);
if (status < 0)
nsstats_translation_table_length,
plugin_instance};
- snprintf(plugin_instance, sizeof(plugin_instance), "%s-zone-%s",
- view->name, zone_name);
+ snprintf(plugin_instance, sizeof(plugin_instance), "%s-zone-%s", view->name,
+ zone_name);
if (version == 3) {
list_info_ptr_t list_info = {plugin_instance,
list_info_ptr_t list_info = {plugin_instance,
/* type = */ "dns_qtype"};
- snprintf(plugin_instance, sizeof(plugin_instance), "%s-qtypes",
- view->name);
+ snprintf(plugin_instance, sizeof(plugin_instance), "%s-qtypes", view->name);
if (version == 3) {
bind_parse_generic_name_attr_value_list(
/* xpath = */ "counters[@type='resqtype']",
plugin_instance};
snprintf(plugin_instance, sizeof(plugin_instance), "%s-resolver_stats",
- view->name);
+ view->name);
if (version == 3) {
bind_parse_generic_name_attr_value_list(
"counters[@type='resstats']",
/* type = */ "dns_qtype_cached"};
snprintf(plugin_instance, sizeof(plugin_instance), "%s-cache_rr_sets",
- view->name);
+ view->name);
bind_parse_generic_name_value(/* xpath = */ "cache/rrset",
/* callback = */ bind_xml_list_callback,
return 0;
snprintf(abs_path, sizeof(abs_path), "%s/%s/cpuacct.stat", dirname,
- cgroup_name);
+ cgroup_name);
fh = fopen(abs_path, "r");
if (fh == NULL) {
char errbuf[1024];
while (1) {
status = snprintf(filename, sizeof(filename),
- "/sys/devices/system/cpu/cpu%d/cpufreq/"
- "scaling_cur_freq",
- num_cpu);
+ "/sys/devices/system/cpu/cpu%d/cpufreq/"
+ "scaling_cur_freq",
+ num_cpu);
if ((status < 1) || ((unsigned int)status >= sizeof(filename)))
break;
for (int i = 0; i < num_cpu; i++) {
char filename[PATH_MAX];
snprintf(filename, sizeof(filename),
- "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", i);
+ "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", i);
value_t v;
if (parse_value_file(filename, &v, DS_TYPE_GAUGE) != 0) {
if (ds->ds[i].type == DS_TYPE_GAUGE) {
status = snprintf(buffer + offset, buffer_len - offset, ",%lf",
- vl->values[i].gauge);
+ vl->values[i].gauge);
} else if (store_rates != 0) {
if (rates == NULL)
rates = uc_get_rate(ds, vl);
"uc_get_rate failed.");
return -1;
}
- status =
- snprintf(buffer + offset, buffer_len - offset, ",%lf", rates[i]);
+ status = snprintf(buffer + offset, buffer_len - offset, ",%lf", rates[i]);
} else if (ds->ds[i].type == DS_TYPE_COUNTER) {
status = snprintf(buffer + offset, buffer_len - offset, ",%llu",
- vl->values[i].counter);
+ vl->values[i].counter);
} else if (ds->ds[i].type == DS_TYPE_DERIVE) {
status = snprintf(buffer + offset, buffer_len - offset, ",%" PRIi64,
- vl->values[i].derive);
+ vl->values[i].derive);
} else if (ds->ds[i].type == DS_TYPE_ABSOLUTE) {
status = snprintf(buffer + offset, buffer_len - offset, ",%" PRIu64,
- vl->values[i].absolute);
+ vl->values[i].absolute);
}
if ((status < 1) || (status >= (buffer_len - offset))) {
}
snprintf(wp->credentials, credentials_size, "%s:%s", wp->user,
- (wp->pass == NULL) ? "" : wp->pass);
+ (wp->pass == NULL) ? "" : wp->pass);
curl_easy_setopt(wp->curl, CURLOPT_USERPWD, wp->credentials);
#endif
}
snprintf(db->credentials, credentials_size, "%s:%s", db->user,
- (db->pass == NULL) ? "" : db->pass);
+ (db->pass == NULL) ? "" : db->pass);
curl_easy_setopt(db->curl, CURLOPT_USERPWD, db->credentials);
#endif
int len = 0;
for (int i = 0; i < db->depth; i++)
len += snprintf(vl.type_instance + len, sizeof(vl.type_instance) - len,
- i ? "-%s" : "%s", db->state[i + 1].name);
+ i ? "-%s" : "%s", db->state[i + 1].name);
} else
sstrncpy(vl.type_instance, key->instance, sizeof(vl.type_instance));
status = cx_handle_single_value_xpath(xpath_ctx, xpath, ds, vl, i);
if (status != 0)
return -1; /* An error has been printed. */
- } /* for (i = 0; i < xpath->values_len; i++) */
+ } /* for (i = 0; i < xpath->values_len; i++) */
plugin_dispatch_values(vl);
vl->values = NULL;
if (instance_node != NULL) {
char *node_value = (char *)xmlNodeGetContent(instance_node->nodeTab[0]);
snprintf(vl->type_instance, sizeof(vl->type_instance), "%s%s",
- xpath->instance_prefix, node_value);
+ xpath->instance_prefix, node_value);
sfree(node_value);
} else
sstrncpy(vl->type_instance, xpath->instance_prefix,
}
snprintf(db->credentials, credentials_size, "%s:%s", db->user,
- (db->pass == NULL) ? "" : db->pass);
+ (db->pass == NULL) ? "" : db->pass);
curl_easy_setopt(db->curl, CURLOPT_USERPWD, db->credentials);
#endif
#else
if (strerror_r(errnum, buf, buflen) != 0) {
snprintf(buf, buflen, "Error #%i; "
- "Additionally, strerror_r failed.",
- errnum);
+ "Additionally, strerror_r failed.",
+ errnum);
}
#endif /* STRERROR_R_CHAR_P */
status =
snprintf(buffer_ptr, buffer_free, " %s", ci->values[i].value.string);
else if (ci->values[i].type == OCONFIG_TYPE_NUMBER)
- status = snprintf(buffer_ptr, buffer_free, " %lf",
- ci->values[i].value.number);
+ status =
+ snprintf(buffer_ptr, buffer_free, " %lf", ci->values[i].value.number);
else if (ci->values[i].type == OCONFIG_TYPE_BOOLEAN)
status = snprintf(buffer_ptr, buffer_free, " %s",
- ci->values[i].value.boolean ? "true" : "false");
+ ci->values[i].value.boolean ? "true" : "false");
if ((status < 0) || (status >= buffer_free))
return -1;
if (ci->values_num == 1) {
sstrncpy(rule->name, ci->values[0].value.string, sizeof(rule->name));
snprintf(rule_name, sizeof(rule_name), "Rule \"%s\"",
- ci->values[0].value.string);
+ ci->values[0].value.string);
}
for (int i = 0; i < ci->children_num; i++) {
char errbuf[1024] = "";
snprintf(errbuf, sizeof(errbuf),
- "dlopen (\"%s\") failed: %s. "
- "The most common cause for this problem is "
- "missing dependencies. Use ldd(1) to check "
- "the dependencies of the plugin "
- "/ shared object.",
- file, dlerror());
+ "dlopen (\"%s\") failed: %s. "
+ "The most common cause for this problem is "
+ "missing dependencies. Use ldd(1) to check "
+ "the dependencies of the plugin "
+ "/ shared object.",
+ file, dlerror());
ERROR("%s", errbuf);
/* Make sure this is printed to STDERR in any case, but also
snprintf(buffer, buffer_size, "%s (status %i)", msg, status);
else
snprintf(buffer, buffer_size, "dbi_conn_error failed with status %i",
- status);
+ status);
return buffer;
} /* }}} const char *cdbi_conn_error */
/* Get the list of all disk objects. */
if (IOServiceGetMatchingServices(
- io_master_port, IOServiceMatching(kIOBlockStorageDriverClass),
- &disk_list) != kIOReturnSuccess) {
+ io_master_port, IOServiceMatching(kIOBlockStorageDriverClass),
+ &disk_list) != kIOReturnSuccess) {
ERROR("disk plugin: IOServiceGetMatchingServices failed.");
return -1;
}
sstrncpy(disk_name, props_disk_name_bsd, sizeof(disk_name));
else {
ERROR("disk plugin: can't find bsd disk name.");
- snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major,
- disk_minor);
+ snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
}
} else
snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
while (!(ec->config.link_status.enabled_port_mask & (1 << port_num)))
port_num++;
snprintf(ec->config.link_status.port_name[port_num], DATA_MAX_NAME_LEN,
- "%s", child->values[0].value.string);
+ "%s", child->values[0].value.string);
DEBUG(DPDK_EVENTS_PLUGIN ": LinkStatus:Port %d Name: %s", port_num,
ec->config.link_status.port_name[port_num]);
port_num++;
} else if (strcasecmp("LCoreMask", child->key) == 0) {
char lcore_mask[DATA_MAX_NAME_LEN];
snprintf(lcore_mask, sizeof(lcore_mask), "%s",
- child->values[0].value.string);
+ child->values[0].value.string);
ec->config.keep_alive.lcore_mask =
str_to_uint128(lcore_mask, strlen(lcore_mask));
DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:LCoreMask 0x%" PRIX64 "%" PRIX64 "",
ec->config.keep_alive.lcore_mask.low);
} else if (strcasecmp("KeepAliveShmName", child->key) == 0) {
snprintf(ec->config.keep_alive.shm_name,
- sizeof(ec->config.keep_alive.shm_name), "%s",
- child->values[0].value.string);
+ sizeof(ec->config.keep_alive.shm_name), "%s",
+ child->values[0].value.string);
DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:KeepAliveShmName %s",
ec->config.keep_alive.shm_name);
} else if (strcasecmp("SendNotification", child->key) == 0) {
char dev_name[DATA_MAX_NAME_LEN];
if (ec->config.link_status.port_name[i][0] != 0) {
snprintf(dev_name, sizeof(dev_name), "%s",
- ec->config.link_status.port_name[i]);
+ ec->config.link_status.port_name[i]);
} else {
snprintf(dev_name, sizeof(dev_name), "port.%d", i);
}
int sev = ec->link_info[i].link_status ? NOTIF_OKAY : NOTIF_WARNING;
char msg[DATA_MAX_NAME_LEN];
snprintf(msg, sizeof(msg), "Link Status: %s",
- ec->link_info[i].link_status ? "UP" : "DOWN");
+ ec->link_info[i].link_status ? "UP" : "DOWN");
dpdk_events_notification_dispatch(sev, dev_name,
ec->link_info[i].read_time, msg);
} else {
pl->argv[i] = strdup(ci->values[i + 1].value.string);
} else {
if (ci->values[i + 1].type == OCONFIG_TYPE_NUMBER) {
- snprintf(buffer, sizeof(buffer), "%lf",
- ci->values[i + 1].value.number);
+ snprintf(buffer, sizeof(buffer), "%lf", ci->values[i + 1].value.number);
} else {
if (ci->values[i + 1].value.boolean)
sstrncpy(buffer, "true", sizeof(buffer));
#ifdef HAVE_SETENV
snprintf(buffer, sizeof(buffer), "%.3f",
- CDTIME_T_TO_DOUBLE(plugin_get_interval()));
+ CDTIME_T_TO_DOUBLE(plugin_get_interval()));
setenv("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
sstrncpy(buffer, hostname_g, sizeof(buffer));
setenv("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
#else
snprintf(buffer, sizeof(buffer), "COLLECTD_INTERVAL=%.3f",
- CDTIME_T_TO_DOUBLE(plugin_get_interval()));
+ CDTIME_T_TO_DOUBLE(plugin_get_interval()));
putenv(buffer);
snprintf(buffer, sizeof(buffer), "COLLECTD_HOSTNAME=%s", hostname_g);
return NULL;
snprintf(key, sizeof(key), "%s/%s/%s", host, type,
- (type_instance != NULL) ? type_instance : "");
+ (type_instance != NULL) ? type_instance : "");
se = NULL;
status = c_avl_get(staging_tree, key, (void *)&se);
sstrncpy(vl.plugin, g_plugin_name, sizeof(vl.plugin));
if (info->node) {
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%zuKb",
- info->node, info->page_size_kb);
+ info->node, info->page_size_kb);
} else {
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%zuKb",
- info->page_size_kb);
+ info->page_size_kb);
}
/* ensure all metrics have the same timestamp */
if (unique_name)
snprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module,
- ksp[i]->ks_instance, ksp[i]->ks_name);
+ ksp[i]->ks_instance, ksp[i]->ks_name);
else
sstrncpy(iname, ksp[i]->ks_name, sizeof(iname));
sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
snprintf(n.message, sizeof(n.message), "sensor %s not present",
- list_item->sensor_name);
+ list_item->sensor_name);
plugin_dispatch_notification(&n);
}
sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
snprintf(n.message, sizeof(n.message), "sensor %s present",
- list_item->sensor_name);
+ list_item->sensor_name);
plugin_dispatch_notification(&n);
}
sstrncpy(sensor_name, buffer, sizeof(sensor_name));
else
snprintf(sensor_name, sizeof(sensor_name), "%s %s", buffer,
- entity_id_string);
+ entity_id_string);
sstrncpy(buffer, sensor_name, sizeof(buffer));
sensor_name_ptr = strstr(buffer, ").");
if (sensor_id_ptr != NULL) {
/* `sensor_id_ptr' now points to "(123)". */
snprintf(sensor_name, sizeof(sensor_name), "%s %s", sensor_name_ptr,
- sensor_id_ptr);
+ sensor_id_ptr);
}
/* else: don't touch sensor_name. */
}
sstrncpy(n.type_instance, list_item->sensor_name, sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
snprintf(n.message, sizeof(n.message), "sensor %s added",
- list_item->sensor_name);
+ list_item->sensor_name);
plugin_dispatch_notification(&n);
}
sstrncpy(n.type_instance, list_item->sensor_name, sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
snprintf(n.message, sizeof(n.message), "sensor %s removed",
- list_item->sensor_name);
+ list_item->sensor_name);
plugin_dispatch_notification(&n);
}
return 1;
ip_chain_t temp = {0};
- ip_chain_t * final, **list;
+ ip_chain_t *final, **list;
char *table;
int table_len;
char *chain;
}
chain_list = list;
- final = malloc(sizeof(* final));
+ final = malloc(sizeof(*final));
if (final == NULL) {
char errbuf[1024];
ERROR("malloc failed: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
sstrncpy(vl.plugin, "ip6tables", sizeof(vl.plugin));
status = snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
- chain->table, chain->chain);
+ chain->table, chain->chain);
if ((status < 1) || ((unsigned int)status >= sizeof(vl.plugin_instance)))
return 0;
} else {
if (chain->rule_type == RTYPE_NUM)
snprintf(vl.type_instance, sizeof(vl.type_instance), "%i",
- chain->rule.num);
+ chain->rule.num);
else
sstrncpy(vl.type_instance, (char *)match->data, sizeof(vl.type_instance));
}
sstrncpy(vl.plugin, "iptables", sizeof(vl.plugin));
status = snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
- chain->table, chain->chain);
+ chain->table, chain->chain);
if ((status < 1) || ((unsigned int)status >= sizeof(vl.plugin_instance)))
return 0;
} else {
if (chain->rule_type == RTYPE_NUM)
snprintf(vl.type_instance, sizeof(vl.type_instance), "%i",
- chain->rule.num);
+ chain->rule.num);
else
sstrncpy(vl.type_instance, (char *)match->data, sizeof(vl.type_instance));
}
int len =
snprintf(pi, size, "%s_%s%u", inet_ntoa(addr),
- (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", ntohs(se->port));
+ (se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", ntohs(se->port));
if ((len < 0) || (size <= ((size_t)len))) {
log_err("plugin instance truncated: %s", pi);
return 0;
} /* }}} int jtoc_notification */
- /*
- * Functions accessible from Java
- */
+/*
+ * Functions accessible from Java
+ */
static jint JNICALL cjni_api_dispatch_values(JNIEnv *jvm_env, /* {{{ */
jobject this, jobject java_vl) {
value_list_t vl = VALUE_LIST_INIT;
#define APPEND(bufptr, buflen, key, value) \
if ((buflen > 0) && (strlen(value) > 0)) { \
- status = snprintf(bufptr, buflen, ", %s = %s", key, value); \
+ status = snprintf(bufptr, buflen, ", %s = %s", key, value); \
if (status > 0) { \
bufptr += status; \
buflen -= status; \
int status = plugin_register_complex_read(/* group = */ "lua",
/* name = */ function_name,
/* callback = */ clua_read,
- /* interval = */ 0, &(user_data_t){
- .data = cb,
- });
+ /* interval = */ 0,
+ &(user_data_t){
+ .data = cb,
+ });
if (status != 0)
return luaL_error(L, "%s", "plugin_register_complex_read failed");
cb->lua_function_name = strdup(function_name);
pthread_mutex_init(&cb->lock, NULL);
- int status =
- plugin_register_write(/* name = */ function_name,
- /* callback = */ clua_write, &(user_data_t){
- .data = cb,
- });
+ int status = plugin_register_write(/* name = */ function_name,
+ /* callback = */ clua_write,
+ &(user_data_t){
+ .data = cb,
+ });
if (status != 0)
return luaL_error(L, "%s", "plugin_register_write failed");
return;
used_bytes = lv_size * (used_percent_unscaled * PERCENT_SCALE_FACTOR);
- snprintf(plugin_instance, sizeof(plugin_instance), "%s-%s", vg_name,
- lv_name);
+ snprintf(plugin_instance, sizeof(plugin_instance), "%s-%s", vg_name, lv_name);
lvm_submit(plugin_instance, "used", used_bytes);
lvm_submit(plugin_instance, "free", lv_size - used_bytes);
}
static inline void macaddr_to_str(char *buf, size_t bufsize,
const uint8_t mac[IEEE80211_ADDR_LEN]) {
snprintf(buf, bufsize, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1],
- mac[2], mac[3], mac[4], mac[5]);
+ mac[2], mac[3], mac[4], mac[5]);
}
static void process_stat_struct(int which, const void *ptr, const char *dev,
if (mr->dimm_name[0] != '\0')
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s_%s",
- mr->location, mr->dimm_name);
+ mr->location, mr->dimm_name);
else
sstrncpy(vl.plugin_instance, mr->location, sizeof(vl.plugin_instance));
plugin_dispatch_values(&vl);
snprintf(vl.type_instance, sizeof(vl.type_instance),
- "corrected_memory_errors_in_%s", mr->corrected_err_timed_period);
+ "corrected_memory_errors_in_%s", mr->corrected_err_timed_period);
vl.values = &(value_t){.derive = (derive_t)mr->corrected_err_timed};
plugin_dispatch_values(&vl);
plugin_dispatch_values(&vl);
snprintf(vl.type_instance, sizeof(vl.type_instance),
- "uncorrected_memory_errors_in_%s",
- mr->uncorrected_err_timed_period);
+ "uncorrected_memory_errors_in_%s", mr->uncorrected_err_timed_period);
vl.values = &(value_t){.derive = (derive_t)mr->uncorrected_err_timed};
plugin_dispatch_values(&vl);
int status;
snprintf(callback_name, sizeof(callback_name), "memcached/%s",
- (st->name != NULL) ? st->name : "__legacy__");
+ (st->name != NULL) ? st->name : "__legacy__");
/* If no <Address> used then:
* - Connect to the destination specified by <Host>, if present.
/* group = */ "memcached",
/* name = */ callback_name,
/* callback = */ memcached_read,
- /* interval = */ 0, &(user_data_t){
- .data = st, .free_func = memcached_free,
- });
+ /* interval = */ 0,
+ &(user_data_t){
+ .data = st, .free_func = memcached_free,
+ });
return status;
} /* int memcached_add_read_callback */
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
else /* per-core statistics */
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i-cpu-%i",
- micnumber, core);
+ micnumber, core);
strncpy(vl.type, "cpu", sizeof(vl.type));
strncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
if ((status < 0) || (((size_t)status) >= buf_len))
return ENOMEM;
- while((c = strchr(buf, '#')) || (c = strchr(buf, '+'))) {
- *c = '_';
+ while ((c = strchr(buf, '#')) || (c = strchr(buf, '+'))) {
+ *c = '_';
}
return 0;
}
snprintf(cb_name, sizeof(cb_name), "mqtt/%s", conf->name);
- plugin_register_write(cb_name, mqtt_write, &(user_data_t){
- .data = conf,
- });
+ plugin_register_write(cb_name, mqtt_write,
+ &(user_data_t){
+ .data = conf,
+ });
return 0;
} /* mqtt_config_publisher */
(db->slave_io_running)) {
n.severity = NOTIF_WARNING;
snprintf(n.message, sizeof(n.message),
- "slave I/O thread not started or not connected to master");
+ "slave I/O thread not started or not connected to master");
plugin_dispatch_notification(&n);
db->slave_io_running = 0;
} else if (((io != NULL) && (strcasecmp(io, "yes") == 0)) &&
(!db->slave_io_running)) {
n.severity = NOTIF_OKAY;
snprintf(n.message, sizeof(n.message),
- "slave I/O thread started and connected to master");
+ "slave I/O thread started and connected to master");
plugin_dispatch_notification(&n);
db->slave_io_running = 1;
}
const char *type, const char *type_inst,
derive_t counter, cdtime_t timestamp,
cdtime_t interval) {
- return submit_values(host, plugin_inst, type, type_inst, &(value_t){
- .derive=counter,
- }, 1, timestamp, interval);
+ return submit_values(host, plugin_inst, type, type_inst,
+ &(value_t){
+ .derive = counter,
+ },
+ 1, timestamp, interval);
} /* }}} int submit_derive */
static int submit_two_gauge(const char *host, const char *plugin_inst, /* {{{ */
static int submit_double(const char *host, const char *plugin_inst, /* {{{ */
const char *type, const char *type_inst, double d,
cdtime_t timestamp, cdtime_t interval) {
- return submit_values(host, plugin_inst, type, type_inst, &(value_t){
- .gauge=d,
- }, 1, timestamp, interval);
+ return submit_values(host, plugin_inst, type, type_inst,
+ &(value_t){
+ .gauge = d,
+ },
+ 1, timestamp, interval);
} /* }}} int submit_uint64 */
/* Calculate hit ratio from old and new counters and submit the resulting
return -1;
snprintf(plugin_instance, sizeof(plugin_instance), "volume-%s",
- old_data->name);
+ old_data->name);
/* Check for and submit disk-octet values */
if (HAS_ALL_FLAGS(old_data->flags, CFG_VOLUME_PERF_IO) &&
- HAS_ALL_FLAGS(new_data->flags, HAVE_VOLUME_PERF_BYTES_READ |
- HAVE_VOLUME_PERF_BYTES_WRITE)) {
+ HAS_ALL_FLAGS(new_data->flags,
+ HAVE_VOLUME_PERF_BYTES_READ |
+ HAVE_VOLUME_PERF_BYTES_WRITE)) {
submit_two_derive(
hostname, plugin_instance, "disk_octets", /* type instance = */ NULL,
(derive_t)new_data->read_bytes, (derive_t)new_data->write_bytes,
}
/* Check for, calculate and submit disk-latency values */
- if (HAS_ALL_FLAGS(old_data->flags, CFG_VOLUME_PERF_LATENCY |
- HAVE_VOLUME_PERF_OPS_READ |
- HAVE_VOLUME_PERF_OPS_WRITE |
- HAVE_VOLUME_PERF_LATENCY_READ |
- HAVE_VOLUME_PERF_LATENCY_WRITE) &&
- HAS_ALL_FLAGS(new_data->flags, HAVE_VOLUME_PERF_OPS_READ |
- HAVE_VOLUME_PERF_OPS_WRITE |
- HAVE_VOLUME_PERF_LATENCY_READ |
- HAVE_VOLUME_PERF_LATENCY_WRITE)) {
+ if (HAS_ALL_FLAGS(old_data->flags,
+ CFG_VOLUME_PERF_LATENCY | HAVE_VOLUME_PERF_OPS_READ |
+ HAVE_VOLUME_PERF_OPS_WRITE |
+ HAVE_VOLUME_PERF_LATENCY_READ |
+ HAVE_VOLUME_PERF_LATENCY_WRITE) &&
+ HAS_ALL_FLAGS(new_data->flags,
+ HAVE_VOLUME_PERF_OPS_READ | HAVE_VOLUME_PERF_OPS_WRITE |
+ HAVE_VOLUME_PERF_LATENCY_READ |
+ HAVE_VOLUME_PERF_LATENCY_WRITE)) {
gauge_t latency_per_op_read;
gauge_t latency_per_op_write;
snprintf(plugin_instance, sizeof(plugin_instance), "volume-%s", v->name);
- if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_SNAP_USED |
- HAVE_VOLUME_USAGE_SNAP_RSVD)) {
+ if (HAS_ALL_FLAGS(v->flags,
+ HAVE_VOLUME_USAGE_SNAP_USED |
+ HAVE_VOLUME_USAGE_SNAP_RSVD)) {
if (v->snap_reserved > v->snap_used) {
snap_reserve_free = v->snap_reserved - v->snap_used;
snap_reserve_used = v->snap_used;
/* The space used by snapshots but not reserved for them is included in
* both, norm_used and snap_norm_used. If possible, subtract this here. */
- if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_NORM_USED |
- HAVE_VOLUME_USAGE_SNAP_USED)) {
+ if (HAS_ALL_FLAGS(v->flags,
+ HAVE_VOLUME_USAGE_NORM_USED |
+ HAVE_VOLUME_USAGE_SNAP_USED)) {
if (norm_used >= snap_norm_used)
norm_used -= snap_norm_used;
else {
"df_complex", "snap_reserved", (double)snap_reserve_free,
/* timestamp = */ 0, interval);
- if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_SNAP_USED |
- HAVE_VOLUME_USAGE_SNAP_RSVD))
+ if (HAS_ALL_FLAGS(v->flags,
+ HAVE_VOLUME_USAGE_SNAP_USED |
+ HAVE_VOLUME_USAGE_SNAP_RSVD))
submit_double(hostname, /* plugin instance = */ plugin_instance,
"df_complex", "snap_reserve_used",
(double)snap_reserve_used, /* timestamp = */ 0, interval);
if ((v->flags & IS_VOLUME_USAGE_OFFLINE) != 0) {
n.severity = NOTIF_OKAY;
- snprintf(n.message, sizeof(n.message), "Volume %s is now online.",
- v->name);
+ snprintf(n.message, sizeof(n.message), "Volume %s is now online.", v->name);
v->flags &= ~IS_VOLUME_USAGE_OFFLINE;
} else {
n.severity = NOTIF_WARNING;
snprintf(n.message, sizeof(n.message), "Volume %s is now offline.",
- v->name);
+ v->name);
v->flags |= IS_VOLUME_USAGE_OFFLINE;
}
}
} /* for (elem_volume) */
- return cna_submit_volume_usage_data(host->name, cfg_volume,
- host->cfg_volume_usage->interval.interval);
+ return cna_submit_volume_usage_data(
+ host->name, cfg_volume, host->cfg_volume_usage->interval.interval);
} /* }}} int cna_handle_volume_usage_data */
static int cna_setup_volume_usage(cfg_volume_usage_t *cvu) /* {{{ */
continue;
snprintf(plugin_instance, sizeof(plugin_instance), "quota-%s-%s",
- volume_name, tree_name);
+ volume_name, tree_name);
value = na_child_get_uint64(elem_quota, "disk-used", UINT64_MAX);
if (value != UINT64_MAX) {
/* possible TODO: make plugin instance configurable */
snprintf(plugin_instance, sizeof(plugin_instance), "snapvault-%s",
- dest_path);
+ dest_path);
submit_double(hostname, plugin_instance, /* type = */ "delay", NULL,
(double)value, /* timestamp = */ 0, interval);
if (host->vfiler)
snprintf(cb_name, sizeof(cb_name), "netapp-%s-%s", host->name,
- host->vfiler);
+ host->vfiler);
else
snprintf(cb_name, sizeof(cb_name), "netapp-%s", host->name);
numberic_id = tm->tcm_parent;
snprintf(tc_inst, sizeof(tc_inst), "%s-%x:%x", kind, numberic_id >> 16,
- numberic_id & 0x0000FFFF);
+ numberic_id & 0x0000FFFF);
}
DEBUG("netlink plugin: qos_filter_cb: got %s for %s (%i).", tc_type, dev,
stats_submitted = 1;
- snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
- tc_inst);
+ snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
if (q_stats.bs != NULL) {
submit_one(dev, "ipt_bytes", type_instance, q_stats.bs->bytes);
if (!stats_submitted && ts != NULL) {
char type_instance[DATA_MAX_NAME_LEN];
- snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
- tc_inst);
+ snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
submit_one(dev, "ipt_bytes", type_instance, ts->bytes);
submit_one(dev, "ipt_packets", type_instance, ts->packets);
pthread_mutex_lock(&send_buffer_lock);
- status =
- add_to_buffer(send_buffer_ptr, network_config_packet_size -
- (send_buffer_fill + BUFF_SIG_SIZE),
- &send_buffer_vl, ds, vl);
+ status = add_to_buffer(send_buffer_ptr,
+ network_config_packet_size -
+ (send_buffer_fill + BUFF_SIG_SIZE),
+ &send_buffer_vl, ds, vl);
if (status >= 0) {
/* status == bytes added to the buffer */
send_buffer_fill += status;
} else {
flush_buffer();
- status =
- add_to_buffer(send_buffer_ptr, network_config_packet_size -
- (send_buffer_fill + BUFF_SIG_SIZE),
- &send_buffer_vl, ds, vl);
+ status = add_to_buffer(send_buffer_ptr,
+ network_config_packet_size -
+ (send_buffer_fill + BUFF_SIG_SIZE),
+ &send_buffer_vl, ds, vl);
if (status >= 0) {
send_buffer_fill += status;
value_t values[fields_num];
snprintf(plugin_instance, sizeof(plugin_instance), "v%i%s", nfs_version,
- instance);
+ instance);
for (size_t i = 0; i < fields_num; i++)
(void)parse_value(fields[i], &values[i], DS_TYPE_DERIVE);
return EINVAL;
snprintf(plugin_instance, sizeof(plugin_instance), "v%i%s", nfs_version,
- inst);
+ inst);
kstat_read(kc, ksp, NULL);
for (size_t i = 0; i < proc_names_num; i++) {
#else
static char credentials[1024];
int status = snprintf(credentials, sizeof(credentials), "%s:%s", user,
- pass == NULL ? "" : pass);
+ pass == NULL ? "" : pass);
if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
ERROR("nginx plugin: Credentials would have been truncated.");
return -1;
}
snprintf(summary, sizeof(summary), "collectd %s notification",
- (NOTIF_FAILURE == n->severity)
- ? "FAILURE"
- : (NOTIF_WARNING == n->severity)
- ? "WARNING"
- : (NOTIF_OKAY == n->severity) ? "OKAY" : "UNKNOWN");
+ (NOTIF_FAILURE == n->severity)
+ ? "FAILURE"
+ : (NOTIF_WARNING == n->severity)
+ ? "WARNING"
+ : (NOTIF_OKAY == n->severity) ? "OKAY" : "UNKNOWN");
notification = notify_notification_new(summary, n->message, NULL
#if NOTIFY_CHECK_VERSION(0, 7, 0)
char server[MAXSTRING];
snprintf(server, sizeof(server), "%s:%i",
- (smtp_host == NULL) ? DEFAULT_SMTP_HOST : smtp_host, smtp_port);
+ (smtp_host == NULL) ? DEFAULT_SMTP_HOST : smtp_host, smtp_port);
pthread_mutex_lock(&session_lock);
int i;
snprintf(severity, sizeof(severity), "%s",
- (n->severity == NOTIF_FAILURE)
- ? "FAILURE"
- : ((n->severity == NOTIF_WARNING)
- ? "WARNING"
- : ((n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN")));
+ (n->severity == NOTIF_FAILURE)
+ ? "FAILURE"
+ : ((n->severity == NOTIF_WARNING)
+ ? "WARNING"
+ : ((n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN")));
snprintf(subject, sizeof(subject),
- (email_subject == NULL) ? DEFAULT_SMTP_SUBJECT : email_subject,
- severity, n->host);
+ (email_subject == NULL) ? DEFAULT_SMTP_SUBJECT : email_subject,
+ severity, n->host);
localtime_r(&CDTIME_T_TO_TIME_T(n->time), ×tamp_tm);
strftime(timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S",
/* Let's make RFC822 message text with \r\n EOLs */
snprintf(buf, buf_len, "MIME-Version: 1.0\r\n"
- "Content-Type: text/plain; charset=\"US-ASCII\"\r\n"
- "Content-Transfer-Encoding: 8bit\r\n"
- "Subject: %s\r\n"
- "\r\n"
- "%s - %s@%s\r\n"
- "\r\n"
- "Message: %s",
- subject, timestamp_str, severity, n->host, n->message);
+ "Content-Type: text/plain; charset=\"US-ASCII\"\r\n"
+ "Content-Transfer-Encoding: 8bit\r\n"
+ "Subject: %s\r\n"
+ "\r\n"
+ "%s - %s@%s\r\n"
+ "\r\n"
+ "Message: %s",
+ subject, timestamp_str, severity, n->host, n->message);
pthread_mutex_lock(&session_lock);
}
snprintf(buffer, sizeof(buffer),
- "[%.0f] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
- CDTIME_T_TO_DOUBLE(n->time), n->host, &svc_description[1], code,
- n->message);
+ "[%.0f] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
+ CDTIME_T_TO_DOUBLE(n->time), n->host, &svc_description[1], code,
+ n->message);
return nagios_print(buffer);
} /* }}} int nagios_notify */
if (include_unit_id)
snprintf(buffer, buffer_size, "%s-%" PRIu32, refclock_names[refclock_id],
- unit_id);
+ unit_id);
else
sstrncpy(buffer, refclock_names[refclock_id], buffer_size);
char type_instance[DATA_MAX_NAME_LEN];
snprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0],
- fields[1]);
+ fields[1]);
DEBUG("olsrd plugin: links: type_instance = %s; lq = %g;", type_instance,
lq);
char type_instance[DATA_MAX_NAME_LEN];
snprintf(type_instance, sizeof(type_instance), "%s-%s-rx", fields[0],
- fields[1]);
+ fields[1]);
DEBUG("olsrd plugin: links: type_instance = %s; nlq = %g;", type_instance,
lq);
char type_instance[DATA_MAX_NAME_LEN] = {0};
snprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0],
- fields[1]);
+ fields[1]);
DEBUG("olsrd plugin: type_instance = %s; lq = %g;", type_instance, lq);
olsrd_submit(/* p.-inst = */ "topology", /* type = */ "signal_quality",
type_instance, lq);
char type_instance[DATA_MAX_NAME_LEN] = {0};
snprintf(type_instance, sizeof(type_instance), "%s-%s-nlq", fields[0],
- fields[1]);
+ fields[1]);
DEBUG("olsrd plugin: type_instance = %s; nlq = %g;", type_instance, nlq);
olsrd_submit(/* p.-inst = */ "topology", /* type = */ "signal_quality",
type_instance, nlq);
ldap_get_values_len(st->ld, e, "olmBDBEntryCache")) != NULL) {
olmbdb_data = *olmbdb_list[0];
snprintf(typeinst, sizeof(typeinst), "bdbentrycache-%s",
- nc_data.bv_val);
+ nc_data.bv_val);
cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
st);
ldap_value_free_len(olmbdb_list);
if ((olmbdb_list = ldap_get_values_len(st->ld, e, "olmBDBDNCache")) !=
NULL) {
olmbdb_data = *olmbdb_list[0];
- snprintf(typeinst, sizeof(typeinst), "bdbdncache-%s",
- nc_data.bv_val);
+ snprintf(typeinst, sizeof(typeinst), "bdbdncache-%s", nc_data.bv_val);
cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
st);
ldap_value_free_len(olmbdb_list);
NULL) {
olmbdb_data = *olmbdb_list[0];
snprintf(typeinst, sizeof(typeinst), "bdbidlcache-%s",
- nc_data.bv_val);
+ nc_data.bv_val);
cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
st);
ldap_value_free_len(olmbdb_list);
databases_num++;
snprintf(callback_name, sizeof(callback_name), "openldap/%s/%s",
- (st->host != NULL) ? st->host : hostname_g,
- (st->name != NULL) ? st->name : "default");
+ (st->host != NULL) ? st->host : hostname_g,
+ (st->name != NULL) ? st->name : "default");
status = plugin_register_complex_read(/* group = */ NULL,
/* name = */ callback_name,
/* callback = */ cldap_read_host,
- /* interval = */ 0, &(user_data_t){
- .data = st,
- });
+ /* interval = */ 0,
+ &(user_data_t){
+ .data = st,
+ });
}
}
column_names[i] = column_names[i - 1] + DATA_MAX_NAME_LEN;
ALLOC_OR_FAIL(column_values, column_num * sizeof(char *));
- ALLOC_OR_FAIL(column_values[0],
- column_num * DATA_MAX_NAME_LEN);
+ ALLOC_OR_FAIL(column_values[0], column_num * DATA_MAX_NAME_LEN);
for (size_t i = 1; i < column_num; i++)
column_values[i] = column_values[i - 1] + DATA_MAX_NAME_LEN;
*
* Copyright(c) 2016 Intel Corporation. All rights reserved.
*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ *of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
+ * of the Software, and to permit persons to whom the Software is furnished to
+ *do
* so, subject to the following conditions:
*
- * The above copyright notice and this permission notice shall be included in all
+ * The above copyright notice and this permission notice shall be included in
+ *all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
}
opt_buff = new_buff;
int ret = snprintf(opt_buff + buff_off, buff_size - buff_off, option_fmt,
- iface->name);
+ iface->name);
if (ret < 0) {
sfree(opt_buff);
return NULL;
for (int j = 0; j < ci->values_num; j++) {
/* check interface name type */
if (ci->values[j].type != OCONFIG_TYPE_STRING) {
- ERROR(OVS_EVENTS_PLUGIN
- ": given interface name is not a string [idx=%d]", j);
+ ERROR(OVS_EVENTS_PLUGIN ": given interface name is not a string [idx=%d]",
+ j);
return -1;
}
/* allocate memory for configured interface */
}
/* Check and warn about invalid configuration */
if (!ovs_events_ctx.config.send_notification && !dispatch_values) {
- WARNING(OVS_EVENTS_PLUGIN ": send notification and dispatch values "
- "options are disabled. No information will be dispatched by the "
- "plugin. Please check your configuration");
+ WARNING(OVS_EVENTS_PLUGIN
+ ": send notification and dispatch values "
+ "options are disabled. No information will be dispatched by the "
+ "plugin. Please check your configuration");
}
/* Dispatch link status values if configured */
if (dispatch_values)
}
/* Dispatch OVS interface link status event to collectd */
-static void ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifinfo) {
+static void
+ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifinfo) {
const char *msg_link_status = NULL;
notification_t n = {
NOTIF_FAILURE, cdtime(), "", "", OVS_EVENTS_PLUGIN, "", "", "", NULL};
/* fill the notification data */
snprintf(n.message, sizeof(n.message),
- "link state of \"%s\" interface has been changed to \"%s\"",
- ifinfo->name, msg_link_status);
+ "link state of \"%s\" interface has been changed to \"%s\"",
+ ifinfo->name, msg_link_status);
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.plugin_instance, ifinfo->name, sizeof(n.plugin_instance));
sstrncpy(n.type, "gauge", sizeof(n.type));
}
/* Dispatch OVS interface link status value to collectd */
-static void ovs_events_link_status_submit(const ovs_events_iface_info_t *ifinfo) {
+static void
+ovs_events_link_status_submit(const ovs_events_iface_info_t *ifinfo) {
value_list_t vl = VALUE_LIST_INIT;
meta_data_t *meta = NULL;
*
* Copyright(c) 2016 Intel Corporation. All rights reserved.
*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
+ * of the Software, and to permit persons to whom the Software is furnished to
+ * do
* so, subject to the following conditions:
*
- * The above copyright notice and this permission notice shall be included in all
+ * The above copyright notice and this permission notice shall be included in
+ * all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
"external_ids", NULL};
/* subscribe to a tables */
- ovs_db_table_cb_register(pdb, "Bridge", bridge_columns,
- ovs_stats_bridge_table_change_cb,
+ ovs_db_table_cb_register(
+ pdb, "Bridge", bridge_columns, ovs_stats_bridge_table_change_cb,
ovs_stats_bridge_table_result_cb,
- OVS_DB_TABLE_CB_FLAG_INITIAL |
- OVS_DB_TABLE_CB_FLAG_INSERT |
+ OVS_DB_TABLE_CB_FLAG_INITIAL | OVS_DB_TABLE_CB_FLAG_INSERT |
OVS_DB_TABLE_CB_FLAG_MODIFY);
ovs_db_table_cb_register(pdb, "Bridge", bridge_columns,
ovs_stats_bridge_table_delete_cb, NULL,
OVS_DB_TABLE_CB_FLAG_DELETE);
- ovs_db_table_cb_register(pdb, "Port", port_columns,
- ovs_stats_port_table_change_cb,
+ ovs_db_table_cb_register(
+ pdb, "Port", port_columns, ovs_stats_port_table_change_cb,
ovs_stats_port_table_result_cb,
- OVS_DB_TABLE_CB_FLAG_INITIAL |
- OVS_DB_TABLE_CB_FLAG_INSERT |
+ OVS_DB_TABLE_CB_FLAG_INITIAL | OVS_DB_TABLE_CB_FLAG_INSERT |
OVS_DB_TABLE_CB_FLAG_MODIFY);
ovs_db_table_cb_register(pdb, "Port", port_columns,
ovs_stats_port_table_delete_cb, NULL,
OVS_DB_TABLE_CB_FLAG_DELETE);
- ovs_db_table_cb_register(pdb, "Interface", interface_columns,
- ovs_stats_interface_table_change_cb,
+ ovs_db_table_cb_register(
+ pdb, "Interface", interface_columns, ovs_stats_interface_table_change_cb,
ovs_stats_interface_table_result_cb,
- OVS_DB_TABLE_CB_FLAG_INITIAL |
- OVS_DB_TABLE_CB_FLAG_INSERT |
+ OVS_DB_TABLE_CB_FLAG_INITIAL | OVS_DB_TABLE_CB_FLAG_INSERT |
OVS_DB_TABLE_CB_FLAG_MODIFY);
}
plugin_name, ovs_stats_cfg.ovs_db_node, ovs_stats_cfg.ovs_db_serv,
ovs_stats_cfg.ovs_db_unix);
/* connect to OvS DB */
- if ((g_ovs_db = ovs_db_init (ovs_stats_cfg.ovs_db_node,
- ovs_stats_cfg.ovs_db_serv,
+ if ((g_ovs_db =
+ ovs_db_init(ovs_stats_cfg.ovs_db_node, ovs_stats_cfg.ovs_db_serv,
ovs_stats_cfg.ovs_db_unix, &cb)) == NULL) {
ERROR("%s: plugin: failed to connect to OvS DB server", plugin_name);
return -1;
* meta => [ { name => <name>, value => <value> }, ... ]
* }
*/
-static int av2notification_meta(pTHX_ AV *array, notification_meta_t **ret_meta) {
+static int av2notification_meta(pTHX_ AV *array,
+ notification_meta_t **ret_meta) {
notification_meta_t *tail = NULL;
int len = av_len(array);
return 0;
} /* static int g_interval_set (pTHX_ SV *, MAGIC *) */
-static MGVTBL g_pv_vtbl = {g_pv_get, g_pv_set, NULL, NULL, NULL, NULL, NULL
+static MGVTBL g_pv_vtbl = {g_pv_get,
+ g_pv_set,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL
,
NULL
#endif
};
-static MGVTBL g_interval_vtbl = {g_interval_get, g_interval_set, NULL, NULL,
- NULL, NULL, NULL
+static MGVTBL g_interval_vtbl = {g_interval_get,
+ g_interval_set,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL
,
NULL
* is ignored. */
#define C_PSQL_PAR_APPEND(buf, buf_len, parameter, value) \
if ((0 < (buf_len)) && (NULL != (value)) && ('\0' != *(value))) { \
- int s = snprintf(buf, buf_len, " %s = '%s'", parameter, value); \
+ int s = snprintf(buf, buf_len, " %s = '%s'", parameter, value); \
if (0 < s) { \
buf += s; \
buf_len -= s; \
break;
case C_PSQL_PARAM_INTERVAL:
snprintf(interval, sizeof(interval), "%.3f",
- (db->interval > 0) ? CDTIME_T_TO_DOUBLE(db->interval)
- : plugin_get_interval());
+ (db->interval > 0) ? CDTIME_T_TO_DOUBLE(db->interval)
+ : plugin_get_interval());
params[i] = interval;
break;
case C_PSQL_PARAM_INSTANCE:
}
return PQexecParams(db->conn, udb_query_get_statement(q), data->params_num,
- NULL, (const char *const*)params, NULL, NULL, 0);
+ NULL, (const char *const *)params, NULL, NULL, 0);
} /* c_psql_exec_query_params */
/* db->db_lock must be locked when calling this function */
status = snprintf(str_ptr, str_len, ",'gauge'");
else
status = snprintf(str_ptr, str_len, ",'%s'",
- DS_TYPE_TO_STRING(ds->ds[i].type));
+ DS_TYPE_TO_STRING(ds->ds[i].type));
if (status < 1) {
str_len = 0;
char match_name[2 * DATA_MAX_NAME_LEN];
snprintf(match_name, sizeof(match_name), "%s:%s", key_buffer,
- key_fields[i]);
+ key_fields[i]);
if (ignorelist_match(values_list, match_name))
continue;
static PyObject *cpy_register_notification(PyObject *self, PyObject *args,
PyObject *kwds) {
return cpy_register_generic_userdata((void *)plugin_register_notification,
- (void *)cpy_notification_callback,
- args, kwds);
+ (void *)cpy_notification_callback, args,
+ kwds);
}
static PyObject *cpy_register_flush(PyObject *self, PyObject *args,
}
static PyObject *cpy_unregister_write(PyObject *self, PyObject *arg) {
- return cpy_unregister_generic_userdata(plugin_unregister_write, arg,
- "write");
+ return cpy_unregister_generic_userdata(plugin_unregister_write, arg, "write");
}
static PyObject *cpy_unregister_notification(PyObject *self, PyObject *arg) {
}
static PyObject *cpy_unregister_flush(PyObject *self, PyObject *arg) {
- return cpy_unregister_generic_userdata(plugin_unregister_flush, arg,
- "flush");
+ return cpy_unregister_generic_userdata(plugin_unregister_flush, arg, "flush");
}
static PyObject *cpy_unregister_shutdown(PyObject *self, PyObject *arg) {
static int handle_interface(__attribute__((unused))
ros_connection_t *c, /* {{{ */
- const ros_interface_t *i,
- void *user_data) {
+ const ros_interface_t *i, void *user_data) {
if ((i == NULL) || (user_data == NULL))
return EINVAL;
/*** RX ***/
snprintf(type_instance, sizeof(type_instance), "%s-%s-rx", r->interface,
- r->radio_name);
+ r->radio_name);
cr_submit_gauge(rd, "bitrate", type_instance,
(gauge_t)(1000000.0 * r->rx_rate));
cr_submit_gauge(rd, "signal_power", type_instance,
/*** TX ***/
snprintf(type_instance, sizeof(type_instance), "%s-%s-tx", r->interface,
- r->radio_name);
+ r->radio_name);
cr_submit_gauge(rd, "bitrate", type_instance,
(gauge_t)(1000000.0 * r->tx_rate));
cr_submit_gauge(rd, "signal_power", type_instance,
/*** RX / TX ***/
snprintf(type_instance, sizeof(type_instance), "%s-%s", r->interface,
- r->radio_name);
+ r->radio_name);
cr_submit_io(rd, "if_octets", type_instance, (derive_t)r->rx_bytes,
(derive_t)r->tx_bytes);
cr_submit_gauge(rd, "snr", type_instance, (gauge_t)r->signal_to_noise);
static int handle_regtable(__attribute__((unused))
ros_connection_t *c, /* {{{ */
- const ros_registration_table_t *r,
- void *user_data) {
+ const ros_registration_table_t *r, void *user_data) {
if ((r == NULL) || (user_data == NULL))
return EINVAL;
if (ds->ds[i].type == DS_TYPE_COUNTER) {
status = snprintf(buffer + offset, buffer_len - offset, ":%llu",
- vl->values[i].counter);
+ vl->values[i].counter);
} else if (ds->ds[i].type == DS_TYPE_GAUGE) {
status = snprintf(buffer + offset, buffer_len - offset, ":%f",
- vl->values[i].gauge);
+ vl->values[i].gauge);
} else if (ds->ds[i].type == DS_TYPE_DERIVE) {
status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
- vl->values[i].derive);
+ vl->values[i].derive);
} else /* if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */ {
status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
- vl->values[i].absolute);
+ vl->values[i].absolute);
}
if ((status < 1) || (status >= (buffer_len - offset)))
if (ds->ds[i].type == DS_TYPE_COUNTER)
status = snprintf(buffer + offset, buffer_len - offset, ":%llu",
- vl->values[i].counter);
+ vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_GAUGE)
status = snprintf(buffer + offset, buffer_len - offset, ":" GAUGE_FORMAT,
- vl->values[i].gauge);
+ vl->values[i].gauge);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
- vl->values[i].derive);
+ vl->values[i].derive);
else /*if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */
status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
- vl->values[i].absolute);
+ vl->values[i].absolute);
if ((status < 1) || (status >= (buffer_len - offset)))
return -1;
switch (ds->ds[0].type) {
case DS_TYPE_DERIVE:
status = snprintf(buffer, buffer_len, "%u:%" PRIi64, (unsigned)tt,
- vl->values[0].derive);
+ vl->values[0].derive);
break;
case DS_TYPE_GAUGE:
status = snprintf(buffer, buffer_len, "%u:" GAUGE_FORMAT, (unsigned)tt,
- vl->values[0].gauge);
+ vl->values[0].gauge);
break;
case DS_TYPE_COUNTER:
status = snprintf(buffer, buffer_len, "%u:%llu", (unsigned)tt,
- vl->values[0].counter);
+ vl->values[0].counter);
break;
case DS_TYPE_ABSOLUTE:
status = snprintf(buffer, buffer_len, "%u:%" PRIu64, (unsigned)tt,
- vl->values[0].absolute);
+ vl->values[0].absolute);
break;
default:
return EINVAL;
value_list_t vl = VALUE_LIST_INIT;
status = snprintf(match_key, sizeof(match_key), "%s/%s-%s", plugin_instance,
- type, type_instance);
+ type, type_instance);
if (status < 1)
return;
cfdev->sdi = devlist->data;
g_slist_free(devlist);
snprintf(hwident, sizeof(hwident), "%s %s %s",
- cfdev->sdi->vendor ? cfdev->sdi->vendor : "",
- cfdev->sdi->model ? cfdev->sdi->model : "",
- cfdev->sdi->version ? cfdev->sdi->version : "");
+ cfdev->sdi->vendor ? cfdev->sdi->vendor : "",
+ cfdev->sdi->model ? cfdev->sdi->model : "",
+ cfdev->sdi->version ? cfdev->sdi->version : "");
INFO("sigrok plugin: Device \"%s\" is a %s", cfdev->name, hwident);
if (sr_dev_open(cfdev->sdi) != SR_OK)
sstrncpy(notif.plugin_instance, name, sizeof(notif.plugin_instance));
sstrncpy(notif.type_instance, a->name, sizeof(notif.type_instance));
snprintf(notif.message, sizeof(notif.message),
- "attribute %s is below allowed threshold (%d < %d)", a->name,
- a->current_value, a->threshold);
+ "attribute %s is below allowed threshold (%d < %d)", a->name,
+ a->current_value, a->threshold);
plugin_dispatch_notification(¬if);
}
}
}
static int csnmp_oid_compare(oid_t const *left, oid_t const *right) {
- return snmp_oid_compare(left->oid, left->oid_len, right->oid,
- right->oid_len);
+ return snmp_oid_compare(left->oid, left->oid_len, right->oid, right->oid_len);
}
static int csnmp_oid_suffix(oid_t *dst, oid_t const *src, oid_t const *root) {
src = (char *)vb->val.bitstring;
else if (vb->type == ASN_IPADDRESS) {
return snprintf(dst, dst_size,
- "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "",
- (uint8_t)vb->val.string[0], (uint8_t)vb->val.string[1],
- (uint8_t)vb->val.string[2], (uint8_t)vb->val.string[3]);
+ "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "",
+ (uint8_t)vb->val.string[0], (uint8_t)vb->val.string[1],
+ (uint8_t)vb->val.string[2], (uint8_t)vb->val.string[3]);
} else {
dst[0] = 0;
return EINVAL;
sstrncpy(vl.type_instance, temp, sizeof(vl.type_instance));
else
snprintf(vl.type_instance, sizeof(vl.type_instance), "%s%s",
- data->instance_prefix, temp);
+ data->instance_prefix, temp);
}
vl.values_len = data->values_len;
return 0;
}
-static void snmp_agent_generate_oid2string(oid_t *oid, size_t offset, char *key) {
+static void snmp_agent_generate_oid2string(oid_t *oid, size_t offset,
+ char *key) {
int key_len = oid->oid[offset];
int i;
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.plugin_instance, ins, sizeof(n.plugin_instance));
snprintf(n.message, sizeof(n.message),
- "Removed data row from table %s instance %s index %d", td->name,
- ins, (index != NULL) ? *index : -1);
+ "Removed data row from table %s instance %s index %d", td->name, ins,
+ (index != NULL) ? *index : -1);
plugin_dispatch_notification(&n);
if (td->index_oid.oid_len) {
if (dd->is_instance) {
requests->requestvb->type = ASN_OCTET_STR;
- snmp_set_var_typed_value(requests->requestvb,
- requests->requestvb->type, (const u_char *)instance,
- strlen((instance)));
+ snmp_set_var_typed_value(
+ requests->requestvb, requests->requestvb->type,
+ (const u_char *)instance, strlen((instance)));
pthread_mutex_unlock(&g_agent->lock);
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.plugin_instance, ins, sizeof(n.plugin_instance));
snprintf(n.message, sizeof(n.message),
- "Data row added to table %s instance %s index %d", td->name, ins,
- (index != NULL) ? *index : -1);
+ "Data row added to table %s instance %s index %d", td->name, ins,
+ (index != NULL) ? *index : -1);
plugin_dispatch_notification(&n);
return 0;
return ERANGE;
}
- tmp = realloc(conf_timer_percentile, sizeof(*conf_timer_percentile) *
- (conf_timer_percentile_num + 1));
+ tmp =
+ realloc(conf_timer_percentile,
+ sizeof(*conf_timer_percentile) * (conf_timer_percentile_num + 1));
if (tmp == NULL) {
ERROR("statsd plugin: realloc failed.");
return ENOMEM;
}
for (size_t i = 0; i < conf_timer_percentile_num; i++) {
- snprintf(vl.type_instance, sizeof(vl.type_instance),
- "%s-percentile-%.0f", name, conf_timer_percentile[i]);
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-percentile-%.0f",
+ name, conf_timer_percentile[i]);
vl.values[0].gauge =
have_events ? CDTIME_T_TO_DOUBLE(latency_counter_get_percentile(
metric->latency, conf_timer_percentile[i]))
return 0;
} /* }}} int swap_read */
- /* #endif KERNEL_LINUX */
+/* #endif KERNEL_LINUX */
/*
* Under Solaris, two mechanisms can be used to read swap statistics, swapctl
#define BUFFER_ADD(...) \
do { \
- status = snprintf(&buf[offset], sizeof(buf) - offset, __VA_ARGS__); \
+ status = snprintf(&buf[offset], sizeof(buf) - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (sizeof(buf) - offset)) \
/* If this is a gauge value, use the current value. */
if (ds->ds[i].type == DS_TYPE_GAUGE)
snprintf(value_str, sizeof(value_str), GAUGE_FORMAT,
- (double)vl->values[i].gauge);
+ (double)vl->values[i].gauge);
/* If it's a counter, try to use the current rate. This may fail, if the
* value has been renamed. */
else if (rates != NULL)
curr_counter = (uint64_t)vl->values[dsrc_index].counter;
snprintf(key_prev_counter, sizeof(key_prev_counter),
- "target_scale[%p,%i]:prev_counter", (void *)data, dsrc_index);
+ "target_scale[%p,%i]:prev_counter", (void *)data, dsrc_index);
snprintf(key_int_counter, sizeof(key_int_counter),
- "target_scale[%p,%i]:int_counter", (void *)data, dsrc_index);
+ "target_scale[%p,%i]:int_counter", (void *)data, dsrc_index);
snprintf(key_int_fraction, sizeof(key_int_fraction),
- "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
+ "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
prev_counter = curr_counter;
int_counter = 0;
curr_derive = (int64_t)vl->values[dsrc_index].derive;
snprintf(key_prev_derive, sizeof(key_prev_derive),
- "target_scale[%p,%i]:prev_derive", (void *)data, dsrc_index);
+ "target_scale[%p,%i]:prev_derive", (void *)data, dsrc_index);
snprintf(key_int_derive, sizeof(key_int_derive),
- "target_scale[%p,%i]:int_derive", (void *)data, dsrc_index);
+ "target_scale[%p,%i]:int_derive", (void *)data, dsrc_index);
snprintf(key_int_fraction, sizeof(key_int_fraction),
- "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
+ "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
prev_derive = curr_derive;
int_derive = 0;
curr_absolute = (uint64_t)vl->values[dsrc_index].absolute;
snprintf(key_int_fraction, sizeof(key_int_fraction),
- "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
+ "target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
int_fraction = 0.0;
/* Dispatch new value lists instead of this one */
new_vl.values[0].derive = (derive_t)vl->values[0].counter;
- snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
- "demand_data-%s", is_hits ? "hit" : "miss");
+ snprintf(new_vl.type_instance, sizeof(new_vl.type_instance), "demand_data-%s",
+ is_hits ? "hit" : "miss");
plugin_dispatch_values(&new_vl);
new_vl.values[0].derive = (derive_t)vl->values[1].counter;
snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
- "demand_metadata-%s", is_hits ? "hit" : "miss");
+ "demand_metadata-%s", is_hits ? "hit" : "miss");
plugin_dispatch_values(&new_vl);
new_vl.values[0].derive = (derive_t)vl->values[2].counter;
snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
- "prefetch_data-%s", is_hits ? "hit" : "miss");
+ "prefetch_data-%s", is_hits ? "hit" : "miss");
plugin_dispatch_values(&new_vl);
new_vl.values[0].derive = (derive_t)vl->values[3].counter;
snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
- "prefetch_metadata-%s", is_hits ? "hit" : "miss");
+ "prefetch_metadata-%s", is_hits ? "hit" : "miss");
plugin_dispatch_values(&new_vl);
/* Abort processing */
#undef HAVE_SYSCTLBYNAME /* force HAVE_LIBKVM_NLIST path */
#endif
-#if !KERNEL_LINUX && !HAVE_SYSCTLBYNAME && !HAVE_KVM_GETFILES && !HAVE_LIBKVM_NLIST && !KERNEL_AIX
+#if !KERNEL_LINUX && !HAVE_SYSCTLBYNAME && !HAVE_KVM_GETFILES && \
+ !HAVE_LIBKVM_NLIST && !KERNEL_AIX
#error "No applicable input method."
#endif
/* #endif HAVE_SYSCTLBYNAME */
#elif HAVE_KVM_GETFILES
-#include <sys/types.h>
#include <sys/sysctl.h>
+#include <sys/types.h>
#define _KERNEL /* for DTYPE_SOCKET */
#include <sys/file.h>
#undef _KERNEL
#include <net/route.h>
#include <netdb.h>
#include <netinet/in.h>
-#include <netinet/ip.h>
#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
+#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/tcp.h>
#include <netinet/tcp_timer.h>
if (((port_collect_listening != 0) && (pe->flags & PORT_IS_LISTENING)) ||
(pe->flags & PORT_COLLECT_LOCAL)) {
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
- "%" PRIu16 "-local", pe->port);
+ "%" PRIu16 "-local", pe->port);
for (int i = 1; i <= TCP_STATE_MAX; i++) {
vl.values[0].gauge = pe->count_local[i];
if (pe->flags & PORT_COLLECT_REMOTE) {
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
- "%" PRIu16 "-remote", pe->port);
+ "%" PRIu16 "-remote", pe->port);
for (int i = 1; i <= TCP_STATE_MAX; i++) {
vl.values[0].gauge = pe->count_remote[i];
conn_reset_port_entry();
- kf = kvm_getfiles(kvmd, KERN_FILE_BYFILE, DTYPE_SOCKET,
- sizeof(*kf), &fcnt);
+ kf = kvm_getfiles(kvmd, KERN_FILE_BYFILE, DTYPE_SOCKET, sizeof(*kf), &fcnt);
if (kf == NULL) {
ERROR("tcpconns plugin: kvm_getfiles failed.");
return -1;
} else {
/* Request server information */
snprintf(plugin_instance, sizeof(plugin_instance), "vserver%i",
- vserver->port);
+ vserver->port);
/* Select the server */
status = tss2_select_vserver(read_fh, write_fh, vserver);
*/
len = snprintf(filename, sizeof(filename), "%s/%s/temperature",
- dirname_procfs, name);
+ dirname_procfs, name);
if ((len < 0) || ((size_t)len >= sizeof(filename)))
return -1;
return status;
} /* int ut_config_host */
- /*
- * End of the functions used to configure threshold values.
- */
+/*
+ * End of the functions used to configure threshold values.
+ */
/* }}} */
/*
snprintf(buf, bufsize, ": Value is no longer missing.");
else
snprintf(buf, bufsize, ": All data sources are within range again. "
- "Current value of \"%s\" is %f.",
- ds->ds[ds_index].name, values[ds_index]);
+ "Current value of \"%s\" is %f.",
+ ds->ds[ds_index].name, values[ds_index]);
} else {
double min;
double max;
if (th->flags & UT_FLAG_INVERT) {
if (!isnan(min) && !isnan(max)) {
snprintf(buf, bufsize,
- ": Data source \"%s\" is currently "
- "%f. That is within the %s region of %f%s and %f%s.",
- ds->ds[ds_index].name, values[ds_index],
- (state == STATE_ERROR) ? "failure" : "warning", min,
- ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "", max,
- ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
+ ": Data source \"%s\" is currently "
+ "%f. That is within the %s region of %f%s and %f%s.",
+ ds->ds[ds_index].name, values[ds_index],
+ (state == STATE_ERROR) ? "failure" : "warning", min,
+ ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "", max,
+ ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
} else {
snprintf(buf, bufsize, ": Data source \"%s\" is currently "
- "%f. That is %s the %s threshold of %f%s.",
- ds->ds[ds_index].name, values[ds_index],
- isnan(min) ? "below" : "above",
- (state == STATE_ERROR) ? "failure" : "warning",
- isnan(min) ? max : min,
- ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
+ "%f. That is %s the %s threshold of %f%s.",
+ ds->ds[ds_index].name, values[ds_index],
+ isnan(min) ? "below" : "above",
+ (state == STATE_ERROR) ? "failure" : "warning",
+ isnan(min) ? max : min,
+ ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
}
} else if (th->flags & UT_FLAG_PERCENTAGE) {
gauge_t value;
value = 100.0 * values[ds_index] / sum;
snprintf(buf, bufsize,
- ": Data source \"%s\" is currently "
- "%g (%.2f%%). That is %s the %s threshold of %.2f%%.",
- ds->ds[ds_index].name, values[ds_index], value,
- (value < min) ? "below" : "above",
- (state == STATE_ERROR) ? "failure" : "warning",
- (value < min) ? min : max);
+ ": Data source \"%s\" is currently "
+ "%g (%.2f%%). That is %s the %s threshold of %.2f%%.",
+ ds->ds[ds_index].name, values[ds_index], value,
+ (value < min) ? "below" : "above",
+ (state == STATE_ERROR) ? "failure" : "warning",
+ (value < min) ? min : max);
} else /* is not inverted */
{
snprintf(buf, bufsize, ": Data source \"%s\" is currently "
- "%f. That is %s the %s threshold of %f.",
- ds->ds[ds_index].name, values[ds_index],
- (values[ds_index] < min) ? "below" : "above",
- (state == STATE_ERROR) ? "failure" : "warning",
- (values[ds_index] < min) ? min : max);
+ "%f. That is %s the %s threshold of %f.",
+ ds->ds[ds_index].name, values[ds_index],
+ (values[ds_index] < min) ? "below" : "above",
+ (state == STATE_ERROR) ? "failure" : "warning",
+ (values[ds_index] < min) ? min : max);
}
}
NOTIFICATION_INIT_VL(&n, vl);
snprintf(n.message, sizeof(n.message),
- "%s has not been updated for %.3f seconds.", identifier,
- CDTIME_T_TO_DOUBLE(missing_time));
+ "%s has not been updated for %.3f seconds.", identifier,
+ CDTIME_T_TO_DOUBLE(missing_time));
n.time = now;
plugin_dispatch_notification(&n);
1.0 / 1000000 * t->aperf / interval_float);
if ((!aperf_mperf_unstable) || (!(t->aperf > t->tsc || t->mperf > t->tsc)))
- turbostat_submit(name, "frequency", "busy", 1.0 * t->tsc / 1000000 *
- t->aperf / t->mperf /
- interval_float);
+ turbostat_submit(name, "frequency", "busy",
+ 1.0 * t->tsc / 1000000 * t->aperf / t->mperf /
+ interval_float);
/* Sanity check (should stay stable) */
turbostat_submit(name, "gauge", "TSC",
char character;
snprintf(path, sizeof(path),
- "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
+ "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
filep = fopen(path, "r");
if (!filep) {
ERROR("turbostat plugin: Failed to open '%s'", path);
escape_string(buffer_values, sizeof(buffer_values));
snprintf(ret, ret_len, "PUTVAL %s interval=%.3f %s", buffer_ident,
- (vl->interval > 0) ? CDTIME_T_TO_DOUBLE(vl->interval)
- : CDTIME_T_TO_DOUBLE(plugin_get_interval()),
- buffer_values);
+ (vl->interval > 0) ? CDTIME_T_TO_DOUBLE(vl->interval)
+ : CDTIME_T_TO_DOUBLE(plugin_get_interval()),
+ buffer_values);
return 0;
} /* }}} int cmd_create_putval */
* Sebastian 'tokkee' Harl <sh at tokkee.org>
**/
+#include "utils_cmds.h"
#include "daemon/common.h"
#include "utils_cmd_flush.h"
#include "utils_cmd_getval.h"
#include "utils_cmd_listval.h"
#include "utils_cmd_putval.h"
-#include "utils_cmds.h"
#include "utils_parse_option.h"
#include <stdbool.h>
snprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
snprintf(phc->eal_config.process_type, DATA_MAX_NAME_LEN, "%s", "secondary");
snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "%s",
- DPDK_DEFAULT_RTE_CONFIG);
+ DPDK_DEFAULT_RTE_CONFIG);
}
int dpdk_helper_eal_config_set(dpdk_helper_ctx_t *phc, dpdk_eal_config_t *ec) {
} else if ((strcasecmp("FilePrefix", child->key) == 0) &&
(child->values[0].type == OCONFIG_TYPE_STRING)) {
snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
- "/var/run/.%s_config", child->values[0].value.string);
+ "/var/run/.%s_config", child->values[0].value.string);
DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
} else {
ERROR("dpdk_common: Invalid '%s' configuration option", child->key);
#define BUFFER_ADD(...) \
do { \
- status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
+ status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
if (status < 1) { \
return -1; \
} else if (((size_t)status) >= (ret_len - offset)) { \
if (n_plugin_instance[0] != '\0')
snprintf(tmp_plugin, sizeof(tmp_plugin), "%s%c%s", n_plugin,
- (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
- n_plugin_instance);
+ (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
+ n_plugin_instance);
else
sstrncpy(tmp_plugin, n_plugin, sizeof(tmp_plugin));
sstrncpy(tmp_type, n_type_instance, sizeof(tmp_type));
else
snprintf(tmp_type, sizeof(tmp_type), "%s%c%s", n_type,
- (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
- n_type_instance);
+ (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
+ n_type_instance);
} else
sstrncpy(tmp_type, n_type, sizeof(tmp_type));
if ((flags & GRAPHITE_DROP_DUPE_FIELDS) &&
strcmp(tmp_plugin, tmp_type) == 0)
snprintf(ret, ret_len, "%s%s%s.%s.%s", prefix, n_host, postfix,
- tmp_plugin, ds_name);
+ tmp_plugin, ds_name);
else
snprintf(ret, ret_len, "%s%s%s.%s.%s.%s", prefix, n_host, postfix,
- tmp_plugin, tmp_type, ds_name);
+ tmp_plugin, tmp_type, ds_name);
} else
snprintf(ret, ret_len, "%s%s%s.%s.%s", prefix, n_host, postfix, tmp_plugin,
- tmp_type);
+ tmp_type);
return 0;
}
/* Compute the graphite command */
message_len =
(size_t)snprintf(message, sizeof(message), "%s %s %u\r\n", key, values,
- (unsigned int)CDTIME_T_TO_TIME_T(vl->time));
+ (unsigned int)CDTIME_T_TO_TIME_T(vl->time));
if (message_len >= sizeof(message)) {
ERROR("format_graphite: message buffer too small: "
"Need %zu bytes.",
#define BUFFER_ADD(...) \
do { \
int status; \
- status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) { \
sfree(rates); \
return -1; \
#define BUFFER_ADD(...) \
do { \
int status; \
- status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
#define BUFFER_ADD(...) \
do { \
int status; \
- status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
#define BUFFER_ADD(...) \
do { \
- status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
#define BUFFER_ADD(...) \
do { \
- status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
}
JSON_ADD(g, "severity");
- JSON_ADD(g, (n->severity == NOTIF_FAILURE)
- ? "FAILURE"
- : (n->severity == NOTIF_WARNING)
- ? "WARNING"
- : (n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN");
+ JSON_ADD(g,
+ (n->severity == NOTIF_FAILURE)
+ ? "FAILURE"
+ : (n->severity == NOTIF_WARNING)
+ ? "WARNING"
+ : (n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN");
JSON_ADD(g, "service");
JSON_ADD(g, "collectd");
#define BUFFER_ADD(...) \
do { \
int status; \
- status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) { \
sfree(rates); \
return -1; \
#define BUFFER_ADD(...) \
do { \
- status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
if (*ret_buffer_free < 3)
return -ENOMEM;
- return format_kairosdb_value_list_nocheck(buffer, ret_buffer_fill,
- ret_buffer_free, ds, vl,
- store_rates,
- (*ret_buffer_free) - 2,
- http_attrs, http_attrs_num,
- data_ttl);
+ return format_kairosdb_value_list_nocheck(
+ buffer, ret_buffer_fill, ret_buffer_free, ds, vl, store_rates,
+ (*ret_buffer_free) - 2, http_attrs, http_attrs_num, data_ttl);
} /* }}} int format_kairosdb_value_list */
/* vim: set sw=2 sts=2 et fdm=marker : */
* Pavel Rochnyack <pavel2000 at ngs.ru>
*/
-#include "common.h"
#include "utils_latency_config.h"
+#include "common.h"
#include "collectd.h"
static int latency_config_add_percentile(latency_config_t *conf,
* GCC will complain about the macro definition. */
#define DONT_POISON_SPRINTF_YET
-#include "common.h"
#include "utils_lua.h"
+#include "common.h"
static int ltoc_values(lua_State *L, /* {{{ */
const data_set_t *ds, value_t *ret_values) {
return first;
} /* static cu_mount_t *cu_mount_gen_getmntent (void) */
-/* #endif HAVE_TWO_GETMNTENT || HAVE_GEN_GETMNTENT || HAVE_SUN_GETMNTENT */
+ /* #endif HAVE_TWO_GETMNTENT || HAVE_GEN_GETMNTENT || HAVE_SUN_GETMNTENT */
#elif HAVE_SEQ_GETMNTENT
#warn "This version of `getmntent' hat not yet been implemented!"
*
* Copyright(c) 2016 Intel Corporation. All rights reserved.
*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ *of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
+ * of the Software, and to permit persons to whom the Software is furnished to
+ *do
* so, subject to the following conditions:
*
- * The above copyright notice and this permission notice shall be included in all
+ * The above copyright notice and this permission notice shall be included in
+ *all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*/
static yajl_gen_status ovs_yajl_gen_tstring(yajl_gen hander,
const char *string) {
- return yajl_gen_string(hander, (const unsigned char *)string,
- strlen(string));
+ return yajl_gen_string(hander, (const unsigned char *)string, strlen(string));
}
/* Add YAJL value into YAJL generator handle (JSON object)
break;
status = snprintf(buffer, sizeof(buffer), "RRA:%s:%.10f:%u:%u",
- rra_types[j], cfg->xff, cdp_len, cdp_num);
+ rra_types[j], cfg->xff, cdp_len, cdp_num);
if ((status < 0) || ((size_t)status >= sizeof(buffer))) {
ERROR("rra_get: Buffer would have been truncated.");
} else
snprintf(max, sizeof(max), "%f", d->max);
- status = snprintf(buffer, sizeof(buffer), "DS:%s:%s:%i:%s:%s", d->name,
- type, (cfg->heartbeat > 0)
- ? cfg->heartbeat
- : (int)CDTIME_T_TO_TIME_T(2 * vl->interval),
- min, max);
+ status = snprintf(
+ buffer, sizeof(buffer), "DS:%s:%s:%i:%s:%s", d->name, type,
+ (cfg->heartbeat > 0) ? cfg->heartbeat
+ : (int)CDTIME_T_TO_TIME_T(2 * vl->interval),
+ min, max);
if ((status < 1) || ((size_t)status >= sizeof(buffer)))
break;
for (size_t i = 0; i < data->latency_config.percentile_num; i++) {
if (strlen(data->type_instance) != 0)
snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%.0f",
- data->type_instance, data->latency_config.percentile[i]);
+ data->type_instance, data->latency_config.percentile[i]);
else
snprintf(vl.type_instance, sizeof(vl.type_instance), "%.0f",
- data->latency_config.percentile[i]);
+ data->latency_config.percentile[i]);
vl.values = &(value_t){
.gauge =
if (strlen(data->type_instance) != 0)
snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s-%g_%g",
- data->type, data->type_instance, lower_bound, upper_bound);
+ data->type, data->type_instance, lower_bound, upper_bound);
else
snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%g_%g",
- data->type, lower_bound, upper_bound);
+ data->type, lower_bound, upper_bound);
vl.values = &(value_t){
.gauge =
if (plugin_instance == NULL)
plugin_instance = "default";
snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
- plugin_instance, category);
+ plugin_instance, category);
sstrncpy(vl.type, type, sizeof(vl.type));
const char *category, const char *type,
const char *type_instance,
uint64_t gauge_value) {
- return varnish_submit(plugin_instance, category, type, type_instance, (value_t){
- .gauge=(gauge_t)gauge_value,
- });
+ return varnish_submit(plugin_instance, category, type, type_instance,
+ (value_t){
+ .gauge = (gauge_t)gauge_value,
+ });
} /* }}} int varnish_submit_gauge */
static int varnish_submit_derive(const char *plugin_instance, /* {{{ */
const char *category, const char *type,
const char *type_instance,
uint64_t derive_value) {
- return varnish_submit(plugin_instance, category, type, type_instance, (value_t){
- .derive=(derive_t)derive_value,
- });
+ return varnish_submit(plugin_instance, category, type, type_instance,
+ (value_t){
+ .derive = (derive_t)derive_value,
+ });
} /* }}} int varnish_submit_derive */
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
if (conf->collect_connections) {
if (strcmp(name, "client_conn") == 0)
- return varnish_submit_derive(conf->instance, "connections",
- "connections", "accepted", val);
+ return varnish_submit_derive(conf->instance, "connections", "connections",
+ "accepted", val);
else if (strcmp(name, "client_drop") == 0)
- return varnish_submit_derive(conf->instance, "connections",
- "connections", "dropped", val);
+ return varnish_submit_derive(conf->instance, "connections", "connections",
+ "dropped", val);
else if (strcmp(name, "client_req") == 0)
- return varnish_submit_derive(conf->instance, "connections",
- "connections", "received", val);
+ return varnish_submit_derive(conf->instance, "connections", "connections",
+ "received", val);
}
#ifdef HAVE_VARNISH_V3
if (conf->collect_dirdns) {
if (strcmp(name, "dir_dns_lookups") == 0)
- return varnish_submit_derive(conf->instance, "dirdns",
- "cache_operation", "lookups", val);
+ return varnish_submit_derive(conf->instance, "dirdns", "cache_operation",
+ "lookups", val);
else if (strcmp(name, "dir_dns_failed") == 0)
return varnish_submit_derive(conf->instance, "dirdns", "cache_result",
"failed", val);
return varnish_submit_gauge(conf->instance, "sms", "requests",
"outstanding", val);
else if (strcmp(name, "sms_nbytes") == 0)
- return varnish_submit_gauge(conf->instance, "sms", "bytes",
- "outstanding", val);
+ return varnish_submit_gauge(conf->instance, "sms", "bytes", "outstanding",
+ val);
else if (strcmp(name, "sms_balloc") == 0)
return varnish_submit_derive(conf->instance, "sms", "total_bytes",
"allocated", val);
else if (strcmp(name, "sms_bfree") == 0)
- return varnish_submit_derive(conf->instance, "sms", "total_bytes",
- "free", val);
+ return varnish_submit_derive(conf->instance, "sms", "total_bytes", "free",
+ val);
}
if (conf->collect_struct) {
if (strcmp(name, "n_sess_mem") == 0)
- return varnish_submit_gauge(conf->instance, "struct",
- "current_sessions", "sess_mem", val);
+ return varnish_submit_gauge(conf->instance, "struct", "current_sessions",
+ "sess_mem", val);
else if (strcmp(name, "n_sess") == 0)
- return varnish_submit_gauge(conf->instance, "struct",
- "current_sessions", "sess", val);
+ return varnish_submit_gauge(conf->instance, "struct", "current_sessions",
+ "sess", val);
else if (strcmp(name, "n_object") == 0)
- return varnish_submit_gauge(conf->instance, "struct", "objects",
- "object", val);
+ return varnish_submit_gauge(conf->instance, "struct", "objects", "object",
+ val);
else if (strcmp(name, "n_vampireobject") == 0)
return varnish_submit_gauge(conf->instance, "struct", "objects",
"vampireobject", val);
return varnish_submit_derive(conf->instance, "totals", "total_requests",
"requests", val);
else if (strcmp(name, "s_pipe") == 0)
- return varnish_submit_derive(conf->instance, "totals",
- "total_operations", "pipe", val);
+ return varnish_submit_derive(conf->instance, "totals", "total_operations",
+ "pipe", val);
else if (strcmp(name, "s_pass") == 0)
- return varnish_submit_derive(conf->instance, "totals",
- "total_operations", "pass", val);
+ return varnish_submit_derive(conf->instance, "totals", "total_operations",
+ "pass", val);
else if (strcmp(name, "s_fetch") == 0)
- return varnish_submit_derive(conf->instance, "totals",
- "total_operations", "fetches", val);
+ return varnish_submit_derive(conf->instance, "totals", "total_operations",
+ "fetches", val);
else if (strcmp(name, "s_synth") == 0)
return varnish_submit_derive(conf->instance, "totals", "total_bytes",
"synth", val);
return varnish_submit_derive(conf->instance, "totals", "total_bytes",
"pipe_out", val);
else if (strcmp(name, "n_purges") == 0)
- return varnish_submit_derive(conf->instance, "totals",
- "total_operations", "purges", val);
+ return varnish_submit_derive(conf->instance, "totals", "total_operations",
+ "purges", val);
else if (strcmp(name, "s_hdrbytes") == 0)
return varnish_submit_derive(conf->instance, "totals", "total_bytes",
"header-bytes", val);
return varnish_submit_derive(conf->instance, "totals", "total_bytes",
"body-bytes", val);
else if (strcmp(name, "n_gzip") == 0)
- return varnish_submit_derive(conf->instance, "totals",
- "total_operations", "gzip", val);
+ return varnish_submit_derive(conf->instance, "totals", "total_operations",
+ "gzip", val);
else if (strcmp(name, "n_gunzip") == 0)
- return varnish_submit_derive(conf->instance, "totals",
- "total_operations", "gunzip", val);
+ return varnish_submit_derive(conf->instance, "totals", "total_operations",
+ "gunzip", val);
}
if (conf->collect_uptime) {
return varnish_submit_gauge(conf->instance, "vcl", "vcl", "avail_vcl",
val);
else if (strcmp(name, "n_vcl_discard") == 0)
- return varnish_submit_gauge(conf->instance, "vcl", "vcl",
- "discarded_vcl", val);
+ return varnish_submit_gauge(conf->instance, "vcl", "vcl", "discarded_vcl",
+ val);
else if (strcmp(name, "vmods") == 0)
return varnish_submit_gauge(conf->instance, "vcl", "objects", "vmod",
val);
return varnish_submit_derive(conf->instance, "workers", "total_threads",
"dropped", val);
else if (strcmp(name, "n_wrk_queue") == 0)
- return varnish_submit_derive(conf->instance, "workers",
- "total_requests", "queued", val);
+ return varnish_submit_derive(conf->instance, "workers", "total_requests",
+ "queued", val);
else if (strcmp(name, "n_wrk_overflow") == 0)
- return varnish_submit_derive(conf->instance, "workers",
- "total_requests", "overflowed", val);
+ return varnish_submit_derive(conf->instance, "workers", "total_requests",
+ "overflowed", val);
else if (strcmp(name, "n_wrk_queued") == 0)
- return varnish_submit_derive(conf->instance, "workers",
- "total_requests", "queued", val);
+ return varnish_submit_derive(conf->instance, "workers", "total_requests",
+ "queued", val);
else if (strcmp(name, "n_wrk_lqueue") == 0)
- return varnish_submit_derive(conf->instance, "workers",
- "total_requests", "queue_length", val);
+ return varnish_submit_derive(conf->instance, "workers", "total_requests",
+ "queue_length", val);
}
#if HAVE_VARNISH_V4
/* group = */ "varnish",
/* name = */ "varnish/localhost",
/* callback = */ varnish_read,
- /* interval = */ 0, &(user_data_t){
- .data = conf, .free_func = varnish_config_free,
- });
+ /* interval = */ 0,
+ &(user_data_t){
+ .data = conf, .free_func = varnish_config_free,
+ });
return 0;
} /* }}} int varnish_init */
}
snprintf(callback_name, sizeof(callback_name), "varnish/%s",
- (conf->instance == NULL) ? "localhost" : conf->instance);
+ (conf->instance == NULL) ? "localhost" : conf->instance);
plugin_register_complex_read(
/* group = */ "varnish",
/* name = */ callback_name,
/* callback = */ varnish_read,
- /* interval = */ 0, &(user_data_t){
- .data = conf, .free_func = varnish_config_free,
- });
+ /* interval = */ 0,
+ &(user_data_t){
+ .data = conf, .free_func = varnish_config_free,
+ });
have_instance = 1;
char flush_type_instance[DATA_MAX_NAME_LEN];
snprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
- type_instance);
+ type_instance);
if ((binfo->bi.rd_req != -1) && (binfo->bi.wr_req != -1))
submit_derive2("disk_ops", (derive_t)binfo->bi.rd_req,
#endif
snprintf(msg, sizeof(msg), "Domain state: %s. Reason: %s", state_str,
- reason_str);
+ reason_str);
int severity;
switch (state) {
char type_instance[DATA_MAX_NAME_LEN];
_Bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0;
- snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu,
- cpu);
+ snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu, cpu);
submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1);
}
}
}
snprintf(xpath_str, sizeof(xpath_str), "/domain/metadata/%s:%s/text()",
- METADATA_VM_PARTITION_PREFIX, METADATA_VM_PARTITION_ELEMENT);
+ METADATA_VM_PARTITION_PREFIX, METADATA_VM_PARTITION_ELEMENT);
xpath_obj = xmlXPathEvalExpression((xmlChar *)xpath_str, xpath_ctx);
if (xpath_obj == NULL) {
ERROR(PLUGIN_NAME " plugin: xmlXPathEval(%s) failed on domain %s",
* Florian octo Forster <octo at collectd.org>
**/
-#include "virt.c" /* sic */
#include "testing.h"
+#include "virt.c" /* sic */
#include <unistd.h>
/* FIXME: Legacy configuration syntax. */
if (cb->name == NULL)
snprintf(callback_name, sizeof(callback_name), "write_graphite/%s/%s/%s",
- cb->node, cb->service, cb->protocol);
+ cb->node, cb->service, cb->protocol);
else
snprintf(callback_name, sizeof(callback_name), "write_graphite/%s",
- cb->name);
+ cb->name);
plugin_register_write(callback_name, wg_write,
&(user_data_t){
}
snprintf(cb->credentials, credentials_size, "%s:%s", cb->user,
- (cb->pass == NULL) ? "" : cb->pass);
+ (cb->pass == NULL) ? "" : cb->pass);
curl_easy_setopt(cb->curl, CURLOPT_USERPWD, cb->credentials);
#endif
curl_easy_setopt(cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
}
command_len = (size_t)snprintf(command, sizeof(command),
- "PUTVAL %s interval=%.3f %s\r\n", key,
- CDTIME_T_TO_DOUBLE(vl->interval), values);
+ "PUTVAL %s interval=%.3f %s\r\n", key,
+ CDTIME_T_TO_DOUBLE(vl->interval), values);
if (command_len >= sizeof(command)) {
ERROR("write_http plugin: Command buffer too small: "
"Need %zu bytes.",
rd_kafka_topic_conf_set_opaque(tctx->conf, tctx);
snprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
- tctx->topic_name);
+ tctx->topic_name);
status = plugin_register_write(
callback_name, kafka_write,
for (size_t i = 0; i < m->n_label; i++) {
char value[LABEL_VALUE_SIZE];
snprintf(labels[i], LABEL_BUFFER_SIZE, "%s=\"%s\"", m->label[i]->name,
- escape_label_value(value, sizeof(value), m->label[i]->value));
+ escape_label_value(value, sizeof(value), m->label[i]->value));
}
strjoin(buffer, buffer_size, labels, m->n_label, ",");
buffer->append(buffer, strlen(line), (uint8_t *)line);
snprintf(line, sizeof(line), "# TYPE %s %s\n", fam->name,
- (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
- ? "gauge"
- : "counter");
+ (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
+ ? "gauge"
+ : "counter");
buffer->append(buffer, strlen(line), (uint8_t *)line);
for (size_t i = 0; i < fam->n_metric; i++) {
char timestamp_ms[24] = "";
if (m->has_timestamp_ms)
snprintf(timestamp_ms, sizeof(timestamp_ms), " %" PRIi64,
- m->timestamp_ms);
+ m->timestamp_ms);
if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
snprintf(line, sizeof(line), "%s{%s} " GAUGE_FORMAT "%s\n", fam->name,
- format_labels(labels, sizeof(labels), m), m->gauge->value,
- timestamp_ms);
+ format_labels(labels, sizeof(labels), m), m->gauge->value,
+ timestamp_ms);
else /* if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__COUNTER) */
snprintf(line, sizeof(line), "%s{%s} %.0f%s\n", fam->name,
- format_labels(labels, sizeof(labels), m), m->counter->value,
- timestamp_ms);
+ format_labels(labels, sizeof(labels), m), m->counter->value,
+ timestamp_ms);
buffer->append(buffer, strlen(line), (uint8_t *)line);
}
char server[1024];
snprintf(server, sizeof(server), "\n# collectd/write_prometheus %s at %s\n",
- PACKAGE_VERSION, hostname_g);
+ PACKAGE_VERSION, hostname_g);
buffer->append(buffer, strlen(server), (uint8_t *)server);
pthread_mutex_unlock(&metrics_lock);
if (m == NULL)
return -1;
- return metric_update(m, vl->values[ds_index], ds->ds[ds_index].type,
- vl->time, vl->interval);
+ return metric_update(m, vl->values[ds_index], ds->ds[ds_index].type, vl->time,
+ vl->interval);
}
/* metric_family_destroy frees the memory used by a metric family. */
if (status != 0)
return status;
snprintf(key, sizeof(key), "%s%s",
- (node->prefix != NULL) ? node->prefix : REDIS_DEFAULT_PREFIX,
- ident);
+ (node->prefix != NULL) ? node->prefix : REDIS_DEFAULT_PREFIX, ident);
snprintf(time, sizeof(time), "%.9f", CDTIME_T_TO_DOUBLE(vl->time));
value_size = sizeof(value);
snprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
- status = plugin_register_write(
- cb_name, wr_write, &(user_data_t){
- .data = node, .free_func = wr_config_free,
- });
+ status =
+ plugin_register_write(cb_name, wr_write,
+ &(user_data_t){
+ .data = node, .free_func = wr_config_free,
+ });
}
if (status != 0)
vl->type_instance);
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[1], ds->ds[index].name);
+ snprintf(service_buffer, sizeof(service_buffer), "%s/%s", &name_buffer[1],
+ ds->ds[index].name);
else
snprintf(service_buffer, sizeof(service_buffer), "%s%s/%s",
- host->event_service_prefix, &name_buffer[1],
- ds->ds[index].name);
+ 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
snprintf(service_buffer, sizeof(service_buffer), "%s%s",
- host->event_service_prefix, &name_buffer[1]);
+ host->event_service_prefix, &name_buffer[1]);
}
riemann_event_set(
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));
riemann_event_string_attribute_add(event, "ds_type", ds_type);
} else {
riemann_event_string_attribute_add(event, "ds_type",
}
snprintf(callback_name, sizeof(callback_name), "write_riemann/%s",
- host->name);
+ host->name);
user_data_t ud = {.data = host, .free_func = wrr_free};
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);
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
#define BUFFER_ADD(...) \
do { \
- status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
+ status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
if (status < 1) { \
sfree(rates); \
return -1; \
if (vl->plugin_instance[0] == '\0') {
if (vl->type_instance[0] == '\0') {
snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin, vl->type,
- ds_name);
+ ds_name);
} else {
snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin, vl->type,
- vl->type_instance, ds_name);
+ vl->type_instance, ds_name);
}
} else { /* vl->plugin_instance != "" */
if (vl->type_instance[0] == '\0') {
snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin,
- vl->plugin_instance, vl->type, ds_name);
+ vl->plugin_instance, vl->type, ds_name);
} else {
snprintf(ret, ret_len, "%s%s.%s.%s.%s.%s", prefix, vl->plugin,
- vl->plugin_instance, vl->type, vl->type_instance, ds_name);
+ vl->plugin_instance, vl->type, vl->type_instance, ds_name);
}
}
} else { /* ds_name == NULL */
snprintf(ret, ret_len, "%s%s.%s", prefix, vl->plugin, vl->type);
} else {
snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin,
- vl->type_instance, vl->type);
+ vl->type_instance, vl->type);
}
} else { /* vl->plugin_instance != "" */
if (vl->type_instance[0] == '\0') {
snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin,
- vl->plugin_instance, vl->type);
+ vl->plugin_instance, vl->type);
} else {
snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin,
- vl->plugin_instance, vl->type, vl->type_instance);
+ vl->plugin_instance, vl->type, vl->type_instance);
}
}
}
status =
snprintf(message, sizeof(message), "put %s %.0f %s fqdn=%s %s %s\r\n",
- key, CDTIME_T_TO_DOUBLE(time), value, host, tags, host_tags);
+ key, CDTIME_T_TO_DOUBLE(time), value, host, tags, host_tags);
sfree(temp);
if (status < 0)
return -1;
}
snprintf(callback_name, sizeof(callback_name), "write_tsdb/%s/%s",
- cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
- cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
+ cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
+ cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
user_data_t user_data = {.data = cb, .free_func = wt_callback_free};
// See kstat_seq_show_headers module/spl/spl-kstat.c of the spl kernel
// module.
if (fgets(buffer, sizeof(buffer), fh) == NULL) {
- ERROR("zfs_arc plugin: \"%s\" does not contain a single line.", ZOL_ARCSTATS_FILE);
+ ERROR("zfs_arc plugin: \"%s\" does not contain a single line.",
+ ZOL_ARCSTATS_FILE);
fclose(fh);
return -1;
}
if (fgets(buffer, sizeof(buffer), fh) == NULL) {
- ERROR("zfs_arc plugin: \"%s\" does not contain at least two lines.", ZOL_ARCSTATS_FILE);
+ ERROR("zfs_arc plugin: \"%s\" does not contain at least two lines.",
+ ZOL_ARCSTATS_FILE);
fclose(fh);
return -1;
}