summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f81a5a8)
raw | patch | inline | side by side (parent: f81a5a8)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sun, 16 Jul 2017 20:24:54 +0000 (22:24 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sun, 16 Jul 2017 20:24:54 +0000 (22:24 +0200) |
Changing ssnprintf to snprintf changed the indentation.
97 files changed:
diff --git a/src/aggregation.c b/src/aggregation.c
index 493f17e3ae641c881d0e112788f95c4b3c193403..5fea279c16217d818d09afa4a967419ea10b3d05 100644 (file)
--- a/src/aggregation.c
+++ b/src/aggregation.c
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 */
diff --git a/src/amqp.c b/src/amqp.c
index 73bc1a2961e22d43dcf4b60299ba86b254588517..467b7ff46041f76d618c0308eee50ce77cf6353e 100644 (file)
--- a/src/amqp.c
+++ b/src/amqp.c
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). */
diff --git a/src/apache.c b/src/apache.c
index a3630800a62d2efaf4aa882eab8100d49fe342e1..2da59e7b5297817691c6b4c86a1d70f21785c50f 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
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 "
diff --git a/src/ascent.c b/src/ascent.c
index 678a4a152fcc97bde1620681dc12a27cc1f00654..174a2118e7c2ba4aaa823b10c6f216cc4cc0ac6b 100644 (file)
--- a/src/ascent.c
+++ b/src/ascent.c
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.");
diff --git a/src/battery.c b/src/battery.c
index ba08aa695b4b55cebdb5499e3208bff141096065..b6dea0f3f14920e9b4b186d371f98002e11c6a27 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
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)
diff --git a/src/bind.c b/src/bind.c
index dc7916a874e1c990d47cb8cb87c716e13235da7e..49fb4d7fe0d7fba1cd442cda411b585ca9dbbc0c 100644 (file)
--- a/src/bind.c
+++ b/src/bind.c
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,
diff --git a/src/cgroups.c b/src/cgroups.c
index 073bf4f3ec061c94d1bf3850191769dc1b919c4b..18e489d044262862233100f68fc8fe20a46e657c 100644 (file)
--- a/src/cgroups.c
+++ b/src/cgroups.c
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];
diff --git a/src/cpufreq.c b/src/cpufreq.c
index f7865b3aa6b80786154e23af5ce1025c473dc22c..0139947e57527d76bba5353fd132c86a6c5d9f65 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
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) {
diff --git a/src/csv.c b/src/csv.c
index 7d56c89236fb9e92a1f641dca7cbe2c06a83c2eb..debe095327ecf57458ddf9aee59bc48e2f8094ff 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
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))) {
diff --git a/src/curl.c b/src/curl.c
index f9a94428724503ed9c6ae3760844b49c8ffdecbf..ddd98250513c19e5d01c1c1535145c7d974ddb35 100644 (file)
--- a/src/curl.c
+++ b/src/curl.c
}
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
diff --git a/src/curl_json.c b/src/curl_json.c
index bf37cf9a49a717ae66d09cea1c31a334896d0060..4803948d66ef48bbf3e4a518e8fd5edea580ed64 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
}
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));
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 8973a5ba7ea9ca0b7230e709d570b2df28c3ab3f..8eb99811e34044b2d65f0c6f947b6ea38e5801e9 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
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
diff --git a/src/daemon/common.c b/src/daemon/common.c
index 31daa37958f46ae22d70f44f68a73ea4fdc1b4d0..3ae61d8592e5df6b3f42986f0e1131ef5682ace3 100644 (file)
--- a/src/daemon/common.c
+++ b/src/daemon/common.c
#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 */
index 7d8c7e779349ee8f92ceb0d40ecef571799b4aa8..0d295c1cbaf476d36682bef152457b19641ee599 100644 (file)
--- a/src/daemon/configfile.c
+++ b/src/daemon/configfile.c
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;
index 77db7969cfe0142d930d57c9a64e71a377c46ef8..1352f5b39735812c16a16733c96722f312c1ba39 100644 (file)
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++) {
diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c
index 6ae8ffb81fda247309ac31b3863da9f36de6c0d2..0451e8a757665db7b501fcc98bdd2db18b22c88a 100644 (file)
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
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
diff --git a/src/dbi.c b/src/dbi.c
index dd17fac4576e3863d9431d4a1d19f4547244c78c..a577aefc766e4ad9326a0ee2cc2b1c844ebe7511 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
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 */
diff --git a/src/disk.c b/src/disk.c
index fbea0645ea02384afe57fcda97cb8fcb68f2cdd1..51a50fd1e7c782d6d00ab12be68fbcc42bbfbe85 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
/* 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);
diff --git a/src/dpdkevents.c b/src/dpdkevents.c
index 3941f1b693df704eae899600dd867e01728b351b..381ddc00bf8407069e38fdb3c57a7b95dd3b09bf 100644 (file)
--- a/src/dpdkevents.c
+++ b/src/dpdkevents.c
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 {
diff --git a/src/exec.c b/src/exec.c
index 87e36e65f4444871c6ec8e8218d65796294f1f1c..22da3160be6c6bb7054c80f9533e8089d421910f 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
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);
diff --git a/src/gmond.c b/src/gmond.c
index 75643c44e6f9abceb137ced0305aa8a0ae7ce69e..50bd8323b24f47522ef08ed711040ef73aa55494 100644 (file)
--- a/src/gmond.c
+++ b/src/gmond.c
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);
diff --git a/src/hugepages.c b/src/hugepages.c
index 8af7f50ede5f5d2964413509837a902f548089a9..c5b0ecb996328032fe1384469238412240a28bb5 100644 (file)
--- a/src/hugepages.c
+++ b/src/hugepages.c
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 */
diff --git a/src/interface.c b/src/interface.c
index 2ff7db2a1690dd3ffa1da8ac41a99cd474430c8e..deba1860ec1f1dd7312932ff786168995830a992 100644 (file)
--- a/src/interface.c
+++ b/src/interface.c
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));
diff --git a/src/ipmi.c b/src/ipmi.c
index ff79049b0693183484a8e968d6d44bcf4ee9a955..c8c80429d0813aa3ef7b2726a8d6d11373ca0d11 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
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);
}
diff --git a/src/iptables.c b/src/iptables.c
index 8969cf74a60d88ed09774f2e9e6057586c39b02b..286c6e9b6ca4318fa6a1b059e3f1337643434e19 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
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));
}
diff --git a/src/ipvs.c b/src/ipvs.c
index f747cb0765a398117494de26886e54b8fb64f6d7..3d399bd522ea86b26bee6ec22f3040608b7a79ae 100644 (file)
--- a/src/ipvs.c
+++ b/src/ipvs.c
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);
diff --git a/src/java.c b/src/java.c
index e3d3442a5961e29dcad82075d74fae043b1b6edf..c7b0be3dcba40d3e742282035577483e4f584c04 100644 (file)
--- a/src/java.c
+++ b/src/java.c
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;
diff --git a/src/logfile.c b/src/logfile.c
index d7d011c1f5cfde4ed94db5a3780815255b79692f..de9b1f75b19512632ef7a9649470fca5ac637620 100644 (file)
--- a/src/logfile.c
+++ b/src/logfile.c
#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; \
diff --git a/src/lua.c b/src/lua.c
index ffed47031af681fcc4b023b495bdd95d7040c62d..8cfb70459991317048e6cdeb0b6be27146c95cdf 100644 (file)
--- a/src/lua.c
+++ b/src/lua.c
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");
diff --git a/src/lvm.c b/src/lvm.c
index 11232651eff4b33976b7a18ead8dc0dbfa8fd65b..63107279be19da94f6754caf7423f2140da29114 100644 (file)
--- a/src/lvm.c
+++ b/src/lvm.c
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);
}
diff --git a/src/madwifi.c b/src/madwifi.c
index aa1f0955da9df08231abd6141c75e60500468011..1a387b7884c657340107e1a3b7f57555eff18951 100644 (file)
--- a/src/madwifi.c
+++ b/src/madwifi.c
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,
diff --git a/src/mcelog.c b/src/mcelog.c
index 14054bdf14a40e0293168996cc3593f6198b451b..b8731c73391ca6796080823cebee64951e984ff1 100644 (file)
--- a/src/mcelog.c
+++ b/src/mcelog.c
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);
diff --git a/src/memcached.c b/src/memcached.c
index eef453e1b90189e7c3a08ef78c7db4e7d31d2dcc..e4ccbce60f4aaddc19fe5c7e3d8c2e379f97a0cd 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
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 */
diff --git a/src/mic.c b/src/mic.c
index 166e598b650050f1579f55bc6361974cf821688e..a7ee433c2279f7e0e4f143bf66287b14f5bafe8f 100644 (file)
--- a/src/mic.c
+++ b/src/mic.c
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));
diff --git a/src/mqtt.c b/src/mqtt.c
index 94686b032d511f3729eb940fcd932b5d65e22a7f..851866b082051d38b9f292de35eae691ed6d7a75 100644 (file)
--- a/src/mqtt.c
+++ b/src/mqtt.c
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 */
diff --git a/src/mysql.c b/src/mysql.c
index cfc9b59f7a7f53825a883abac0ab5e5be8cd6927..7fe6d76470724861304a0a601d24c1993d19da2b 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
(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;
}
diff --git a/src/netapp.c b/src/netapp.c
index 0b80f76de6da377e08f91194ea4429414c92cb3b..44fb976841c3c96d383729f87ce8c0941aec53b7 100644 (file)
--- a/src/netapp.c
+++ b/src/netapp.c
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, /* {{{ */
@@ -674,9 +676,11 @@ 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);
diff --git a/src/netlink.c b/src/netlink.c
index 9d84956d66f8274cb82e656216cb6fc23155056d..0bac3e7582dddb8b1a084e8a42fb1aa073454225 100644 (file)
--- a/src/netlink.c
+++ b/src/netlink.c
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);
diff --git a/src/network.c b/src/network.c
index 00c6c756623332e761ac53a4cbcf6e502d072fbf..375da84738dbbdec8d39fe177212e3086d4aeada 100644 (file)
--- a/src/network.c
+++ b/src/network.c
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;
diff --git a/src/nfs.c b/src/nfs.c
index 6537fd14e44c9565510985626479d87b200999b2..bbe843845ace33b4fd546407eed64306dcf974bd 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
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++) {
diff --git a/src/nginx.c b/src/nginx.c
index f212461be94799b48c20f9014ba960215d1e6953..32e250a9bbfcbe69f9537a8d3224e7b9bff9d86f 100644 (file)
--- a/src/nginx.c
+++ b/src/nginx.c
#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;
diff --git a/src/notify_desktop.c b/src/notify_desktop.c
index 255230b13ec355f23b9f04da504cb1a1fc46ff12..e391cf275c04410ac76b67bbf6c896977f0fc74f 100644 (file)
--- a/src/notify_desktop.c
+++ b/src/notify_desktop.c
}
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)
diff --git a/src/notify_email.c b/src/notify_email.c
index 70408f6580f79b669a2e4439196388b7effe8b30..52cc83843f8f7ec163badaf08925a7d46ed55414 100644 (file)
--- a/src/notify_email.c
+++ b/src/notify_email.c
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);
diff --git a/src/notify_nagios.c b/src/notify_nagios.c
index bea0faad3079093fbef68c77884014b5e6b5b375..f744d486156bfba6255fae5a10ee4d1c89750639 100644 (file)
--- a/src/notify_nagios.c
+++ b/src/notify_nagios.c
}
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 */
diff --git a/src/ntpd.c b/src/ntpd.c
index fb41a7d903eee9f147da3e22a4108a21c8700168..a19d05c106a13fc858abf09dc485ed13acd4effa 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
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);
diff --git a/src/olsrd.c b/src/olsrd.c
index 0e290ad89323a3ef32b6bb1b4485c0db7bae6780..1ac1d42610d92ae3f145d2fca94ce0e0305a6da5 100644 (file)
--- a/src/olsrd.c
+++ b/src/olsrd.c
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);
diff --git a/src/openldap.c b/src/openldap.c
index 7b9b711c2d80b1d7228aa982f2bf15c25c0c7c08..b3fcb10fcbef13c1512fa83a577d84152ff911a5 100644 (file)
--- a/src/openldap.c
+++ b/src/openldap.c
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,
+ });
}
}
diff --git a/src/oracle.c b/src/oracle.c
index 2199df264033e75241842e1396a0002c172b15b0..44bd5648d1c4e54eff7eeb48a2add5d07d706129 100644 (file)
--- a/src/oracle.c
+++ b/src/oracle.c
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;
diff --git a/src/ovs_events.c b/src/ovs_events.c
index 2499cb4643affe1428a698113a116f0c1bdfb20a..afa11997cfc3a1ec8fadd50a29db39c1d0ecd7b3 100644 (file)
--- a/src/ovs_events.c
+++ b/src/ovs_events.c
*
* 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};
@@ -335,8 +340,8 @@ static void ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifin
/* 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));
@@ -345,7 +350,8 @@ static void ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifin
}
/* 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;
diff --git a/src/ovs_stats.c b/src/ovs_stats.c
index 31af77c841d9543d8b7f34fa4e86a2baf0f17802..20b0dd1f0174fbd31104f837c82572f339bc4843 100644 (file)
--- a/src/ovs_stats.c
+++ b/src/ovs_stats.c
*
* 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;
diff --git a/src/perl.c b/src/perl.c
index abef87c2f6b927604e614e482eb510b9d5e73e77..7c8a6158f71db7a9aff44f7c117998cb5454aea9 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
* 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
diff --git a/src/postgresql.c b/src/postgresql.c
index a0a1a2717558356657998324fa4f12408c740af0..56730b47958eecf37183b466224e25d35f9498f3 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
* 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; \
@@ -425,8 +425,8 @@ static PGresult *c_psql_exec_query_params(c_psql_database_t *db, udb_query_t *q,
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:
@@ -438,7 +438,7 @@ static PGresult *c_psql_exec_query_params(c_psql_database_t *db, udb_query_t *q,
}
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;
diff --git a/src/protocols.c b/src/protocols.c
index 47f7a08a3f12d907ad81caadcab5f8b6cd4daa06..b63dee9a196def27c632556a1cb4c9021a07efcc 100644 (file)
--- a/src/protocols.c
+++ b/src/protocols.c
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;
diff --git a/src/python.c b/src/python.c
index b106e45cbb77e74df010716a455ed619cf3aa377..34cab885308ff0ef59b15b1ac2d1409b0a3581a2 100644 (file)
--- a/src/python.c
+++ b/src/python.c
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) {
diff --git a/src/routeros.c b/src/routeros.c
index 8e25919355a00da05a3cccbad943b6222c2597ae..fa08b3b08f3e73e62b0af50b1213822cb25336ed 100644 (file)
--- a/src/routeros.c
+++ b/src/routeros.c
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;
diff --git a/src/rrdcached.c b/src/rrdcached.c
index 061177351df6724660c72daea5dfe43fa2ca81ac..82870135fe0aabace9a772e357be2e4d0597d0ba 100644 (file)
--- a/src/rrdcached.c
+++ b/src/rrdcached.c
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)))
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 885bcebb9ba87d27510e234e8ed4db9741b084c9..41289058c4e9f4ebe3fe7e6541dd2cf2dc5ebbbe 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
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;
diff --git a/src/sensors.c b/src/sensors.c
index 27739330cb09f11887911254f7215e8fa2769268..f4ecda5e49e0f12114ea32ccc2260a31789b4ad4 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
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;
diff --git a/src/sigrok.c b/src/sigrok.c
index 6d4cb976ceaa6e220be1371ac1ce85e6ddcaff73..8a325fe9f07006d4e68526696bde2ed954ffedc2 100644 (file)
--- a/src/sigrok.c
+++ b/src/sigrok.c
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)
diff --git a/src/smart.c b/src/smart.c
index f5850f5f4d12269156e038e2b7860b5a89594239..30680be6ed4b5d0565ea27a4a46c453e3f3c1051 100644 (file)
--- a/src/smart.c
+++ b/src/smart.c
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);
}
}
diff --git a/src/snmp.c b/src/snmp.c
index ae2b0d46db1166bab01dae22d04d6ed92bd303fa..c299db9634406b45e8697572722c852d571bcaa4 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
}
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;
diff --git a/src/snmp_agent.c b/src/snmp_agent.c
index 8441601b098a8c496d2abd7882c459fce6ee0001..83cb8e33321e1dec6360d5e47172c8c3fb97a1ad 100644 (file)
--- a/src/snmp_agent.c
+++ b/src/snmp_agent.c
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;
diff --git a/src/statsd.c b/src/statsd.c
index 3310bc45f22fe366bf8dece8fc937993b8a0ef7c..5142613739e9c77f2542d64b352752af9ad7eb3c 100644 (file)
--- a/src/statsd.c
+++ b/src/statsd.c
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]))
diff --git a/src/swap.c b/src/swap.c
index 746ba51a110c594275393f04e72d6f7198673c80..a5531c24e86247532ca68323cc1200818e9eebc2 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
return 0;
} /* }}} int swap_read */
- /* #endif KERNEL_LINUX */
+/* #endif KERNEL_LINUX */
/*
* Under Solaris, two mechanisms can be used to read swap statistics, swapctl
diff --git a/src/syslog.c b/src/syslog.c
index 55de164bc42a7e9d890d12cedb09c2da92477c17..90a97fb52fff8a27598332f60ac3a2525e945086 100644 (file)
--- a/src/syslog.c
+++ b/src/syslog.c
#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)) \
index ffd76dc552e406a9b91f22e73bd0599e7e4e7798..429e256dbf32369e57c4a2cb668807c5757de794 100644 (file)
/* 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)
diff --git a/src/target_scale.c b/src/target_scale.c
index e58bf1806192c60648d69eb3453b3164690ee932..1cc5d793d956e6a656b2896d719908acc6fd139e 100644 (file)
--- a/src/target_scale.c
+++ b/src/target_scale.c
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;
diff --git a/src/target_v5upgrade.c b/src/target_v5upgrade.c
index 34083b6dbebb97fdf8bdcffd0eb4a947e17131ee..49f09f083cc81540bd701dd34eb3ead06847aaaa 100644 (file)
--- a/src/target_v5upgrade.c
+++ b/src/target_v5upgrade.c
@@ -238,23 +238,23 @@ static int v5_zfs_arc_counts(const data_set_t *ds, value_list_t *vl) /* {{{ */
/* 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 */
diff --git a/src/tcpconns.c b/src/tcpconns.c
index 732e4479c4af31d44de1e09b590db7b5a0960d10..9fdd16e9c1b30b7d336c18e0b3620c8a587340e4 100644 (file)
--- a/src/tcpconns.c
+++ b/src/tcpconns.c
#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;
diff --git a/src/teamspeak2.c b/src/teamspeak2.c
index 12c275329708035e63e4d19de0028db2cd09563a..4d68f61f0ee4f21865e2573452a7318de10cb1b5 100644 (file)
--- a/src/teamspeak2.c
+++ b/src/teamspeak2.c
} 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);
diff --git a/src/thermal.c b/src/thermal.c
index 456ae879d28527050c01018de988c4e9774a99bd..9da8fa5fbb1d92c7a9d80b9defbce04b3f10fdf0 100644 (file)
--- a/src/thermal.c
+++ b/src/thermal.c
*/
len = snprintf(filename, sizeof(filename), "%s/%s/temperature",
- dirname_procfs, name);
+ dirname_procfs, name);
if ((len < 0) || ((size_t)len >= sizeof(filename)))
return -1;
diff --git a/src/threshold.c b/src/threshold.c
index f2407d2875579bc89a95ae236c01a58d3c213118..790013344b964288cb8826eb1118b6237d51b147 100644 (file)
--- a/src/threshold.c
+++ b/src/threshold.c
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);
diff --git a/src/turbostat.c b/src/turbostat.c
index 73a6769be44a80a75786fa8b99fdddefe0e4e39e..1049fb2ad3ce0803254e0cb35c8381a40234e86a 100644 (file)
--- a/src/turbostat.c
+++ b/src/turbostat.c
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);
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index aadc214e2ac845277c7e633b54df0f8d1f1000c8..6f1bc39ed489dcb9f60d9467ba60b370dd6ac9c0 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
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 */
diff --git a/src/utils_cmds.c b/src/utils_cmds.c
index 97702251e18458e1cc5cfd5944bef5b769d8d060..055c987c03c6741444570db0e74681fca98585b5 100644 (file)
--- a/src/utils_cmds.c
+++ b/src/utils_cmds.c
* 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>
diff --git a/src/utils_dpdk.c b/src/utils_dpdk.c
index 4911c80920d461931f5a937387afe961cace0d4d..4b246c9ecb870b19c2d9d3d588346556776c1ffe 100644 (file)
--- a/src/utils_dpdk.c
+++ b/src/utils_dpdk.c
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);
index a247f28b048f0e8f06cfdeef5e6d66c5f955acf6..87cead14cb5cc01f63df430715d9a35749f0938c 100644 (file)
#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.",
index d685390d3f953f841eb28d81be89a523d011412b..53a38b89118a04ceea0f4d9d2a430d9feb87e6af 100644 (file)
--- a/src/utils_format_json.c
+++ b/src/utils_format_json.c
#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");
index b344d183b3ac349192bfe80bb6c03e34575eae6f..0128c575e37c167093c66ac28b9b715b17822908 100644 (file)
#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 : */
index d0832cbcfd93e0f8e19a495bb35f17d68ffa6a37..0f8c2a269e088b6c97800b87019f1876028b8a32 100644 (file)
* 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,
diff --git a/src/utils_lua.c b/src/utils_lua.c
index 4e570ff3c7c703d510361cc84b1c7283b7e7b250..0990472bd6740c4b21fe7d4bbbef60eda2b2d600 100644 (file)
--- a/src/utils_lua.c
+++ b/src/utils_lua.c
* 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) {
diff --git a/src/utils_mount.c b/src/utils_mount.c
index e5ddcaf890e97d70a99814005acff2e3a95f262e..3d57ca64e732252365d3ca142ad655519d3d7e30 100644 (file)
--- a/src/utils_mount.c
+++ b/src/utils_mount.c
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!"
diff --git a/src/utils_ovs.c b/src/utils_ovs.c
index 67b9f8f0d54a9cc5aa574c5e2c38bf159182f75a..2087324721f484d4ed74ca8c98ec56dc9f11de41 100644 (file)
--- a/src/utils_ovs.c
+++ b/src/utils_ovs.c
*
* 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
@@ -314,8 +317,7 @@ static int ovs_db_data_send(const ovs_db_t *pdb, const char *data, size_t len) {
*/
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)
diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c
index 1448cc5119eda7aacb28b170fbd45b64407ad9a7..6cb544637aa5c3e7a3d1d7075e4a038a9123907b 100644 (file)
--- a/src/utils_rrdcreate.c
+++ b/src/utils_rrdcreate.c
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;
diff --git a/src/utils_tail_match.c b/src/utils_tail_match.c
index a3f0ec11caeb57c32ea1d7e5084d8dd24283738f..af8bbe7c2dcad17b152cd460ff06083fafee73e2 100644 (file)
--- a/src/utils_tail_match.c
+++ b/src/utils_tail_match.c
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 =
diff --git a/src/varnish.c b/src/varnish.c
index 90dd4e943ad30dd46c04959d9eef023eaf46b572..7c5a9ef07fa980adc102d57356da3b9b4b50259c 100644 (file)
--- a/src/varnish.c
+++ b/src/varnish.c
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;
diff --git a/src/virt.c b/src/virt.c
index b3e34f4ec4b9d66d30124162ae0177182678c708..ca6e831ed5ee4ff2bbd1e9fab8c13d7a7d2308e6 100644 (file)
--- a/src/virt.c
+++ b/src/virt.c
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);
}
}
@@ -1722,7 +1721,7 @@ static int lv_domain_get_tag(xmlXPathContextPtr xpath_ctx, const char *dom_name,
}
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",
diff --git a/src/virt_test.c b/src/virt_test.c
index cb3cc254291fa0c3ef3f69b730f623cac2efaec2..489a367d75aea0859e3e1ec64b2ea7718cbf4f64 100644 (file)
--- a/src/virt_test.c
+++ b/src/virt_test.c
* Florian octo Forster <octo at collectd.org>
**/
-#include "virt.c" /* sic */
#include "testing.h"
+#include "virt.c" /* sic */
#include <unistd.h>
diff --git a/src/write_graphite.c b/src/write_graphite.c
index 8fbb715cae8d54c51bf7c27195d815c965edb085..a8d132060ab731843f842844f0d8ecaf5a871853 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
/* 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){
diff --git a/src/write_http.c b/src/write_http.c
index 1c270bdf886c72fbe091885edb761df07ab29a16..2dd13c5b1feac51b23b03272781fea312e518b79 100644 (file)
--- a/src/write_http.c
+++ b/src/write_http.c
}
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.",
diff --git a/src/write_kafka.c b/src/write_kafka.c
index b1c8bf94a2a716184797434e6c157ecf6fb6a2d3..3c573801c22823d992835585530d4b8afca3cb1e 100644 (file)
--- a/src/write_kafka.c
+++ b/src/write_kafka.c
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,
diff --git a/src/write_prometheus.c b/src/write_prometheus.c
index 325a6c68d76d492ec210483af3e7d650e53d7844..eac0d68efb672607f684bede0ace98630a27bf07 100644 (file)
--- a/src/write_prometheus.c
+++ b/src/write_prometheus.c
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. */
diff --git a/src/write_redis.c b/src/write_redis.c
index 7be236ad089f3189a8ec07250fb1c1d2c9fc18a0..5a029de2761a4c75c618ea8f11cd448831c1e1ff 100644 (file)
--- a/src/write_redis.c
+++ b/src/write_redis.c
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)
diff --git a/src/write_riemann.c b/src/write_riemann.c
index 488b482171bb5150fa60a299feee4019e45d7d3e..6db3ef58ac88349adfd274cb1d1015e7cf9f4089 100644 (file)
--- a/src/write_riemann.c
+++ b/src/write_riemann.c
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};
diff --git a/src/write_sensu.c b/src/write_sensu.c
index 51f962202df42e3e8db0aeebdacee064911124bb..ce23e654204a22f3fa4cc5e3f8aee4385976ae44 100644 (file)
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
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
diff --git a/src/write_tsdb.c b/src/write_tsdb.c
index 0e469925b323163eaf60ee598af1ceda745e0142..10f636c5aad5afa936eb862d3c2c0feb7322ebaa 100644 (file)
--- a/src/write_tsdb.c
+++ b/src/write_tsdb.c
#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};
diff --git a/src/zfs_arc.c b/src/zfs_arc.c
index 86af7d498b22e2603d7380e91e3b5fcd878fdb11..730d30483b5eff16961e7167b58fa3a3e62f7864 100644 (file)
--- a/src/zfs_arc.c
+++ b/src/zfs_arc.c
// 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;
}