sstrncpy(inst->ident.plugin_instance, AGG_FUNC_PLACEHOLDER,
sizeof(inst->ident.plugin_instance));
else if (strcmp("", tmp_plugin) != 0)
- ssnprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
- "%s-%s", tmp_plugin, AGG_FUNC_PLACEHOLDER);
+ ssnprintf(inst->ident.plugin_instance,
+ sizeof(inst->ident.plugin_instance), "%s-%s", tmp_plugin,
+ AGG_FUNC_PLACEHOLDER);
else if (strcmp("", tmp_plugin_instance) != 0)
- ssnprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
- "%s-%s", tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
+ ssnprintf(inst->ident.plugin_instance,
+ sizeof(inst->ident.plugin_instance), "%s-%s",
+ tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
else
- ssnprintf(inst->ident.plugin_instance, sizeof(inst->ident.plugin_instance),
- "%s-%s-%s", tmp_plugin, tmp_plugin_instance,
- AGG_FUNC_PLACEHOLDER);
+ ssnprintf(inst->ident.plugin_instance,
+ sizeof(inst->ident.plugin_instance), "%s-%s-%s", tmp_plugin,
+ tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
}
/* Type */
READ_FUNC(average, (inst->sum / ((gauge_t)inst->num)));
READ_FUNC(min, inst->min);
READ_FUNC(max, inst->max);
- READ_FUNC(stddev,
- sqrt((((gauge_t)inst->num) * inst->squares_sum) -
- (inst->sum * inst->sum)) /
- ((gauge_t)inst->num));
+ READ_FUNC(stddev, sqrt((((gauge_t)inst->num) * inst->squares_sum) -
+ (inst->sum * inst->sum)) /
+ ((gauge_t)inst->num));
}
/* Reset internal state. */
amqp_connection_close_t *m = r.reply.decoded;
char *tmp = camqp_bytes_cstring(&m->reply_text);
ssnprintf(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);
ssnprintf(buffer, buffer_size, "Server channel error %d: %s",
- m->reply_code, tmp);
+ m->reply_code, tmp);
sfree(tmp);
} else {
ssnprintf(buffer, buffer_size, "Server error method %#" PRIx32,
- r.reply.id);
+ r.reply.id);
}
break;
qd_ret = amqp_queue_declare(conf->connection,
/* channel = */ CAMQP_CHANNEL,
- /* queue = */ (conf->queue != NULL)
+ /* queue = */
+ (conf->queue != NULL)
? amqp_cstring_bytes(conf->queue)
: AMQP_EMPTY_BYTES,
/* passive = */ 0,
amqp_queue_bind_ok_t *qb_ret;
assert(conf->queue != NULL);
- qb_ret =
- amqp_queue_bind(conf->connection,
- /* channel = */ CAMQP_CHANNEL,
- /* queue = */ amqp_cstring_bytes(conf->queue),
- /* exchange = */ amqp_cstring_bytes(conf->exchange),
- /* routing_key = */ (conf->routing_key != NULL)
- ? amqp_cstring_bytes(conf->routing_key)
- : AMQP_EMPTY_BYTES,
- /* arguments = */ AMQP_EMPTY_TABLE);
+ qb_ret = amqp_queue_bind(
+ conf->connection,
+ /* channel = */ CAMQP_CHANNEL,
+ /* queue = */ amqp_cstring_bytes(conf->queue),
+ /* exchange = */ amqp_cstring_bytes(conf->exchange),
+ /* routing_key = */
+ (conf->routing_key != NULL) ? amqp_cstring_bytes(conf->routing_key)
+ : AMQP_EMPTY_BYTES,
+ /* arguments = */ AMQP_EMPTY_TABLE);
if ((qb_ret == NULL) && camqp_is_error(conf)) {
char errbuf[1024];
ERROR("amqp plugin: amqp_queue_bind failed: %s",
#ifdef HAVE_AMQP_TCP_SOCKET
#define CLOSE_SOCKET() /* amqp_destroy_connection() closes the socket for us \
- */
+ */
/* TODO: add support for SSL using amqp_ssl_socket_new
* and related functions */
socket = amqp_tcp_socket_new(conf->connection);
sstrncpy(routing_key, conf->routing_key, sizeof(routing_key));
} else {
ssnprintf(routing_key, sizeof(routing_key), "collectd/%s/%s/%s/%s/%s",
- vl->host, vl->plugin, vl->plugin_instance, vl->type,
- vl->type_instance);
+ vl->host, vl->plugin, vl->plugin_instance, vl->type,
+ vl->type_instance);
/* Switch slashes (the only character forbidden by collectd) and dots
* (the separation character used by AMQP). */
char cbname[128];
ssnprintf(cbname, sizeof(cbname), "amqp/%s", conf->name);
- status =
- plugin_register_write(cbname, camqp_write,
- &(user_data_t){
- .data = conf, .free_func = camqp_config_free,
- });
+ status = plugin_register_write(cbname, camqp_write,
+ &(user_data_t){
+ .data = conf,
+ .free_func = camqp_config_free,
+ });
if (status != 0) {
camqp_config_free(conf);
return status;
return -1;
}
status = ssnprintf(instance->send_to, sizeof(instance->send_to), "/%s/%s",
- transport->address, instance->name);
+ transport->address, instance->name);
if ((status < 0) || (size_t)status >= sizeof(instance->send_to)) {
ERROR("amqp1 plugin: send_to address would have been truncated.");
return -1;
status = plugin_register_notification(
tpname, amqp1_notify,
&(user_data_t){
- .data = instance, .free_func = amqp1_config_instance_free,
+ .data = instance,
+ .free_func = amqp1_config_instance_free,
});
} else {
- status = plugin_register_write(
- tpname, amqp1_write,
- &(user_data_t){
- .data = instance, .free_func = amqp1_config_instance_free,
- });
+ status =
+ plugin_register_write(tpname, amqp1_write,
+ &(user_data_t){
+ .data = instance,
+ .free_func = amqp1_config_instance_free,
+ });
}
if (status != 0) {
if (value_array[i] == AQ5_FLOAT_UNDEF)
continue;
- ssnprintf(type_instance, sizeof(type_instance), "%s%d", type_instance_prefix,
- i + 1);
+ ssnprintf(type_instance, sizeof(type_instance), "%s%d",
+ type_instance_prefix, i + 1);
aquaero_submit(type, type_instance, value_array[i]);
}
}
int status;
status = ssnprintf(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.");
case CSTATE_WRITE_REQUEST: {
char cmd[32];
ssnprintf(cmd, sizeof(cmd), "%s%d%s", "{ \"prefix\": \"", io->request_type,
- "\" }\n");
+ "\" }\n");
size_t cmd_len = strlen(cmd);
RETRY_ON_EINTR(
ret, write(io->asok, ((char *)&cmd) + io->amt, cmd_len - io->amt));
#include "config.h"
#endif
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
value);
BAIL_OUT(-1);
} else if ((endptr != NULL) && (*endptr != '\0')) {
- fprintf(stderr, "WARNING: Ignoring trailing garbage after timeout: "
- "%s.\n",
+ fprintf(stderr,
+ "WARNING: Ignoring trailing garbage after timeout: "
+ "%s.\n",
endptr);
}
} else if (strcasecmp(key, "plugin") == 0) {
char id[1024];
lcc_identifier_to_string(c, id, sizeof(id), identifiers + j);
- fprintf(stderr, "ERROR: Failed to flush plugin `%s', "
- "identifier `%s': %s.\n",
+ fprintf(stderr,
+ "ERROR: Failed to flush plugin `%s', "
+ "identifier `%s': %s.\n",
(plugins[i] == NULL) ? "(all)" : plugins[i], id,
lcc_strerror(c));
}
status = lcc_identifier_to_string(c, id, sizeof(id), ret_ident + i);
if (status != 0) {
- fprintf(stderr, "ERROR: listval: Failed to convert returned "
- "identifier to a string: %s\n",
+ fprintf(stderr,
+ "ERROR: listval: Failed to convert returned "
+ "identifier to a string: %s\n",
lcc_strerror(c));
continue;
}
value);
return -1;
} else if ((endptr != NULL) && (*endptr != '\0')) {
- fprintf(stderr, "WARNING: Ignoring trailing garbage after "
- "interval: %s.\n",
+ fprintf(stderr,
+ "WARNING: Ignoring trailing garbage after "
+ "interval: %s.\n",
endptr);
}
} else {
status =
ssnprintf(buffer_ptr, buffer_free, " %s", ci->values[i].value.string);
else if (ci->values[i].type == OCONFIG_TYPE_NUMBER)
- status =
- ssnprintf(buffer_ptr, buffer_free, " %lf", ci->values[i].value.number);
+ status = ssnprintf(buffer_ptr, buffer_free, " %lf",
+ ci->values[i].value.number);
else if (ci->values[i].type == OCONFIG_TYPE_BOOLEAN)
status = ssnprintf(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;
io_master_port = MACH_PORT_NULL;
return -1;
}
-/* #endif HAVE_IOKIT_IOKITLIB_H */
+ /* #endif HAVE_IOKIT_IOKITLIB_H */
#elif KERNEL_LINUX
#if HAVE_LIBUDEV_H
}
}
#endif /* HAVE_LIBUDEV_H */
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif KERNEL_FREEBSD
int rv;
ERROR("geom_stats_open() failed, returned %d", rv);
return -1;
}
-/* #endif KERNEL_FREEBSD */
+ /* #endif KERNEL_FREEBSD */
#elif HAVE_LIBKSTAT
kstat_t *ksp_chain;
derive_t read, derive_t write) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = read}, {.derive = write},
+ {.derive = read},
+ {.derive = write},
};
vl.values = values;
derive_t weighted_time) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = io_time}, {.derive = weighted_time},
+ {.derive = io_time},
+ {.derive = weighted_time},
};
vl.values = values;
sstrncpy(disk_name, props_disk_name_bsd, sizeof(disk_name));
else {
ERROR("disk plugin: can't find bsd disk name.");
- ssnprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
+ ssnprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major,
+ disk_minor);
}
} else
ssnprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
disk_submit(disk_name, "disk_time", read_tme / 1000, write_tme / 1000);
}
IOObjectRelease(disk_list);
-/* #endif HAVE_IOKIT_IOKITLIB_H */
+ /* #endif HAVE_IOKIT_IOKITLIB_H */
#elif KERNEL_FREEBSD
int retry, dirty;
free(missing_ds);
}
fclose(fh);
-/* #endif defined(KERNEL_LINUX) */
+ /* #endif defined(KERNEL_LINUX) */
#elif HAVE_LIBKSTAT
#if HAVE_KSTAT_IO_T_WRITES && HAVE_KSTAT_IO_T_NWRITES && HAVE_KSTAT_IO_T_WTIME
disk_submit(ksp[i]->ks_name, "disk_ops", kio.KIO_ROPS, kio.KIO_WOPS);
}
}
-/* #endif defined(HAVE_LIBKSTAT) */
+ /* #endif defined(HAVE_LIBKSTAT) */
#elif defined(HAVE_LIBSTATGRAB)
sg_disk_io_stats *ds;
disk_submit(name, "disk_octets", ds->read_bytes, ds->write_bytes);
ds++;
}
-/* #endif defined(HAVE_LIBSTATGRAB) */
+ /* #endif defined(HAVE_LIBSTATGRAB) */
#elif defined(HAVE_PERFSTAT)
derive_t read_sectors;
char dev_name[DATA_MAX_NAME_LEN];
if (ec->config.link_status.port_name[i][0] != 0) {
ssnprintf(dev_name, sizeof(dev_name), "%s",
- ec->config.link_status.port_name[i]);
+ ec->config.link_status.port_name[i]);
} else {
ssnprintf(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];
ssnprintf(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 {
return NULL;
ssnprintf(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);
break;
}
- default: { return -1; }
+ default: {
+ return -1;
+ }
}
return 0;
memset(cores, 0, sizeof(cores));
for (size_t j = 0; j < cgroup->num_cores; j++) {
ssnprintf(cores + strlen(cores), sizeof(cores) - strlen(cores) - 1, " %d",
- cgroup->cores[j]);
+ cgroup->cores[j]);
}
DEBUG(RDT_PLUGIN ": group[%zu]:", i);
memset(names, 0, sizeof(names));
for (size_t j = 0; j < g_rdt->ngroups[i].num_names; j++)
ssnprintf(names + strlen(names), sizeof(names) - strlen(names) - 1, " %s",
- g_rdt->ngroups[i].names[j]);
+ g_rdt->ngroups[i].names[j]);
DEBUG(RDT_PLUGIN ": group[%d]:", (int)i);
DEBUG(RDT_PLUGIN ": description: %s", g_rdt->ngroups[i].desc);
pids_list_t *list = g_rdt->ngroups[i].proc_pids[j]->curr;
for (size_t k = 0; k < list->size; k++)
ssnprintf(pids + strlen(pids), sizeof(pids) - strlen(pids) - 1, " %u",
- list->pids[k]);
+ list->pids[k]);
}
DEBUG(RDT_PLUGIN ": [%s] %s", g_rdt->ngroups[i].desc, pids);
}
}
/* update global proc_pids table */
- proc_pids_t **proc_pids = realloc(g_rdt->proc_pids,
- (g_rdt->num_proc_pids + ng->num_names) *
- sizeof(*g_rdt->proc_pids));
+ proc_pids_t **proc_pids =
+ realloc(g_rdt->proc_pids, (g_rdt->num_proc_pids + ng->num_names) *
+ sizeof(*g_rdt->proc_pids));
if (NULL == proc_pids) {
ERROR(RDT_PLUGIN ": Alloc error\n");
continue;
* (Module-)Global variables
*/
static const char *config_keys[] = {
- "Interface", "IgnoreSelected", "ReportInactive",
+ "Interface",
+ "IgnoreSelected",
+ "ReportInactive",
};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
derive_t tx) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
if (ignorelist_match(ignorelist, dev) != 0)
#define IFA_TX_PACKT ifi_opackets
#define IFA_RX_ERROR ifi_ierrors
#define IFA_TX_ERROR ifi_oerrors
-/* #endif HAVE_STRUCT_IF_DATA */
+ /* #endif HAVE_STRUCT_IF_DATA */
#elif HAVE_STRUCT_NET_DEVICE_STATS
#define IFA_DATA net_device_stats
}
freeifaddrs(if_list);
-/* #endif HAVE_GETIFADDRS */
+ /* #endif HAVE_GETIFADDRS */
#elif KERNEL_LINUX
FILE *fh;
}
fclose(fh);
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
derive_t rx;
if (unique_name)
ssnprintf(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));
if ((rx != -1LL) || (tx != -1LL))
if_submit(iname, "if_errors", rx, tx);
}
-/* #endif HAVE_LIBKSTAT */
+ /* #endif HAVE_LIBKSTAT */
#elif defined(HAVE_LIBSTATGRAB)
sg_network_io_stats *ios;
continue;
if_submit(ios[i].interface_name, "if_octets", ios[i].rx, ios[i].tx);
}
-/* #endif HAVE_LIBSTATGRAB */
+ /* #endif HAVE_LIBSTATGRAB */
#elif defined(HAVE_PERFSTAT)
perfstat_id_t id;
sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
ssnprintf(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));
ssnprintf(n.message, sizeof(n.message), "sensor %s present",
- list_item->sensor_name);
+ list_item->sensor_name);
plugin_dispatch_notification(&n);
}
temp[sizeof(temp) - 1] = '\0';
if (entity_id_string != NULL && strlen(temp))
- ssnprintf(sensor_name, sizeof(sensor_name), "%s %s", temp, entity_id_string);
+ ssnprintf(sensor_name, sizeof(sensor_name), "%s %s", temp,
+ entity_id_string);
else if (entity_id_string != NULL)
sstrncpy(sensor_name, entity_id_string, sizeof(sensor_name));
else
if (sensor_id_ptr != NULL) {
/* `sensor_id_ptr' now points to "(123)". */
ssnprintf(sensor_name, sizeof(sensor_name), "%s %s", sensor_name_ptr,
- sensor_id_ptr);
+ sensor_id_ptr);
}
/* else: don't touch sensor_name. */
}
and add the `percent` to the type instance of the reported value */
if (ipmi_sensor_get_percentage(sensor)) {
ssnprintf(list_item->type_instance, sizeof(list_item->type_instance),
- "percent-%s", sensor_name_ptr);
+ "percent-%s", sensor_name_ptr);
type = "percent";
} else {
/* use type instance as a name of the sensor */
sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
ssnprintf(n.message, sizeof(n.message), "sensor %s added",
- 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));
ssnprintf(n.message, sizeof(n.message), "sensor %s removed",
- list_item->sensor_name);
+ list_item->sensor_name);
plugin_dispatch_notification(&n);
}
sensor_get_name(sensor, n.type_instance, sizeof(n.type_instance));
if (value_present != IPMI_NO_VALUES_PRESENT)
ssnprintf(n.message, sizeof(n.message),
- "sensor %s received event: %s, value is %f", n.type_instance,
- event_state, value);
+ "sensor %s received event: %s, value is %f", n.type_instance,
+ event_state, value);
else
ssnprintf(n.message, sizeof(n.message),
- "sensor %s received event: %s, value not provided",
- n.type_instance, event_state);
+ "sensor %s received event: %s, value not provided",
+ n.type_instance, event_state);
DEBUG("Threshold event received for sensor %s", n.type_instance);
ipmi_get_reading_name(event_type, sensor_type, offset);
sensor_get_name(sensor, n.type_instance, sizeof(n.type_instance));
ssnprintf(n.message, sizeof(n.message), "sensor %s received event: %s",
- n.type_instance, event_state);
+ n.type_instance, event_state);
DEBUG("Discrete event received for sensor %s", n.type_instance);
sstrncpy(vl.plugin, "ip6tables", sizeof(vl.plugin));
status = ssnprintf(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)
ssnprintf(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 = ssnprintf(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)
ssnprintf(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));
}
lua_getfield(L, LUA_REGISTRYINDEX, "collectd:script_path");
char function_name[DATA_MAX_NAME_LEN];
ssnprintf(function_name, sizeof(function_name), "lua/%s/%s",
- lua_tostring(L, -1), subname);
+ lua_tostring(L, -1), subname);
lua_pop(L, 1);
int callback_id = clua_store_callback(L, 1);
pthread_mutex_init(&cb->lock, NULL);
if (PLUGIN_READ == type) {
- int status =
- plugin_register_complex_read(/* group = */ "lua",
- /* name = */ function_name,
- /* callback = */ clua_read,
- /* interval = */ 0,
- &(user_data_t){
- .data = cb, .free_func = lua_cb_free,
- });
+ int status = plugin_register_complex_read(/* group = */ "lua",
+ /* name = */ function_name,
+ /* callback = */ clua_read,
+ /* interval = */ 0,
+ &(user_data_t){
+ .data = cb,
+ .free_func = lua_cb_free,
+ });
if (status != 0)
return luaL_error(L, "%s", "plugin_register_complex_read failed");
int status = plugin_register_write(/* name = */ function_name,
/* callback = */ clua_write,
&(user_data_t){
- .data = cb, .free_func = lua_cb_free,
+ .data = cb,
+ .free_func = lua_cb_free,
});
if (status != 0)
return;
used_bytes = lv_size * (used_percent_unscaled * PERCENT_SCALE_FACTOR);
- ssnprintf(plugin_instance, sizeof(plugin_instance), "%s-%s", vg_name, lv_name);
+ ssnprintf(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);
}
ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
else /* per-core statistics */
ssnprintf(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));
/* callback = */ mb_read,
/* interval = */ interval,
&(user_data_t){
- .data = host, .free_func = host_free,
+ .data = host,
+ .free_func = host_free,
});
} else {
host_free(host);
plugin_register_complex_read(
/* group = */ NULL, cb_name, mysql_read, /* interval = */ 0,
&(user_data_t){
- .data = db, .free_func = mysql_database_free,
+ .data = db,
+ .free_func = mysql_database_free,
});
} else {
mysql_database_free(db);
static void traffic_submit(derive_t rx, derive_t tx, mysql_database_t *db) {
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
submit("mysql_octets", NULL, values, STATIC_ARRAY_SIZE(values), db);
(db->slave_io_running)) {
n.severity = NOTIF_WARNING;
ssnprintf(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 = false;
} else if (((io != NULL) && (strcasecmp(io, "yes") == 0)) &&
(!db->slave_io_running)) {
n.severity = NOTIF_OKAY;
ssnprintf(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 = true;
}
derive_t val0, derive_t val1, cdtime_t timestamp,
cdtime_t interval) {
value_t values[] = {
- {.derive = val0}, {.derive = val1},
+ {.derive = val0},
+ {.derive = val1},
};
return submit_values(host, plugin_inst, type, type_inst, values,
gauge_t val0, gauge_t val1, cdtime_t timestamp,
cdtime_t interval) {
value_t values[] = {
- {.gauge = val0}, {.gauge = val1},
+ {.gauge = val0},
+ {.gauge = val1},
};
return submit_values(host, plugin_inst, type, type_inst, values,
return -1;
ssnprintf(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;
ssnprintf(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;
- ssnprintf(n.message, sizeof(n.message), "Volume %s is now online.", v->name);
+ ssnprintf(n.message, sizeof(n.message), "Volume %s is now online.",
+ v->name);
v->flags &= ~IS_VOLUME_USAGE_OFFLINE;
} else {
n.severity = NOTIF_WARNING;
ssnprintf(n.message, sizeof(n.message), "Volume %s is now offline.",
- v->name);
+ v->name);
v->flags |= IS_VOLUME_USAGE_OFFLINE;
}
continue;
ssnprintf(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 */
ssnprintf(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)
ssnprintf(cb_name, sizeof(cb_name), "netapp-%s-%s", host->name,
- host->vfiler);
+ host->vfiler);
else
ssnprintf(cb_name, sizeof(cb_name), "netapp-%s", host->name);
/* callback = */ cna_read,
/* interval = */ host->interval,
&(user_data_t){
- .data = host, .free_func = (void *)free_host_config,
+ .data = host,
+ .free_func = (void *)free_host_config,
});
return 0;
const char *type_instance, derive_t rx, derive_t tx) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
vl.values = values;
numberic_id = tm->tcm_parent;
ssnprintf(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 = true;
int r = ssnprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
- tc_inst);
+ tc_inst);
if ((size_t)r >= sizeof(type_instance)) {
ERROR("netlink plugin: type_instance truncated to %zu bytes, need %d",
sizeof(type_instance), r);
char type_instance[DATA_MAX_NAME_LEN];
int r = ssnprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
- tc_inst);
+ tc_inst);
if ((size_t)r >= sizeof(type_instance)) {
ERROR("netlink plugin: type_instance truncated to %zu bytes, need %d",
sizeof(type_instance), r);
#else
static char credentials[1024];
int status = ssnprintf(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;
}
ssnprintf(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)
- );
+ );
#else
,
NULL);
char server[MAXSTRING];
ssnprintf(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 buf_len = sizeof(buf);
ssnprintf(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")));
ssnprintf(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 */
int status = ssnprintf(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",
- subject, timestamp_str, severity, n->host);
+ "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",
+ subject, timestamp_str, severity, n->host);
if (status > 0) {
buf_ptr += status;
#define APPEND(format, value) \
if ((buf_len > 0) && (strlen(value) > 0)) { \
- status = ssnprintf(buf_ptr, buf_len, format "\r\n", value); \
+ status = ssnprintf(buf_ptr, buf_len, format "\r\n", value); \
if (status > 0) { \
buf_ptr += status; \
buf_len -= status; \
char *endptr;
ssnprintf(file, sizeof(file), "%s/%s", path,
- family_info->features[i].filename);
+ family_info->features[i].filename);
file[sizeof(file) - 1] = '\0';
buffer = NULL;
ldap_get_values_len(st->ld, e, "olmBDBEntryCache")) != NULL) {
olmbdb_data = *olmbdb_list[0];
ssnprintf(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];
- ssnprintf(typeinst, sizeof(typeinst), "bdbdncache-%s", nc_data.bv_val);
+ ssnprintf(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];
ssnprintf(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);
char callback_name[3 * DATA_MAX_NAME_LEN] = {0};
ssnprintf(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");
return plugin_register_complex_read(/* group = */ NULL,
/* name = */ callback_name,
/* callback = */ cldap_read_host,
/* interval = */ 0,
&(user_data_t){
- .data = st, .free_func = cldap_free,
+ .data = st,
+ .free_func = cldap_free,
});
} /* }}} int cldap_config_add */
}
opt_buff = new_buff;
int ret = ssnprintf(opt_buff + buff_off, buff_size - buff_off, option_fmt,
- iface->name);
+ iface->name);
if (ret < 0) {
sfree(opt_buff);
return NULL;
/* fill the notification data */
ssnprintf(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));
}
strjoin(devname, sizeof(devname),
(char *[]){
- bridge->name, port->name, iface->name,
+ bridge->name,
+ port->name,
+ iface->name,
},
3, ".");
ovs_stats_submit_one(devname, "if_collisions", NULL,
* is ignored. */
#define C_PSQL_PAR_APPEND(buf, buf_len, parameter, value) \
if ((0 < (buf_len)) && (NULL != (value)) && ('\0' != *(value))) { \
- int s = ssnprintf(buf, buf_len, " %s = '%s'", parameter, value); \
+ int s = ssnprintf(buf, buf_len, " %s = '%s'", parameter, value); \
if (0 < s) { \
buf += s; \
buf_len -= s; \
break;
case C_PSQL_PARAM_INTERVAL:
ssnprintf(interval, sizeof(interval), "%.3f",
- CDTIME_T_TO_DOUBLE(plugin_get_interval()));
+ CDTIME_T_TO_DOUBLE(plugin_get_interval()));
params[i] = interval;
break;
case C_PSQL_PARAM_INSTANCE:
status = ssnprintf(str_ptr, str_len, ",'gauge'");
else
status = ssnprintf(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;
status = ssnprintf(str_ptr, str_len, ",%lf", rates[i]);
} else if (ds->ds[i].type == DS_TYPE_COUNTER)
status = ssnprintf(str_ptr, str_len, ",%" PRIu64,
- (uint64_t)vl->values[i].counter);
+ (uint64_t)vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
status = ssnprintf(str_ptr, str_len, ",%" PRIi64, vl->values[i].derive);
else if (ds->ds[i].type == DS_TYPE_ABSOLUTE)
* Global variables
*/
static const char *config_keys[] = {
- "Value", "IgnoreSelected",
+ "Value",
+ "IgnoreSelected",
};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
char match_name[2 * DATA_MAX_NAME_LEN];
ssnprintf(match_name, sizeof(match_name), "%s:%s", key_buffer,
- key_fields[i]);
+ key_fields[i]);
if (ignorelist_match(values_list, match_name))
continue;
for (size_t i = 0; i < ds->ds_num; ++i) {
tuple = PyTuple_New(4);
PyTuple_SET_ITEM(tuple, 0, cpy_string_to_unicode_or_bytes(ds->ds[i].name));
- PyTuple_SET_ITEM(tuple, 1, cpy_string_to_unicode_or_bytes(
- DS_TYPE_TO_STRING(ds->ds[i].type)));
+ PyTuple_SET_ITEM(
+ tuple, 1,
+ cpy_string_to_unicode_or_bytes(DS_TYPE_TO_STRING(ds->ds[i].type)));
PyTuple_SET_ITEM(tuple, 2, float_or_none(ds->ds[i].min));
PyTuple_SET_ITEM(tuple, 3, float_or_none(ds->ds[i].max));
PyList_SET_ITEM(list, i, tuple);
register_function(buf, handler,
&(user_data_t){
- .data = c, .free_func = cpy_destroy_user_data,
+ .data = c,
+ .free_func = cpy_destroy_user_data,
});
++cpy_num_callbacks;
/* group = */ "python", buf, cpy_read_callback,
DOUBLE_TO_CDTIME_T(interval),
&(user_data_t){
- .data = c, .free_func = cpy_destroy_user_data,
+ .data = c,
+ .free_func = cpy_destroy_user_data,
});
++cpy_num_callbacks;
return cpy_string_to_unicode_or_bytes(buf);
values = PyTuple_New(ci->values_num); /* New reference. */
for (int i = 0; i < ci->values_num; ++i) {
if (ci->values[i].type == OCONFIG_TYPE_STRING) {
- PyTuple_SET_ITEM(values, i, cpy_string_to_unicode_or_bytes(
- ci->values[i].value.string));
+ PyTuple_SET_ITEM(
+ values, i,
+ cpy_string_to_unicode_or_bytes(ci->values[i].value.string));
} else if (ci->values[i].type == OCONFIG_TYPE_NUMBER) {
PyTuple_SET_ITEM(values, i,
PyFloat_FromDouble(ci->values[i].value.number));
/* callback = */ redis_read,
/* interval = */ 0,
&(user_data_t){
- .data = rn, .free_func = redis_node_free,
+ .data = rn,
+ .free_func = redis_node_free,
});
} /* }}} */
const char *type_instance, derive_t rx, derive_t tx) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
vl.values = values;
/*** RX ***/
ssnprintf(type_instance, sizeof(type_instance), "%s-%s-rx", r->interface,
- name);
+ name);
cr_submit_gauge(rd, "bitrate", type_instance,
(gauge_t)(1000000.0 * r->rx_rate));
cr_submit_gauge(rd, "signal_power", type_instance,
/*** TX ***/
ssnprintf(type_instance, sizeof(type_instance), "%s-%s-tx", r->interface,
- name);
+ name);
cr_submit_gauge(rd, "bitrate", type_instance,
(gauge_t)(1000000.0 * r->tx_rate));
cr_submit_gauge(rd, "signal_power", type_instance,
return plugin_register_complex_read(
/* group = */ NULL, read_name, cr_read, /* interval = */ 0,
&(user_data_t){
- .data = router_data, .free_func = (void *)cr_free_data,
+ .data = router_data,
+ .free_func = (void *)cr_free_data,
});
} /* }}} int cr_config_router */
if (ds->ds[i].type == DS_TYPE_COUNTER) {
status = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
- (uint64_t)vl->values[i].counter);
+ (uint64_t)vl->values[i].counter);
} else if (ds->ds[i].type == DS_TYPE_GAUGE) {
status = ssnprintf(buffer + offset, buffer_len - offset, ":%f",
- vl->values[i].gauge);
+ vl->values[i].gauge);
} else if (ds->ds[i].type == DS_TYPE_DERIVE) {
status = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
- vl->values[i].derive);
+ vl->values[i].derive);
} else /* if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */ {
status = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
- vl->values[i].absolute);
+ vl->values[i].absolute);
}
if ((status < 1) || (status >= (buffer_len - offset)))
}
char *values_array[2] = {
- [0] = values, [1] = NULL,
+ [0] = values,
+ [1] = NULL,
};
while (42) {
if (ds->ds[i].type == DS_TYPE_COUNTER)
status = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
- (uint64_t)vl->values[i].counter);
+ (uint64_t)vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_GAUGE)
status = ssnprintf(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 = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
- vl->values[i].derive);
+ vl->values[i].derive);
else /*if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */
status = ssnprintf(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 = ssnprintf(buffer, buffer_len, "%u:%" PRIi64, (unsigned)tt,
- vl->values[0].derive);
+ vl->values[0].derive);
break;
case DS_TYPE_GAUGE:
status = ssnprintf(buffer, buffer_len, "%u:" GAUGE_FORMAT, (unsigned)tt,
- vl->values[0].gauge);
+ vl->values[0].gauge);
break;
case DS_TYPE_COUNTER:
status = ssnprintf(buffer, buffer_len, "%u:%" PRIu64, (unsigned)tt,
- (uint64_t)vl->values[0].counter);
+ (uint64_t)vl->values[0].counter);
break;
case DS_TYPE_ABSOLUTE:
status = ssnprintf(buffer, buffer_len, "%u:%" PRIu64, (unsigned)tt,
- vl->values[0].absolute);
+ vl->values[0].absolute);
break;
default:
return EINVAL;
cfdev->sdi = devlist->data;
g_slist_free(devlist);
ssnprintf(hwident, sizeof(hwident), "%s %s %s",
- cfdev->sdi->vendor ? cfdev->sdi->vendor : "",
- cfdev->sdi->model ? cfdev->sdi->model : "",
- cfdev->sdi->version ? cfdev->sdi->version : "");
+ cfdev->sdi->vendor ? cfdev->sdi->vendor : "",
+ cfdev->sdi->model ? cfdev->sdi->model : "",
+ cfdev->sdi->version ? cfdev->sdi->version : "");
INFO("sigrok plugin: Device \"%s\" is a %s", cfdev->name, hwident);
if (sr_dev_open(cfdev->sdi) != SR_OK)
sstrncpy(notif.plugin_instance, name, sizeof(notif.plugin_instance));
sstrncpy(notif.type_instance, a->name, sizeof(notif.type_instance));
ssnprintf(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);
}
}
status = plugin_register_complex_read(
/* group = */ NULL, cb_name, csnmp_read_host, interval,
&(user_data_t){
- .data = hd, .free_func = csnmp_host_definition_destroy,
+ .data = hd,
+ .free_func = csnmp_host_definition_destroy,
});
if (status != 0) {
ERROR("snmp plugin: Registering complex read function failed.");
int status;
status = ssnprintf(buffer_ptr, buffer_free, (i == 0) ? "%02x" : ":%02x",
- (unsigned int)vb->val.bitstring[i]);
+ (unsigned int)vb->val.bitstring[i]);
assert(status >= 0);
if (((size_t)status) >= buffer_free) /* truncated */
src = (char *)vb->val.bitstring;
else if (vb->type == ASN_IPADDRESS) {
return ssnprintf(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
ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s%s",
- data->type_instance.prefix, temp);
+ data->type_instance.prefix, temp);
} else if (data->type_instance.value) {
sstrncpy(vl.type_instance, data->type_instance.value,
sizeof(vl.type_instance));
sstrncpy(vl.plugin_instance, temp, sizeof(vl.plugin_instance));
else
ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s%s",
- data->plugin_instance.prefix, temp);
+ data->plugin_instance.prefix, temp);
} else if (data->plugin_instance.value) {
sstrncpy(vl.plugin_instance, data->plugin_instance.value,
sizeof(vl.plugin_instance));
.severity = NOTIF_WARNING, .time = cdtime(), .plugin = PLUGIN_NAME};
sstrncpy(n.host, hostname_g, sizeof(n.host));
ssnprintf(n.message, sizeof(n.message),
- "Removed data row from table %s with index %s", td->name, index_str);
+ "Removed data row from table %s with index %s", td->name,
+ index_str);
DEBUG(PLUGIN_NAME ": %s", n.message);
plugin_dispatch_notification(&n);
.severity = NOTIF_OKAY, .time = cdtime(), .plugin = PLUGIN_NAME};
sstrncpy(n.host, hostname_g, sizeof(n.host));
ssnprintf(n.message, sizeof(n.message),
- "Data added to table %s with index %s", td->name, index_str);
+ "Data added to table %s with index %s", td->name, index_str);
DEBUG(PLUGIN_NAME ": %s", n.message);
plugin_dispatch_notification(&n);
if (state_old == STATE_MISSING)
ssnprintf(buf, bufsize, ": Value is no longer missing.");
else
- ssnprintf(buf, bufsize, ": All data sources are within range again. "
- "Current value of \"%s\" is %f.",
- ds->ds[ds_index].name, values[ds_index]);
+ ssnprintf(buf, bufsize,
+ ": All data sources are within range again. "
+ "Current value of \"%s\" is %f.",
+ ds->ds[ds_index].name, values[ds_index]);
} else if (state == STATE_UNKNOWN) {
ERROR("ut_report_state: metric transition to UNKNOWN from a different "
"state. This shouldn't happen.");
if (th->flags & UT_FLAG_INVERT) {
if (!isnan(min) && !isnan(max)) {
ssnprintf(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 {
- ssnprintf(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) ? "%" : "");
+ ssnprintf(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) ? "%" : "");
}
} else if (th->flags & UT_FLAG_PERCENTAGE) {
gauge_t value;
value = 100.0 * values[ds_index] / sum;
ssnprintf(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 */
{
- ssnprintf(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);
+ ssnprintf(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);
}
}
NOTIFICATION_INIT_VL(&n, vl);
ssnprintf(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);
memset(&cmd, 0, sizeof(cmd));
status = cmd_parse(input, &cmd, parse_data[i].opts, &err);
- ssnprintf(description, sizeof(description), "cmd_parse (\"%s\", opts=%p) = "
- "%d (type=%d [%s]); want %d "
- "(type=%d [%s])",
- parse_data[i].input, parse_data[i].opts, status, cmd.type,
- CMD_TO_STRING(cmd.type), parse_data[i].expected_status,
- parse_data[i].expected_type,
- CMD_TO_STRING(parse_data[i].expected_type));
+ ssnprintf(description, sizeof(description),
+ "cmd_parse (\"%s\", opts=%p) = "
+ "%d (type=%d [%s]); want %d "
+ "(type=%d [%s])",
+ parse_data[i].input, parse_data[i].opts, status, cmd.type,
+ CMD_TO_STRING(cmd.type), parse_data[i].expected_status,
+ parse_data[i].expected_type,
+ CMD_TO_STRING(parse_data[i].expected_type));
result = (status == parse_data[i].expected_status) &&
(cmd.type == parse_data[i].expected_type);
LOG(result, description);
* Niki W. Waibel <niki.waibel@gmx.net>
* Sebastian Harl <sh at tokkee.org>
* Michał Mirosław <mirq-linux at rere.qmqm.pl>
-**/
+ **/
#include "collectd.h"
pthread_mutex_unlock(&strerror_r_lock);
}
-/* #endif !HAVE_STRERROR_R */
+ /* #endif !HAVE_STRERROR_R */
#elif STRERROR_R_CHAR_P
{
if ((temp != NULL) && (temp != buf) && (temp[0] != '\0'))
sstrncpy(buf, temp, buflen);
else
- sstrncpy(buf, "strerror_r did not return "
- "an error message",
+ sstrncpy(buf,
+ "strerror_r did not return "
+ "an error message",
buflen);
}
}
-/* #endif STRERROR_R_CHAR_P */
+ /* #endif STRERROR_R_CHAR_P */
#else
if (strerror_r(errnum, buf, buflen) != 0) {
- snprintf(buf, buflen, "Error #%i; "
- "Additionally, strerror_r failed.",
+ snprintf(buf, buflen,
+ "Error #%i; "
+ "Additionally, strerror_r failed.",
errnum);
}
#endif /* STRERROR_R_CHAR_P */
else if (kn->data_type == KSTAT_DATA_UINT32)
retval = (long long)kn->value.ui32;
else if (kn->data_type == KSTAT_DATA_INT64)
- retval =
- (long long)kn->value.i64; /* According to ANSI C99 `long long' must hold
- at least 64 bits */
+ retval = (long long)kn->value.i64; /* According to ANSI C99 `long long' must
+ hold at least 64 bits */
else if (kn->data_type == KSTAT_DATA_UINT64)
retval = (long long)kn->value.ui64; /* XXX: Might overflow! */
else
* Authors:
* Florian octo Forster <octo at collectd.org>
* Niki W. Waibel <niki.waibel@gmx.net>
-**/
+ **/
#ifndef COMMON_H
#define COMMON_H
tmp[sizeof(tmp) - 1] = '\0';
ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s",
- r->instance_prefix, tmp);
+ r->instance_prefix, tmp);
}
}
vl.type_instance[sizeof(vl.type_instance) - 1] = '\0';
ssnprintf(phc->eal_config.coremask, DATA_MAX_NAME_LEN, "%s", "0xf");
ssnprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
ssnprintf(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) {
if (status == 0) {
#if RTE_VERSION <= RTE_VERSION_NUM(18, 5, 0, 0)
ssnprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
- "/var/run/.%s_config", prefix);
+ "/var/run/.%s_config", prefix);
#else
ssnprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
- "/var/run/dpdk/%s/config", prefix);
+ "/var/run/dpdk/%s/config", prefix);
#endif
DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
}
DPDK_HELPER_TRACE(name);
/* Allocate dpdk_helper_ctx_t and
- * initialize a POSIX SHared Memory (SHM) object.
- */
+ * initialize a POSIX SHared Memory (SHM) object.
+ */
int err = dpdk_shm_init(name, shm_size, (void **)&phc);
if (err != 0) {
return -errno;
/* non blocking check on helper logging pipe */
struct pollfd fds = {
- .fd = phc->pipes[0], .events = POLLIN,
+ .fd = phc->pipes[0],
+ .events = POLLIN,
};
int data_avail = poll(&fds, 1, 0);
DEBUG("%s:dpdk_helper_check_pipe: poll data_avail=%d", phc->shm_name,
* "CUMULATIVE",
* "GAUGE"
* )
-*/
+ */
static int format_metric_kind(yajl_gen gen, int ds_type) {
switch (ds_type) {
case DS_TYPE_GAUGE:
* "DOUBLE",
* "INT64"
* )
-*/
+ */
static int format_value_type(yajl_gen gen, int ds_type) {
return json_string(gen, (ds_type == DS_TYPE_GAUGE) ? "DOUBLE" : "INT64");
}
#define GCM_PREFIX "custom.googleapis.com/collectd/"
if ((ds_index != 0) || strcmp("value", ds_name) != 0) {
ssnprintf(buffer, buffer_size, GCM_PREFIX "%s/%s_%s", vl->plugin, vl->type,
- ds_name);
+ ds_name);
} else {
ssnprintf(buffer, buffer_size, GCM_PREFIX "%s/%s", vl->plugin, vl->type);
}
char start_value_key[DATA_MAX_NAME_LEN];
ssnprintf(start_value_key, sizeof(start_value_key),
- "stackdriver:start_value[%d]", ds_index);
+ "stackdriver:start_value[%d]", ds_index);
int status =
uc_meta_data_get_signed_int(vl, start_value_key, ret_start_value);
char url[1024];
ssnprintf(url, sizeof(url), GCE_SCOPE_URL_FORMAT,
- (email != NULL) ? email : GCE_DEFAULT_SERVICE_ACCOUNT);
+ (email != NULL) ? email : GCE_DEFAULT_SERVICE_ACCOUNT);
return read_url(url);
} /* }}} char *gce_scope */
/* create the claim set */
status =
- ssnprintf(claim, sizeof(claim), OAUTH_CLAIM_FORMAT, auth->iss, auth->scope,
- auth->aud, (unsigned long)CDTIME_T_TO_TIME_T(exp),
- (unsigned long)CDTIME_T_TO_TIME_T(iat));
+ ssnprintf(claim, sizeof(claim), OAUTH_CLAIM_FORMAT, auth->iss,
+ auth->scope, auth->aud, (unsigned long)CDTIME_T_TO_TIME_T(exp),
+ (unsigned long)CDTIME_T_TO_TIME_T(iat));
if (status < 1)
return -1;
else if ((size_t)status >= sizeof(claim))
}
ssnprintf(post_data, sizeof(post_data), "grant_type=%s&assertion=%s",
- OAUTH_GRANT_TYPE, assertion);
+ OAUTH_GRANT_TYPE, assertion);
curl = curl_easy_init();
if (curl == NULL) {
}
oauth_google_t ret = {
- .project_id = strdup(project_id), .oauth = oauth,
+ .project_id = strdup(project_id),
+ .oauth = oauth,
};
yajl_tree_free(root);
if ((home = getenv("HOME")) != NULL) {
char path[PATH_MAX];
ssnprintf(path, sizeof(path),
- "%s/.config/gcloud/application_default_credentials.json", home);
+ "%s/.config/gcloud/application_default_credentials.json", home);
oauth_google_t ret = oauth_create_google_file(path, scope);
if (ret.oauth != NULL) {
ovs_db_t *pdb = (ovs_db_t *)arg; /* pointer to OVS DB */
ovs_json_reader_t *jreader = NULL;
struct pollfd poll_fd = {
- .fd = pdb->sock, .events = POLLIN | POLLPRI, .revents = 0,
+ .fd = pdb->sock,
+ .events = POLLIN | POLLPRI,
+ .revents = 0,
};
/* create JSON reader instance */
break;
status = ssnprintf(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))) {
P_ERROR("rra_get: Buffer would have been truncated.");
if (plugin_instance == NULL)
plugin_instance = "default";
ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
- plugin_instance, category);
+ plugin_instance, category);
sstrncpy(vl.type, type, sizeof(vl.type));
/* callback = */ varnish_read,
/* interval = */ 0,
&(user_data_t){
- .data = conf, .free_func = varnish_config_free,
+ .data = conf,
+ .free_func = varnish_config_free,
});
return 0;
!conf->collect_mgt && !conf->collect_lck && !conf->collect_mempool &&
!conf->collect_mse
#endif
- ) {
+ ) {
WARNING("Varnish plugin: No metric has been configured for "
"instance \"%s\". Disabling this instance.",
(conf->instance == NULL) ? "localhost" : conf->instance);
}
ssnprintf(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",
/* callback = */ varnish_read,
/* interval = */ 0,
&(user_data_t){
- .data = conf, .free_func = varnish_config_free,
+ .data = conf,
+ .free_func = varnish_config_free,
});
have_instance = true;
static virt_notif_thread_t notif_thread;
const char *domain_states[] = {
- [VIR_DOMAIN_NOSTATE] = "no state",
- [VIR_DOMAIN_RUNNING] = "the domain is running",
- [VIR_DOMAIN_BLOCKED] = "the domain is blocked on resource",
- [VIR_DOMAIN_PAUSED] = "the domain is paused by user",
- [VIR_DOMAIN_SHUTDOWN] = "the domain is being shut down",
- [VIR_DOMAIN_SHUTOFF] = "the domain is shut off",
- [VIR_DOMAIN_CRASHED] = "the domain is crashed",
+ [VIR_DOMAIN_NOSTATE] = "no state",
+ [VIR_DOMAIN_RUNNING] = "the domain is running",
+ [VIR_DOMAIN_BLOCKED] = "the domain is blocked on resource",
+ [VIR_DOMAIN_PAUSED] = "the domain is paused by user",
+ [VIR_DOMAIN_SHUTDOWN] = "the domain is being shut down",
+ [VIR_DOMAIN_SHUTOFF] = "the domain is shut off",
+ [VIR_DOMAIN_CRASHED] = "the domain is crashed",
#ifdef HAVE_DOM_STATE_PMSUSPENDED
- [VIR_DOMAIN_PMSUSPENDED] =
- "the domain is suspended by guest power management",
+ [VIR_DOMAIN_PMSUSPENDED] =
+ "the domain is suspended by guest power management",
#endif
};
#define DOMAIN_STATE_REASON_MAX_SIZE 20
const char *domain_reasons[][DOMAIN_STATE_REASON_MAX_SIZE] = {
- [VIR_DOMAIN_NOSTATE][VIR_DOMAIN_NOSTATE_UNKNOWN] =
- "the reason is unknown",
-
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_UNKNOWN] =
- "the reason is unknown",
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_BOOTED] =
- "normal startup from boot",
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_MIGRATED] =
- "migrated from another host",
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_RESTORED] =
- "restored from a state file",
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_FROM_SNAPSHOT] =
- "restored from snapshot",
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_UNPAUSED] =
- "returned from paused state",
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_MIGRATION_CANCELED] =
- "returned from migration",
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_SAVE_CANCELED] =
- "returned from failed save process",
+ [VIR_DOMAIN_NOSTATE][VIR_DOMAIN_NOSTATE_UNKNOWN] = "the reason is unknown",
+
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_UNKNOWN] = "the reason is unknown",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_BOOTED] =
+ "normal startup from boot",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_MIGRATED] =
+ "migrated from another host",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_RESTORED] =
+ "restored from a state file",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_FROM_SNAPSHOT] =
+ "restored from snapshot",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_UNPAUSED] =
+ "returned from paused state",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_MIGRATION_CANCELED] =
+ "returned from migration",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_SAVE_CANCELED] =
+ "returned from failed save process",
#ifdef HAVE_DOM_REASON_RUNNING_WAKEUP
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_WAKEUP] =
- "returned from pmsuspended due to wakeup event",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_WAKEUP] =
+ "returned from pmsuspended due to wakeup event",
#endif
#ifdef HAVE_DOM_REASON_CRASHED
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_CRASHED] =
- "resumed from crashed",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_CRASHED] = "resumed from crashed",
#endif
#ifdef HAVE_DOM_REASON_POSTCOPY
- [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_POSTCOPY] =
- "running in post-copy migration mode",
-#endif
- [VIR_DOMAIN_BLOCKED][VIR_DOMAIN_BLOCKED_UNKNOWN] =
- "the reason is unknown",
-
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_UNKNOWN] =
- "the reason is unknown",
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_USER] = "paused on user request",
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_MIGRATION] =
- "paused for offline migration",
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SAVE] = "paused for save",
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_DUMP] =
- "paused for offline core dump",
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_IOERROR] =
- "paused due to a disk I/O error",
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_WATCHDOG] =
- "paused due to a watchdog event",
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_FROM_SNAPSHOT] =
- "paused after restoring from snapshot",
+ [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_POSTCOPY] =
+ "running in post-copy migration mode",
+#endif
+ [VIR_DOMAIN_BLOCKED][VIR_DOMAIN_BLOCKED_UNKNOWN] = "the reason is unknown",
+
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_UNKNOWN] = "the reason is unknown",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_USER] = "paused on user request",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_MIGRATION] =
+ "paused for offline migration",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SAVE] = "paused for save",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_DUMP] =
+ "paused for offline core dump",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_IOERROR] =
+ "paused due to a disk I/O error",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_WATCHDOG] =
+ "paused due to a watchdog event",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_FROM_SNAPSHOT] =
+ "paused after restoring from snapshot",
#ifdef HAVE_DOM_REASON_PAUSED_SHUTTING_DOWN
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SHUTTING_DOWN] =
- "paused during shutdown process",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SHUTTING_DOWN] =
+ "paused during shutdown process",
#endif
#ifdef HAVE_DOM_REASON_PAUSED_SNAPSHOT
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SNAPSHOT] =
- "paused while creating a snapshot",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SNAPSHOT] =
+ "paused while creating a snapshot",
#endif
#ifdef HAVE_DOM_REASON_PAUSED_CRASHED
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_CRASHED] =
- "paused due to a guest crash",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_CRASHED] =
+ "paused due to a guest crash",
#endif
#ifdef HAVE_DOM_REASON_PAUSED_STARTING_UP
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_STARTING_UP] =
- "the domain is being started",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_STARTING_UP] =
+ "the domain is being started",
#endif
#ifdef HAVE_DOM_REASON_POSTCOPY
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_POSTCOPY] =
- "paused for post-copy migration",
- [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_POSTCOPY_FAILED] =
- "paused after failed post-copy",
-#endif
- [VIR_DOMAIN_SHUTDOWN][VIR_DOMAIN_SHUTDOWN_UNKNOWN] =
- "the reason is unknown",
- [VIR_DOMAIN_SHUTDOWN][VIR_DOMAIN_SHUTDOWN_USER] =
- "shutting down on user request",
-
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_UNKNOWN] =
- "the reason is unknown",
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_SHUTDOWN] = "normal shutdown",
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_DESTROYED] = "forced poweroff",
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_CRASHED] = "domain crashed",
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_MIGRATED] =
- "migrated to another host",
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_SAVED] = "saved to a file",
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_FAILED] =
- "domain failed to start",
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT] =
- "restored from a snapshot which was taken while domain was shutoff",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_POSTCOPY] =
+ "paused for post-copy migration",
+ [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_POSTCOPY_FAILED] =
+ "paused after failed post-copy",
+#endif
+ [VIR_DOMAIN_SHUTDOWN][VIR_DOMAIN_SHUTDOWN_UNKNOWN] =
+ "the reason is unknown",
+ [VIR_DOMAIN_SHUTDOWN][VIR_DOMAIN_SHUTDOWN_USER] =
+ "shutting down on user request",
+
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_UNKNOWN] = "the reason is unknown",
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_SHUTDOWN] = "normal shutdown",
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_DESTROYED] = "forced poweroff",
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_CRASHED] = "domain crashed",
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_MIGRATED] =
+ "migrated to another host",
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_SAVED] = "saved to a file",
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_FAILED] = "domain failed to start",
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT] =
+ "restored from a snapshot which was taken while domain was shutoff",
#ifdef HAVE_DOM_REASON_SHUTOFF_DAEMON
- [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_DAEMON] =
- "daemon decides to kill domain during reconnection processing",
+ [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_DAEMON] =
+ "daemon decides to kill domain during reconnection processing",
#endif
- [VIR_DOMAIN_CRASHED][VIR_DOMAIN_CRASHED_UNKNOWN] =
- "the reason is unknown",
+ [VIR_DOMAIN_CRASHED][VIR_DOMAIN_CRASHED_UNKNOWN] = "the reason is unknown",
#ifdef VIR_DOMAIN_CRASHED_PANICKED
- [VIR_DOMAIN_CRASHED][VIR_DOMAIN_CRASHED_PANICKED] = "domain panicked",
+ [VIR_DOMAIN_CRASHED][VIR_DOMAIN_CRASHED_PANICKED] = "domain panicked",
#endif
#ifdef HAVE_DOM_STATE_PMSUSPENDED
- [VIR_DOMAIN_PMSUSPENDED][VIR_DOMAIN_PMSUSPENDED_UNKNOWN] =
- "the reason is unknown",
+ [VIR_DOMAIN_PMSUSPENDED][VIR_DOMAIN_PMSUSPENDED_UNKNOWN] =
+ "the reason is unknown",
#endif
};
#endif /* HAVE_DOM_REASON */
static void submit_derive2(const char *type, derive_t v0, derive_t v1,
virDomainPtr dom, const char *devname) {
value_t values[] = {
- {.derive = v0}, {.derive = v1},
+ {.derive = v0},
+ {.derive = v1},
};
submit(dom, type, devname, values, STATIC_ARRAY_SIZE(values));
char flush_type_instance[DATA_MAX_NAME_LEN];
ssnprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
- type_instance);
+ type_instance);
if ((bstats->bi.rd_req != -1) && (bstats->bi.wr_req != -1))
submit_derive2("disk_ops", (derive_t)bstats->bi.rd_req,
#endif
ssnprintf(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);
- ssnprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu, cpu);
+ ssnprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu,
+ cpu);
submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1);
}
}
}
value_t values[] = {
- {.gauge = (gauge_t)domain_state}, {.gauge = (gauge_t)domain_reason},
+ {.gauge = (gauge_t)domain_state},
+ {.gauge = (gauge_t)domain_reason},
};
submit(domain, "domain_state", NULL, values, STATIC_ARRAY_SIZE(values));
if (min_flt > 0 || maj_flt > 0) {
value_t values[] = {
- {.gauge = (gauge_t)min_flt}, {.gauge = (gauge_t)maj_flt},
+ {.gauge = (gauge_t)min_flt},
+ {.gauge = (gauge_t)maj_flt},
};
submit(domain, "ps_pagefaults", NULL, values, STATIC_ARRAY_SIZE(values));
}
}
ssnprintf(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",
rd_kafka_topic_conf_set_opaque(tctx->conf, tctx);
ssnprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
- tctx->topic_name);
+ tctx->topic_name);
- status = plugin_register_write(
- callback_name, kafka_write,
- &(user_data_t){
- .data = tctx, .free_func = kafka_topic_context_free,
- });
+ status = plugin_register_write(callback_name, kafka_write,
+ &(user_data_t){
+ .data = tctx,
+ .free_func = kafka_topic_context_free,
+ });
if (status != 0) {
WARNING("write_kafka plugin: plugin_register_write (\"%s\") "
"failed with status %i.",
#define LABEL_BUFFER_SIZE (LABEL_KEY_SIZE + LABEL_VALUE_SIZE + 4)
char *labels[3] = {
- (char[LABEL_BUFFER_SIZE]){0}, (char[LABEL_BUFFER_SIZE]){0},
+ (char[LABEL_BUFFER_SIZE]){0},
+ (char[LABEL_BUFFER_SIZE]){0},
(char[LABEL_BUFFER_SIZE]){0},
};
for (size_t i = 0; i < m->n_label; i++) {
char value[LABEL_VALUE_SIZE];
ssnprintf(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);
ssnprintf(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)
ssnprintf(timestamp_ms, sizeof(timestamp_ms), " %" PRIi64,
- m->timestamp_ms);
+ m->timestamp_ms);
if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
ssnprintf(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) */
ssnprintf(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];
ssnprintf(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 (status != 0)
return status;
ssnprintf(key, sizeof(key), "%s%s",
- (node->prefix != NULL) ? node->prefix : REDIS_DEFAULT_PREFIX, ident);
+ (node->prefix != NULL) ? node->prefix : REDIS_DEFAULT_PREFIX,
+ ident);
ssnprintf(time, sizeof(time), "%.9f", CDTIME_T_TO_DOUBLE(vl->time));
value_size = sizeof(value);
ssnprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
- status =
- plugin_register_write(cb_name, wr_write,
- &(user_data_t){
- .data = node, .free_func = wr_config_free,
- });
+ status = plugin_register_write(cb_name, wr_write,
+ &(user_data_t){
+ .data = node,
+ .free_func = wr_config_free,
+ });
}
if (status != 0)
vl->type_instance);
if (host->always_append_ds || (ds->ds_num > 1)) {
if (host->event_service_prefix == NULL)
- ssnprintf(service_buffer, sizeof(service_buffer), "%s/%s", &name_buffer[1],
- ds->ds[index].name);
+ ssnprintf(service_buffer, sizeof(service_buffer), "%s/%s",
+ &name_buffer[1], ds->ds[index].name);
else
ssnprintf(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
ssnprintf(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];
ssnprintf(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",
}
ssnprintf(callback_name, sizeof(callback_name), "write_riemann/%s",
- host->name);
+ host->name);
user_data_t ud = {.data = host, .free_func = wrr_free};
}
status = ssnprintf(authorization_header, sizeof(authorization_header),
- "Authorization: Bearer %s", access_token);
+ "Authorization: Bearer %s", access_token);
if ((status < 1) || ((size_t)status >= sizeof(authorization_header)))
return NULL;
char const *payload) {
char url[1024];
ssnprintf(url, sizeof(url), "%s/projects/%s/metricDescriptors", cb->url,
- cb->project);
+ cb->project);
wg_memory_t response = {0};
int status = do_post(cb, url, payload, &response);
static int wg_call_timeseries_write(wg_callback_t *cb, char const *payload) {
char url[1024];
- ssnprintf(url, sizeof(url), "%s/projects/%s/timeSeries", cb->url, cb->project);
+ ssnprintf(url, sizeof(url), "%s/projects/%s/timeSeries", cb->url,
+ cb->project);
wg_memory_t response = {0};
int status = do_post(cb, url, payload, &response);