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. */
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) {
/* callback = */ apache_read_host,
/* interval = */ 0,
&(user_data_t){
- .data = st, .free_func = apache_free,
+ .data = st,
+ .free_func = apache_free,
});
} /* int config_add */
return 0;
} /* }}} int battery_read */
-/* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */
+ /* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */
#elif KERNEL_LINUX
/* Reads a file which contains only a number (and optionally a trailing
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
#ifdef HAVE_CURLOPT_TIMEOUT_MS
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS,
- (timeout >= 0) ? (long)timeout : (long)CDTIME_T_TO_MS(
- plugin_get_interval()));
+ (timeout >= 0)
+ ? (long)timeout
+ : (long)CDTIME_T_TO_MS(plugin_get_interval()));
#endif
return 0;
#define ATTRIB_PACKED
#endif
-typedef struct ATTRIB_PACKED { int32_t value; } tFloat;
+typedef struct ATTRIB_PACKED {
+ int32_t value;
+} tFloat;
typedef struct ATTRIB_PACKED {
uint32_t tv_sec_high;
Amplification) */
} tChrony_Req_Tracking;
-typedef struct ATTRIB_PACKED { uint32_t f_n_sources; } tChrony_Req_N_Sources;
+typedef struct ATTRIB_PACKED {
+ uint32_t f_n_sources;
+} tChrony_Req_N_Sources;
typedef struct ATTRIB_PACKED {
int32_t f_index;
} tChrony_Request;
/* Chrony daemon response packets */
-typedef struct ATTRIB_PACKED { uint32_t f_n_sources; } tChrony_Resp_N_Sources;
+typedef struct ATTRIB_PACKED {
+ uint32_t f_n_sources;
+} tChrony_Resp_N_Sources;
typedef struct ATTRIB_PACKED {
union {
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 {
if (counter >= 10) {
unsigned int time_left = 300;
- syslog(LOG_ERR, "Error: collectd is respawning too fast - "
- "disabled for %i seconds",
+ syslog(LOG_ERR,
+ "Error: collectd is respawning too fast - "
+ "disabled for %i seconds",
time_left);
while (((time_left = sleep(time_left)) > 0) && loop == 0)
}
struct sigaction sa = {
- .sa_handler = sig_int_term_handler, .sa_flags = 0,
+ .sa_handler = sig_int_term_handler,
+ .sa_flags = 0,
};
sigemptyset(&sa.sa_mask);
}
cs_submit(value);
-/* #endif HAVE_SYSCTLBYNAME */
+ /* #endif HAVE_SYSCTLBYNAME */
#elif KERNEL_LINUX
FILE *fh;
if (status == -2)
ERROR("contextswitch plugin: Unable to find context switch value.");
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_PERFSTAT
int status = 0;
INFO("cpu plugin: Found %i processor%s.", (int)cpu_list_len,
cpu_list_len == 1 ? "" : "s");
-/* #endif PROCESSOR_CPU_LOAD_INFO */
+ /* #endif PROCESSOR_CPU_LOAD_INFO */
#elif defined(HAVE_LIBKSTAT)
kstat_t *ksp_chain;
ksp_chain = ksp_chain->ks_next)
if (strncmp(ksp_chain->ks_module, "cpu_stat", 8) == 0)
ksp[numcpu++] = ksp_chain;
-/* #endif HAVE_LIBKSTAT */
+ /* #endif HAVE_LIBKSTAT */
#elif CAN_USE_SYSCTL
size_t numcpu_size;
WARNING("cpu plugin: sysctl: %s", STRERRNO);
return -1;
}
-/* #endif CAN_USE_SYSCTL */
+ /* #endif CAN_USE_SYSCTL */
#elif defined(HAVE_SYSCTLBYNAME)
size_t numcpu_size;
"%i)",
numcpu);
#endif
-/* #endif HAVE_SYSCTLBYNAME */
+ /* #endif HAVE_SYSCTLBYNAME */
#elif defined(HAVE_LIBSTATGRAB)
/* nothing to initialize */
cpu_stage(cpu, COLLECTD_CPU_STATE_IDLE,
(derive_t)cpu_info.cpu_ticks[CPU_STATE_IDLE], now);
}
-/* }}} #endif PROCESSOR_CPU_LOAD_INFO */
+ /* }}} #endif PROCESSOR_CPU_LOAD_INFO */
#elif defined(KERNEL_LINUX) /* {{{ */
int cpu;
cpu_stage(cpu, COLLECTD_CPU_STATE_NICE, (derive_t)nice_value, now);
}
fclose(fh);
-/* }}} #endif defined(KERNEL_LINUX) */
+ /* }}} #endif defined(KERNEL_LINUX) */
#elif defined(HAVE_LIBKSTAT) /* {{{ */
static cpu_stat_t cs;
cpu_stage(ksp[cpu]->ks_instance, COLLECTD_CPU_STATE_WAIT,
(derive_t)cs.cpu_sysinfo.cpu[CPU_WAIT], now);
}
-/* }}} #endif defined(HAVE_LIBKSTAT) */
+ /* }}} #endif defined(HAVE_LIBKSTAT) */
#elif CAN_USE_SYSCTL /* {{{ */
uint64_t cpuinfo[numcpu][CPUSTATES];
cpu_stage(i, COLLECTD_CPU_STATE_INTERRUPT, (derive_t)cpuinfo[i][CP_INTR],
now);
}
-/* }}} #endif CAN_USE_SYSCTL */
+ /* }}} #endif CAN_USE_SYSCTL */
#elif defined(HAVE_SYSCTLBYNAME) && defined(HAVE_SYSCTL_KERN_CP_TIMES) /* {{{ \
- */
+ */
long cpuinfo[maxcpu][CPUSTATES];
size_t cpuinfo_size;
cpu_stage(i, COLLECTD_CPU_STATE_INTERRUPT, (derive_t)cpuinfo[i][CP_INTR],
now);
}
-/* }}} #endif HAVE_SYSCTL_KERN_CP_TIMES */
+ /* }}} #endif HAVE_SYSCTL_KERN_CP_TIMES */
#elif defined(HAVE_SYSCTLBYNAME) /* {{{ */
long cpuinfo[CPUSTATES];
cpu_stage(0, COLLECTD_CPU_STATE_SYSTEM, (derive_t)cpuinfo[CP_SYS], now);
cpu_stage(0, COLLECTD_CPU_STATE_IDLE, (derive_t)cpuinfo[CP_IDLE], now);
cpu_stage(0, COLLECTD_CPU_STATE_INTERRUPT, (derive_t)cpuinfo[CP_INTR], now);
-/* }}} #endif HAVE_SYSCTLBYNAME */
+ /* }}} #endif HAVE_SYSCTLBYNAME */
#elif defined(HAVE_LIBSTATGRAB) /* {{{ */
sg_cpu_stats *cs;
cpu_state(0, COLLECTD_CPU_STATE_SYSTEM, (derive_t)cs->kernel);
cpu_state(0, COLLECTD_CPU_STATE_USER, (derive_t)cs->user);
cpu_state(0, COLLECTD_CPU_STATE_WAIT, (derive_t)cs->iowait);
-/* }}} #endif HAVE_LIBSTATGRAB */
+ /* }}} #endif HAVE_LIBSTATGRAB */
#elif defined(HAVE_PERFSTAT) /* {{{ */
perfstat_id_t id;
* CPU sleep is reported in milliseconds of sleep per second of wall
* time. For that, the time difference between BOOT and MONOTONIC clocks
* is reported using derive type.
-**/
+ **/
#include "collectd.h"
typedef struct {
PluginData data;
- PyObject *meta; /* dict */
+ PyObject *meta; /* dict */
int severity;
char message[NOTIF_MAX_MSG_LEN];
} Notification;
plugin_register_complex_read(/* group = */ NULL, cb_name, cc_read_page,
interval,
&(user_data_t){
- .data = page, .free_func = cc_web_page_free,
+ .data = page,
+ .free_func = cc_web_page_free,
});
sfree(cb_name);
plugin_register_complex_read(/* group = */ NULL, cb_name, cj_read, interval,
&(user_data_t){
- .data = db, .free_func = cj_free,
+ .data = db,
+ .free_func = cj_free,
});
sfree(cb_name);
} else {
return EINVAL;
}
- cx_namespace_t *ns = realloc(
- db->namespaces, sizeof(*db->namespaces) * (db->namespaces_num + 1));
+ cx_namespace_t *ns = realloc(db->namespaces, sizeof(*db->namespaces) *
+ (db->namespaces_num + 1));
if (ns == NULL) {
ERROR("curl_xml plugin: realloc failed.");
return ENOMEM;
plugin_register_complex_read(/* group = */ "curl_xml", cb_name, cx_read,
/* interval = */ interval,
&(user_data_t){
- .data = db, .free_func = cx_free,
+ .data = db,
+ .free_func = cx_free,
});
sfree(cb_name);
return 0;
#ifdef KERNEL_LINUX
&& notify_upstart() == 0 && notify_systemd() == 0
#endif
- ) {
+ ) {
pid_t pid;
if ((pid = fork()) == -1) {
/* error */
static void read_cmdline(int argc, char **argv, struct cmdline_config *config) {
/* read options */
while (1) {
- int c = getopt(argc, argv, "BhtTC:"
+ int c = getopt(argc, argv,
+ "BhtTC:"
#if COLLECT_DAEMON
- "fP:"
+ "fP:"
#endif
- );
+ );
if (c == -1)
break;
struct cmdline_config init_config(int argc, char **argv) {
struct cmdline_config config = {
- .daemonize = true, .create_basedir = true, .configfile = CONFIGFILE,
+ .daemonize = true,
+ .create_basedir = true,
+ .configfile = CONFIGFILE,
};
read_cmdline(argc, argv, &config);
/* default to the global interval set before loading this plugin */
plugin_ctx_t ctx = {
- .interval = cf_get_default_interval(), .name = strdup(name),
+ .interval = cf_get_default_interval(),
+ .name = strdup(name),
};
if (ctx.name == NULL)
return ENOMEM;
return 0;
}
- temp = realloc(dst->children,
- sizeof(oconfig_item_t) *
- (dst->children_num + src->children_num - 1));
+ temp =
+ realloc(dst->children, sizeof(oconfig_item_t) *
+ (dst->children_num + src->children_num - 1));
if (temp == NULL) {
ERROR("configfile: realloc failed.");
return -1;
if ((src == NULL) || (src->children_num == 0))
return 0;
- temp =
- realloc(dst->children,
- sizeof(oconfig_item_t) * (dst->children_num + src->children_num));
+ temp = realloc(dst->children, sizeof(oconfig_item_t) *
+ (dst->children_num + src->children_num));
if (temp == NULL) {
ERROR("configfile: realloc failed.");
return -1;
cf->cf_callback = callback;
if (ud == NULL) {
cf->cf_udata = (user_data_t){
- .data = NULL, .free_func = NULL,
+ .data = NULL,
+ .free_func = NULL,
};
} else {
cf->cf_udata = *ud;
/* name = */ flush_name,
/* callback = */ plugin_flush_timeout_callback,
/* interval = */ ctx.flush_interval,
- /* user data = */ &(user_data_t){
- .data = cb, .free_func = plugin_flush_timeout_callback_free,
+ /* user data = */
+ &(user_data_t){
+ .data = cb,
+ .free_func = plugin_flush_timeout_callback_free,
});
sfree(flush_name);
* plugin calls the cache interface. */
for (size_t i = 0; i < expired_num; i++) {
value_list_t vl = {
- .time = expired[i].time, .interval = expired[i].interval,
+ .time = expired[i].time,
+ .interval = expired[i].interval,
};
if (parse_identifier_vl(expired[i].key, &vl) != 0) {
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;
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;
static void submit_octets(derive_t queries, derive_t responses) {
value_t values[] = {
- {.derive = queries}, {.derive = responses},
+ {.derive = queries},
+ {.derive = responses},
};
value_list_t vl = VALUE_LIST_INIT;
long int tmp = strtol(value, NULL, 0);
if (tmp < 1) {
- fprintf(stderr, "email plugin: `MaxConns' was set to invalid "
- "value %li, will use default %i.\n",
+ fprintf(stderr,
+ "email plugin: `MaxConns' was set to invalid "
+ "value %li, will use default %i.\n",
tmp, MAX_CONNS);
ERROR("email plugin: `MaxConns' was set to invalid "
"value %li, will use default %i.\n",
tmp, MAX_CONNS);
max_conns = MAX_CONNS;
} else if (tmp > MAX_CONNS_LIMIT) {
- fprintf(stderr, "email plugin: `MaxConns' was set to invalid "
- "value %li, will use hardcoded limit %i.\n",
+ fprintf(stderr,
+ "email plugin: `MaxConns' was set to invalid "
+ "value %li, will use hardcoded limit %i.\n",
tmp, MAX_CONNS_LIMIT);
ERROR("email plugin: `MaxConns' was set to invalid "
"value %li, will use hardcoded limit %i.\n",
else if (n->severity == NOTIF_OKAY)
severity = "OKAY";
- fprintf(fh, "Severity: %s\n"
- "Time: %.3f\n",
+ fprintf(fh,
+ "Severity: %s\n"
+ "Time: %.3f\n",
severity, CDTIME_T_TO_DOUBLE(n->time));
/* Print the optional fields */
#define KEY_IGNORESELECTED "IgnoreSelected"
static const char *config_keys[] = {
- KEY_GPUINDEX, KEY_IGNORESELECTED,
+ KEY_GPUINDEX,
+ KEY_IGNORESELECTED,
};
static const unsigned int n_config_keys = STATIC_ARRAY_SIZE(config_keys);
{.value.string = "proc1", .type = OCONFIG_TYPE_STRING},
};
oconfig_item_t config_item = {
- .values = values, .values_num = STATIC_ARRAY_SIZE(values),
+ .values = values,
+ .values_num = STATIC_ARRAY_SIZE(values),
};
/* check */
{.value.string = "proc21,proc22,proc23", .type = OCONFIG_TYPE_STRING},
};
oconfig_item_t config_item = {
- .values = values, .values_num = STATIC_ARRAY_SIZE(values),
+ .values = values,
+ .values_num = STATIC_ARRAY_SIZE(values),
};
/* check */
{.value.string = "_seventeen_chars_", .type = OCONFIG_TYPE_STRING},
};
oconfig_item_t config_item = {
- .values = values, .values_num = STATIC_ARRAY_SIZE(values),
+ .values = values,
+ .values_num = STATIC_ARRAY_SIZE(values),
};
/* check */
{.value.string = "proc21,proc,proc23", .type = OCONFIG_TYPE_STRING},
};
oconfig_item_t config_item = {
- .values = values, .values_num = STATIC_ARRAY_SIZE(values),
+ .values = values,
+ .values_num = STATIC_ARRAY_SIZE(values),
};
/* check */
{.value.string = "proc11,proc,proc,proc14", .type = OCONFIG_TYPE_STRING},
};
oconfig_item_t config_item = {
- .values = values, .values_num = STATIC_ARRAY_SIZE(values),
+ .values = values,
+ .values_num = STATIC_ARRAY_SIZE(values),
};
/* check */
};
oconfig_item_t config_item = {
- .values = values, .values_num = STATIC_ARRAY_SIZE(values),
+ .values = values,
+ .values_num = STATIC_ARRAY_SIZE(values),
};
/* check */
{.value.string = "proc11,,proc13", .type = OCONFIG_TYPE_STRING},
};
oconfig_item_t config_item = {
- .values = values, .values_num = STATIC_ARRAY_SIZE(values),
+ .values = values,
+ .values_num = STATIC_ARRAY_SIZE(values),
};
/* check */
* (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 ((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;
pagesize_g = sysconf(_SC_PAGESIZE);
return 0;
}
-/* }}} */
-/* #endif KERNEL_LINUX */
+ /* }}} */
+ /* #endif KERNEL_LINUX */
#elif KERNEL_AIX
static caddr_t ipc_get_info(cid_t cid, int cmd, int version, int stsize,
static void cipvs_submit_if(const char *pi, const char *t, const char *ti,
derive_t rx, derive_t tx) {
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
value_list_t vl = VALUE_LIST_INIT;
/* group = */ NULL, cbi->name, cjni_read,
/* interval = */ 0,
&(user_data_t){
- .data = cbi, .free_func = cjni_callback_info_destroy,
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy,
});
(*jvm_env)->DeleteLocalRef(jvm_env, o_read);
DEBUG("java plugin: Registering new write callback: %s", cbi->name);
- plugin_register_write(
- cbi->name, cjni_write,
- &(user_data_t){
- .data = cbi, .free_func = cjni_callback_info_destroy,
- });
+ plugin_register_write(cbi->name, cjni_write,
+ &(user_data_t){
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy,
+ });
(*jvm_env)->DeleteLocalRef(jvm_env, o_write);
DEBUG("java plugin: Registering new flush callback: %s", cbi->name);
- plugin_register_flush(
- cbi->name, cjni_flush,
- &(user_data_t){
- .data = cbi, .free_func = cjni_callback_info_destroy,
- });
+ plugin_register_flush(cbi->name, cjni_flush,
+ &(user_data_t){
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy,
+ });
(*jvm_env)->DeleteLocalRef(jvm_env, o_flush);
plugin_register_log(cbi->name, cjni_log,
&(user_data_t){
- .data = cbi, .free_func = cjni_callback_info_destroy,
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy,
});
(*jvm_env)->DeleteLocalRef(jvm_env, o_log);
DEBUG("java plugin: Registering new notification callback: %s", cbi->name);
- plugin_register_notification(
- cbi->name, cjni_notification,
- &(user_data_t){
- .data = cbi, .free_func = cjni_callback_info_destroy,
- });
+ plugin_register_notification(cbi->name, cjni_notification,
+ &(user_data_t){
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy,
+ });
(*jvm_env)->DeleteLocalRef(jvm_env, o_notification);
"(Ljava/lang/String;Lorg/collectd/api/CollectdLogInterface;)I",
cjni_api_register_log},
- {"registerNotification", "(Ljava/lang/String;Lorg/collectd/api/"
- "CollectdNotificationInterface;)I",
+ {"registerNotification",
+ "(Ljava/lang/String;Lorg/collectd/api/"
+ "CollectdNotificationInterface;)I",
cjni_api_register_notification},
- {"registerMatch", "(Ljava/lang/String;Lorg/collectd/api/"
- "CollectdMatchFactoryInterface;)I",
+ {"registerMatch",
+ "(Ljava/lang/String;Lorg/collectd/api/"
+ "CollectdMatchFactoryInterface;)I",
cjni_api_register_match},
- {"registerTarget", "(Ljava/lang/String;Lorg/collectd/api/"
- "CollectdTargetFactoryInterface;)I",
+ {"registerTarget",
+ "(Ljava/lang/String;Lorg/collectd/api/"
+ "CollectdTargetFactoryInterface;)I",
cjni_api_register_target},
{"log", "(ILjava/lang/String;)V", cjni_api_log},
#if !HAVE_STRERROR_R
snprintf(buf, buflen, "Error #%i; strerror_r is not available.", errnum);
-/* #endif !HAVE_STRERROR_R */
+ /* #endif !HAVE_STRERROR_R */
#elif STRERROR_R_CHAR_P
{
if ((temp != NULL) && (temp != buf) && (temp[0] != 0))
strncpy(buf, temp, buflen);
else
- strncpy(buf, "strerror_r did not return "
- "an error message",
+ strncpy(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 */
static int parse_values(void *payload, size_t payload_size,
lcc_value_list_t *state) {
buffer_t *b = &(buffer_t){
- .data = payload, .len = payload_size,
+ .data = payload,
+ .len = payload_size,
};
uint16_t n;
}
buffer_t *b = &(buffer_t){
- .data = signature, .len = signature_len,
+ .data = signature,
+ .len = signature_len,
};
uint8_t hash[32];
}
buffer_t *b = &(buffer_t){
- .data = data, .len = data_size,
+ .data = data,
+ .len = data_size,
};
uint16_t username_len;
static int network_parse(void *data, size_t data_size, lcc_security_level_t sl,
lcc_network_parse_options_t const *opts) {
buffer_t *b = &(buffer_t){
- .data = data, .len = data_size,
+ .data = data,
+ .len = data_size,
};
lcc_value_list_t state = {0};
uint8_t buffer[LCC_NETWORK_BUFFER_SIZE_DEFAULT];
size_t buffer_size = sizeof(buffer);
if (decode_string(raw_packet_data[i], buffer, &buffer_size)) {
- fprintf(stderr, "lcc_network_parse(raw_packet_data[%" PRIsz "]):"
- " decoding string failed\n",
+ fprintf(stderr,
+ "lcc_network_parse(raw_packet_data[%" PRIsz "]):"
+ " decoding string failed\n",
i);
return -1;
}
- int status =
- lcc_network_parse(buffer, buffer_size, (lcc_network_parse_options_t){
- .writer = nop_writer,
- });
+ int status = lcc_network_parse(buffer, buffer_size,
+ (lcc_network_parse_options_t){
+ .writer = nop_writer,
+ });
if (status != 0) {
fprintf(stderr,
"lcc_network_parse(raw_packet_data[%" PRIsz "]) = %d, want 0\n",
int status = decrypt_aes256(
&(buffer_t){
- .data = ciphertext, .len = ciphertext_len,
+ .data = ciphertext,
+ .len = ciphertext_len,
},
iv, iv_len, "admin");
if (status != 0) {
#ifndef AUX_TYPES_H
#define AUX_TYPES_H 1
-struct statement_list_s
-{
- oconfig_item_t *statement;
- int statement_num;
+struct statement_list_s {
+ oconfig_item_t *statement;
+ int statement_num;
};
typedef struct statement_list_s statement_list_t;
-struct argument_list_s
-{
- oconfig_value_t *argument;
- int argument_num;
+struct argument_list_s {
+ oconfig_value_t *argument;
+ int argument_num;
};
typedef struct argument_list_s argument_list_t;
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)
static void submit_derive2(const char *dev, const char *type, const char *ti1,
const char *ti2, derive_t val1, derive_t val2) {
value_t values[] = {
- {.derive = val1}, {.derive = val2},
+ {.derive = val1},
+ {.derive = val2},
};
submit(dev, type, ti1, ti2, values, STATIC_ARRAY_SIZE(values));
#ifndef MADWIFI_H
#define MADWIFI_H
-#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
-#define IEEE80211_RATE_VAL 0x7f
-#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
-#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
-
+#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
+#define IEEE80211_RATE_VAL 0x7f
+#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
+#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
/*
* Per/node (station) statistics available when operating as an AP.
*/
struct ieee80211_nodestats {
- u_int32_t ns_rx_data; /* rx data frames */
- u_int32_t ns_rx_mgmt; /* rx management frames */
- u_int32_t ns_rx_ctrl; /* rx control frames */
- u_int32_t ns_rx_ucast; /* rx unicast frames */
- u_int32_t ns_rx_mcast; /* rx multi/broadcast frames */
- u_int64_t ns_rx_bytes; /* rx data count (bytes) */
- u_int64_t ns_rx_beacons; /* rx beacon frames */
- u_int32_t ns_rx_proberesp; /* rx probe response frames */
+ u_int32_t ns_rx_data; /* rx data frames */
+ u_int32_t ns_rx_mgmt; /* rx management frames */
+ u_int32_t ns_rx_ctrl; /* rx control frames */
+ u_int32_t ns_rx_ucast; /* rx unicast frames */
+ u_int32_t ns_rx_mcast; /* rx multi/broadcast frames */
+ u_int64_t ns_rx_bytes; /* rx data count (bytes) */
+ u_int64_t ns_rx_beacons; /* rx beacon frames */
+ u_int32_t ns_rx_proberesp; /* rx probe response frames */
- u_int32_t ns_rx_dup; /* rx discard because it's a dup */
- u_int32_t ns_rx_noprivacy; /* rx w/ wep but privacy off */
- u_int32_t ns_rx_wepfail; /* rx wep processing failed */
- u_int32_t ns_rx_demicfail; /* rx demic failed */
- u_int32_t ns_rx_decap; /* rx decapsulation failed */
- u_int32_t ns_rx_defrag; /* rx defragmentation failed */
- u_int32_t ns_rx_disassoc; /* rx disassociation */
- u_int32_t ns_rx_deauth; /* rx deauthentication */
- u_int32_t ns_rx_decryptcrc; /* rx decrypt failed on crc */
- u_int32_t ns_rx_unauth; /* rx on unauthorized port */
- u_int32_t ns_rx_unencrypted; /* rx unecrypted w/ privacy */
+ u_int32_t ns_rx_dup; /* rx discard because it's a dup */
+ u_int32_t ns_rx_noprivacy; /* rx w/ wep but privacy off */
+ u_int32_t ns_rx_wepfail; /* rx wep processing failed */
+ u_int32_t ns_rx_demicfail; /* rx demic failed */
+ u_int32_t ns_rx_decap; /* rx decapsulation failed */
+ u_int32_t ns_rx_defrag; /* rx defragmentation failed */
+ u_int32_t ns_rx_disassoc; /* rx disassociation */
+ u_int32_t ns_rx_deauth; /* rx deauthentication */
+ u_int32_t ns_rx_decryptcrc; /* rx decrypt failed on crc */
+ u_int32_t ns_rx_unauth; /* rx on unauthorized port */
+ u_int32_t ns_rx_unencrypted; /* rx unecrypted w/ privacy */
- u_int32_t ns_tx_data; /* tx data frames */
- u_int32_t ns_tx_mgmt; /* tx management frames */
- u_int32_t ns_tx_ucast; /* tx unicast frames */
- u_int32_t ns_tx_mcast; /* tx multi/broadcast frames */
- u_int64_t ns_tx_bytes; /* tx data count (bytes) */
- u_int32_t ns_tx_probereq; /* tx probe request frames */
- u_int32_t ns_tx_uapsd; /* tx on uapsd queue */
+ u_int32_t ns_tx_data; /* tx data frames */
+ u_int32_t ns_tx_mgmt; /* tx management frames */
+ u_int32_t ns_tx_ucast; /* tx unicast frames */
+ u_int32_t ns_tx_mcast; /* tx multi/broadcast frames */
+ u_int64_t ns_tx_bytes; /* tx data count (bytes) */
+ u_int32_t ns_tx_probereq; /* tx probe request frames */
+ u_int32_t ns_tx_uapsd; /* tx on uapsd queue */
- u_int32_t ns_tx_novlantag; /* tx discard due to no tag */
- u_int32_t ns_tx_vlanmismatch; /* tx discard due to of bad tag */
+ u_int32_t ns_tx_novlantag; /* tx discard due to no tag */
+ u_int32_t ns_tx_vlanmismatch; /* tx discard due to of bad tag */
- u_int32_t ns_tx_eosplost; /* uapsd EOSP retried out */
+ u_int32_t ns_tx_eosplost; /* uapsd EOSP retried out */
- u_int32_t ns_ps_discard; /* ps discard due to of age */
+ u_int32_t ns_ps_discard; /* ps discard due to of age */
- u_int32_t ns_uapsd_triggers; /* uapsd triggers */
+ u_int32_t ns_uapsd_triggers; /* uapsd triggers */
- /* MIB-related state */
- u_int32_t ns_tx_assoc; /* [re]associations */
- u_int32_t ns_tx_assoc_fail; /* [re]association failures */
- u_int32_t ns_tx_auth; /* [re]authentications */
- u_int32_t ns_tx_auth_fail; /* [re]authentication failures*/
- u_int32_t ns_tx_deauth; /* deauthentications */
- u_int32_t ns_tx_deauth_code; /* last deauth reason */
- u_int32_t ns_tx_disassoc; /* disassociations */
- u_int32_t ns_tx_disassoc_code; /* last disassociation reason */
- u_int32_t ns_psq_drops; /* power save queue drops */
+ /* MIB-related state */
+ u_int32_t ns_tx_assoc; /* [re]associations */
+ u_int32_t ns_tx_assoc_fail; /* [re]association failures */
+ u_int32_t ns_tx_auth; /* [re]authentications */
+ u_int32_t ns_tx_auth_fail; /* [re]authentication failures*/
+ u_int32_t ns_tx_deauth; /* deauthentications */
+ u_int32_t ns_tx_deauth_code; /* last deauth reason */
+ u_int32_t ns_tx_disassoc; /* disassociations */
+ u_int32_t ns_tx_disassoc_code; /* last disassociation reason */
+ u_int32_t ns_psq_drops; /* power save queue drops */
};
/*
* Summary statistics.
*/
struct ieee80211_stats {
- u_int32_t is_rx_badversion; /* rx frame with bad version */
- u_int32_t is_rx_tooshort; /* rx frame too short */
- u_int32_t is_rx_wrongbss; /* rx from wrong bssid */
- u_int32_t is_rx_dup; /* rx discard due to it's a dup */
- u_int32_t is_rx_wrongdir; /* rx w/ wrong direction */
- u_int32_t is_rx_mcastecho; /* rx discard due to of mcast echo */
- u_int32_t is_rx_notassoc; /* rx discard due to sta !assoc */
- u_int32_t is_rx_noprivacy; /* rx w/ wep but privacy off */
- u_int32_t is_rx_unencrypted; /* rx w/o wep and privacy on */
- u_int32_t is_rx_wepfail; /* rx wep processing failed */
- u_int32_t is_rx_decap; /* rx decapsulation failed */
- u_int32_t is_rx_mgtdiscard; /* rx discard mgt frames */
- u_int32_t is_rx_ctl; /* rx discard ctrl frames */
- u_int32_t is_rx_beacon; /* rx beacon frames */
- u_int32_t is_rx_rstoobig; /* rx rate set truncated */
- u_int32_t is_rx_elem_missing; /* rx required element missing*/
- u_int32_t is_rx_elem_toobig; /* rx element too big */
- u_int32_t is_rx_elem_toosmall; /* rx element too small */
- u_int32_t is_rx_elem_unknown; /* rx element unknown */
- u_int32_t is_rx_badchan; /* rx frame w/ invalid chan */
- u_int32_t is_rx_chanmismatch; /* rx frame chan mismatch */
- u_int32_t is_rx_nodealloc; /* rx frame dropped */
- u_int32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */
- u_int32_t is_rx_auth_unsupported;/* rx w/ unsupported auth alg */
- u_int32_t is_rx_auth_fail; /* rx sta auth failure */
- u_int32_t is_rx_auth_countermeasures;/* rx auth discard due to CM */
- u_int32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */
- u_int32_t is_rx_assoc_notauth; /* rx assoc w/o auth */
- u_int32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
- u_int32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */
- u_int32_t is_rx_assoc_badwpaie; /* rx assoc w/ bad WPA IE */
- u_int32_t is_rx_deauth; /* rx deauthentication */
- u_int32_t is_rx_disassoc; /* rx disassociation */
- u_int32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/
- u_int32_t is_rx_nobuf; /* rx failed for lack of buf */
- u_int32_t is_rx_decryptcrc; /* rx decrypt failed on crc */
- u_int32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/
- u_int32_t is_rx_bad_auth; /* rx bad auth request */
- u_int32_t is_rx_unauth; /* rx on unauthorized port */
- u_int32_t is_rx_badkeyid; /* rx w/ incorrect keyid */
- u_int32_t is_rx_ccmpreplay; /* rx seq# violation (CCMP) */
- u_int32_t is_rx_ccmpformat; /* rx format bad (CCMP) */
- u_int32_t is_rx_ccmpmic; /* rx MIC check failed (CCMP) */
- u_int32_t is_rx_tkipreplay; /* rx seq# violation (TKIP) */
- u_int32_t is_rx_tkipformat; /* rx format bad (TKIP) */
- u_int32_t is_rx_tkipmic; /* rx MIC check failed (TKIP) */
- u_int32_t is_rx_tkipicv; /* rx ICV check failed (TKIP) */
- u_int32_t is_rx_badcipher; /* rx failed due to of key type */
- u_int32_t is_rx_nocipherctx; /* rx failed due to key !setup */
- u_int32_t is_rx_acl; /* rx discard due to of acl policy */
- u_int32_t is_rx_ffcnt; /* rx fast frames */
- u_int32_t is_rx_badathtnl; /* driver key alloc failed */
- u_int32_t is_tx_nobuf; /* tx failed for lack of buf */
- u_int32_t is_tx_nonode; /* tx failed for no node */
- u_int32_t is_tx_unknownmgt; /* tx of unknown mgt frame */
- u_int32_t is_tx_badcipher; /* tx failed due to of key type */
- u_int32_t is_tx_nodefkey; /* tx failed due to no defkey */
- u_int32_t is_tx_noheadroom; /* tx failed due to no space */
- u_int32_t is_tx_ffokcnt; /* tx fast frames sent success */
- u_int32_t is_tx_fferrcnt; /* tx fast frames sent success */
- u_int32_t is_scan_active; /* active scans started */
- u_int32_t is_scan_passive; /* passive scans started */
- u_int32_t is_node_timeout; /* nodes timed out inactivity */
- u_int32_t is_crypto_nomem; /* no memory for crypto ctx */
- u_int32_t is_crypto_tkip; /* tkip crypto done in s/w */
- u_int32_t is_crypto_tkipenmic; /* tkip en-MIC done in s/w */
- u_int32_t is_crypto_tkipdemic; /* tkip de-MIC done in s/w */
- u_int32_t is_crypto_tkipcm; /* tkip counter measures */
- u_int32_t is_crypto_ccmp; /* ccmp crypto done in s/w */
- u_int32_t is_crypto_wep; /* wep crypto done in s/w */
- u_int32_t is_crypto_setkey_cipher;/* cipher rejected key */
- u_int32_t is_crypto_setkey_nokey;/* no key index for setkey */
- u_int32_t is_crypto_delkey; /* driver key delete failed */
- u_int32_t is_crypto_badcipher; /* unknown cipher */
- u_int32_t is_crypto_nocipher; /* cipher not available */
- u_int32_t is_crypto_attachfail; /* cipher attach failed */
- u_int32_t is_crypto_swfallback; /* cipher fallback to s/w */
- u_int32_t is_crypto_keyfail; /* driver key alloc failed */
- u_int32_t is_crypto_enmicfail; /* en-MIC failed */
- u_int32_t is_ibss_capmismatch; /* merge failed-cap mismatch */
- u_int32_t is_ibss_norate; /* merge failed-rate mismatch */
- u_int32_t is_ps_unassoc; /* ps-poll for unassoc. sta */
- u_int32_t is_ps_badaid; /* ps-poll w/ incorrect aid */
- u_int32_t is_ps_qempty; /* ps-poll w/ nothing to send */
+ u_int32_t is_rx_badversion; /* rx frame with bad version */
+ u_int32_t is_rx_tooshort; /* rx frame too short */
+ u_int32_t is_rx_wrongbss; /* rx from wrong bssid */
+ u_int32_t is_rx_dup; /* rx discard due to it's a dup */
+ u_int32_t is_rx_wrongdir; /* rx w/ wrong direction */
+ u_int32_t is_rx_mcastecho; /* rx discard due to of mcast echo */
+ u_int32_t is_rx_notassoc; /* rx discard due to sta !assoc */
+ u_int32_t is_rx_noprivacy; /* rx w/ wep but privacy off */
+ u_int32_t is_rx_unencrypted; /* rx w/o wep and privacy on */
+ u_int32_t is_rx_wepfail; /* rx wep processing failed */
+ u_int32_t is_rx_decap; /* rx decapsulation failed */
+ u_int32_t is_rx_mgtdiscard; /* rx discard mgt frames */
+ u_int32_t is_rx_ctl; /* rx discard ctrl frames */
+ u_int32_t is_rx_beacon; /* rx beacon frames */
+ u_int32_t is_rx_rstoobig; /* rx rate set truncated */
+ u_int32_t is_rx_elem_missing; /* rx required element missing*/
+ u_int32_t is_rx_elem_toobig; /* rx element too big */
+ u_int32_t is_rx_elem_toosmall; /* rx element too small */
+ u_int32_t is_rx_elem_unknown; /* rx element unknown */
+ u_int32_t is_rx_badchan; /* rx frame w/ invalid chan */
+ u_int32_t is_rx_chanmismatch; /* rx frame chan mismatch */
+ u_int32_t is_rx_nodealloc; /* rx frame dropped */
+ u_int32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */
+ u_int32_t is_rx_auth_unsupported; /* rx w/ unsupported auth alg */
+ u_int32_t is_rx_auth_fail; /* rx sta auth failure */
+ u_int32_t is_rx_auth_countermeasures; /* rx auth discard due to CM */
+ u_int32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */
+ u_int32_t is_rx_assoc_notauth; /* rx assoc w/o auth */
+ u_int32_t is_rx_assoc_capmismatch; /* rx assoc w/ cap mismatch */
+ u_int32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */
+ u_int32_t is_rx_assoc_badwpaie; /* rx assoc w/ bad WPA IE */
+ u_int32_t is_rx_deauth; /* rx deauthentication */
+ u_int32_t is_rx_disassoc; /* rx disassociation */
+ u_int32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/
+ u_int32_t is_rx_nobuf; /* rx failed for lack of buf */
+ u_int32_t is_rx_decryptcrc; /* rx decrypt failed on crc */
+ u_int32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/
+ u_int32_t is_rx_bad_auth; /* rx bad auth request */
+ u_int32_t is_rx_unauth; /* rx on unauthorized port */
+ u_int32_t is_rx_badkeyid; /* rx w/ incorrect keyid */
+ u_int32_t is_rx_ccmpreplay; /* rx seq# violation (CCMP) */
+ u_int32_t is_rx_ccmpformat; /* rx format bad (CCMP) */
+ u_int32_t is_rx_ccmpmic; /* rx MIC check failed (CCMP) */
+ u_int32_t is_rx_tkipreplay; /* rx seq# violation (TKIP) */
+ u_int32_t is_rx_tkipformat; /* rx format bad (TKIP) */
+ u_int32_t is_rx_tkipmic; /* rx MIC check failed (TKIP) */
+ u_int32_t is_rx_tkipicv; /* rx ICV check failed (TKIP) */
+ u_int32_t is_rx_badcipher; /* rx failed due to of key type */
+ u_int32_t is_rx_nocipherctx; /* rx failed due to key !setup */
+ u_int32_t is_rx_acl; /* rx discard due to of acl policy */
+ u_int32_t is_rx_ffcnt; /* rx fast frames */
+ u_int32_t is_rx_badathtnl; /* driver key alloc failed */
+ u_int32_t is_tx_nobuf; /* tx failed for lack of buf */
+ u_int32_t is_tx_nonode; /* tx failed for no node */
+ u_int32_t is_tx_unknownmgt; /* tx of unknown mgt frame */
+ u_int32_t is_tx_badcipher; /* tx failed due to of key type */
+ u_int32_t is_tx_nodefkey; /* tx failed due to no defkey */
+ u_int32_t is_tx_noheadroom; /* tx failed due to no space */
+ u_int32_t is_tx_ffokcnt; /* tx fast frames sent success */
+ u_int32_t is_tx_fferrcnt; /* tx fast frames sent success */
+ u_int32_t is_scan_active; /* active scans started */
+ u_int32_t is_scan_passive; /* passive scans started */
+ u_int32_t is_node_timeout; /* nodes timed out inactivity */
+ u_int32_t is_crypto_nomem; /* no memory for crypto ctx */
+ u_int32_t is_crypto_tkip; /* tkip crypto done in s/w */
+ u_int32_t is_crypto_tkipenmic; /* tkip en-MIC done in s/w */
+ u_int32_t is_crypto_tkipdemic; /* tkip de-MIC done in s/w */
+ u_int32_t is_crypto_tkipcm; /* tkip counter measures */
+ u_int32_t is_crypto_ccmp; /* ccmp crypto done in s/w */
+ u_int32_t is_crypto_wep; /* wep crypto done in s/w */
+ u_int32_t is_crypto_setkey_cipher; /* cipher rejected key */
+ u_int32_t is_crypto_setkey_nokey; /* no key index for setkey */
+ u_int32_t is_crypto_delkey; /* driver key delete failed */
+ u_int32_t is_crypto_badcipher; /* unknown cipher */
+ u_int32_t is_crypto_nocipher; /* cipher not available */
+ u_int32_t is_crypto_attachfail; /* cipher attach failed */
+ u_int32_t is_crypto_swfallback; /* cipher fallback to s/w */
+ u_int32_t is_crypto_keyfail; /* driver key alloc failed */
+ u_int32_t is_crypto_enmicfail; /* en-MIC failed */
+ u_int32_t is_ibss_capmismatch; /* merge failed-cap mismatch */
+ u_int32_t is_ibss_norate; /* merge failed-rate mismatch */
+ u_int32_t is_ps_unassoc; /* ps-poll for unassoc. sta */
+ u_int32_t is_ps_badaid; /* ps-poll w/ incorrect aid */
+ u_int32_t is_ps_qempty; /* ps-poll w/ nothing to send */
};
/*
* Retrieve per-node statistics.
*/
struct ieee80211req_sta_stats {
- union {
- /* NB: explicitly force 64-bit alignment */
- u_int8_t macaddr[IEEE80211_ADDR_LEN];
- u_int64_t pad;
- } is_u;
- struct ieee80211_nodestats is_stats;
+ union {
+ /* NB: explicitly force 64-bit alignment */
+ u_int8_t macaddr[IEEE80211_ADDR_LEN];
+ u_int64_t pad;
+ } is_u;
+ struct ieee80211_nodestats is_stats;
};
/*
* to retrieve other data like stats, unicast key, etc.
*/
struct ieee80211req_sta_info {
- u_int16_t isi_len; /* length (mult of 4) */
- u_int16_t isi_freq; /* MHz */
- u_int16_t isi_flags; /* channel flags */
- u_int16_t isi_state; /* state flags */
- u_int8_t isi_authmode; /* authentication algorithm */
- u_int8_t isi_rssi;
- u_int16_t isi_capinfo; /* capabilities */
- u_int8_t isi_athflags; /* Atheros capabilities */
- u_int8_t isi_erp; /* ERP element */
- u_int8_t isi_macaddr[IEEE80211_ADDR_LEN];
- u_int8_t isi_nrates; /* negotiated rates */
- u_int8_t isi_rates[IEEE80211_RATE_MAXSIZE];
- u_int8_t isi_txrate; /* index to isi_rates[] */
- u_int16_t isi_ie_len; /* IE length */
- u_int16_t isi_associd; /* assoc response */
- u_int16_t isi_txpower; /* current tx power */
- u_int16_t isi_vlan; /* vlan tag */
- u_int16_t isi_txseqs[17]; /* seq to be transmitted */
- u_int16_t isi_rxseqs[17]; /* seq previous for qos frames*/
- u_int16_t isi_inact; /* inactivity timer */
- u_int8_t isi_uapsd; /* UAPSD queues */
- u_int8_t isi_opmode; /* sta operating mode */
+ u_int16_t isi_len; /* length (mult of 4) */
+ u_int16_t isi_freq; /* MHz */
+ u_int16_t isi_flags; /* channel flags */
+ u_int16_t isi_state; /* state flags */
+ u_int8_t isi_authmode; /* authentication algorithm */
+ u_int8_t isi_rssi;
+ u_int16_t isi_capinfo; /* capabilities */
+ u_int8_t isi_athflags; /* Atheros capabilities */
+ u_int8_t isi_erp; /* ERP element */
+ u_int8_t isi_macaddr[IEEE80211_ADDR_LEN];
+ u_int8_t isi_nrates; /* negotiated rates */
+ u_int8_t isi_rates[IEEE80211_RATE_MAXSIZE];
+ u_int8_t isi_txrate; /* index to isi_rates[] */
+ u_int16_t isi_ie_len; /* IE length */
+ u_int16_t isi_associd; /* assoc response */
+ u_int16_t isi_txpower; /* current tx power */
+ u_int16_t isi_vlan; /* vlan tag */
+ u_int16_t isi_txseqs[17]; /* seq to be transmitted */
+ u_int16_t isi_rxseqs[17]; /* seq previous for qos frames*/
+ u_int16_t isi_inact; /* inactivity timer */
+ u_int8_t isi_uapsd; /* UAPSD queues */
+ u_int8_t isi_opmode; /* sta operating mode */
- /* XXX frag state? */
- /* variable length IE data */
+ /* XXX frag state? */
+ /* variable length IE data */
};
-
struct ath_stats {
- u_int32_t ast_watchdog; /* device reset by watchdog */
- u_int32_t ast_hardware; /* fatal hardware error interrupts */
- u_int32_t ast_bmiss; /* beacon miss interrupts */
- u_int32_t ast_rxorn; /* rx overrun interrupts */
- u_int32_t ast_rxeol; /* rx eol interrupts */
- u_int32_t ast_txurn; /* tx underrun interrupts */
- u_int32_t ast_mib; /* mib interrupts */
- u_int32_t ast_tx_packets; /* packet sent on the interface */
- u_int32_t ast_tx_mgmt; /* management frames transmitted */
- u_int32_t ast_tx_discard; /* frames discarded prior to assoc */
- u_int32_t ast_tx_invalid; /* frames discarded due to is device gone */
- u_int32_t ast_tx_qstop; /* tx queue stopped because it's full */
- u_int32_t ast_tx_encap; /* tx encapsulation failed */
- u_int32_t ast_tx_nonode; /* tx failed due to of no node */
- u_int32_t ast_tx_nobuf; /* tx failed due to of no tx buffer (data) */
- u_int32_t ast_tx_nobufmgt; /* tx failed due to of no tx buffer (mgmt)*/
- u_int32_t ast_tx_xretries; /* tx failed due to of too many retries */
- u_int32_t ast_tx_fifoerr; /* tx failed due to of FIFO underrun */
- u_int32_t ast_tx_filtered; /* tx failed due to xmit filtered */
- u_int32_t ast_tx_shortretry; /* tx on-chip retries (short) */
- u_int32_t ast_tx_longretry; /* tx on-chip retries (long) */
- u_int32_t ast_tx_badrate; /* tx failed due to of bogus xmit rate */
- u_int32_t ast_tx_noack; /* tx frames with no ack marked */
- u_int32_t ast_tx_rts; /* tx frames with rts enabled */
- u_int32_t ast_tx_cts; /* tx frames with cts enabled */
- u_int32_t ast_tx_shortpre; /* tx frames with short preamble */
- u_int32_t ast_tx_altrate; /* tx frames with alternate rate */
- u_int32_t ast_tx_protect; /* tx frames with protection */
- u_int32_t ast_rx_orn; /* rx failed due to of desc overrun */
- u_int32_t ast_rx_crcerr; /* rx failed due to of bad CRC */
- u_int32_t ast_rx_fifoerr; /* rx failed due to of FIFO overrun */
- u_int32_t ast_rx_badcrypt; /* rx failed due to of decryption */
- u_int32_t ast_rx_badmic; /* rx failed due to of MIC failure */
- u_int32_t ast_rx_phyerr; /* rx PHY error summary count */
- u_int32_t ast_rx_phy[32]; /* rx PHY error per-code counts */
- u_int32_t ast_rx_tooshort; /* rx discarded due to frame too short */
- u_int32_t ast_rx_toobig; /* rx discarded due to frame too large */
- u_int32_t ast_rx_nobuf; /* rx setup failed due to of no skbuff */
- u_int32_t ast_rx_packets; /* packet recv on the interface */
- u_int32_t ast_rx_mgt; /* management frames received */
- u_int32_t ast_rx_ctl; /* control frames received */
- int8_t ast_tx_rssi; /* tx rssi of last ack */
- int8_t ast_rx_rssi; /* rx rssi from histogram */
- u_int32_t ast_be_xmit; /* beacons transmitted */
- u_int32_t ast_be_nobuf; /* no skbuff available for beacon */
- u_int32_t ast_per_cal; /* periodic calibration calls */
- u_int32_t ast_per_calfail; /* periodic calibration failed */
- u_int32_t ast_per_rfgain; /* periodic calibration rfgain reset */
- u_int32_t ast_rate_calls; /* rate control checks */
- u_int32_t ast_rate_raise; /* rate control raised xmit rate */
- u_int32_t ast_rate_drop; /* rate control dropped xmit rate */
- u_int32_t ast_ant_defswitch; /* rx/default antenna switches */
- u_int32_t ast_ant_txswitch; /* tx antenna switches */
- u_int32_t ast_ant_rx[8]; /* rx frames with antenna */
- u_int32_t ast_ant_tx[8]; /* tx frames with antenna */
+ u_int32_t ast_watchdog; /* device reset by watchdog */
+ u_int32_t ast_hardware; /* fatal hardware error interrupts */
+ u_int32_t ast_bmiss; /* beacon miss interrupts */
+ u_int32_t ast_rxorn; /* rx overrun interrupts */
+ u_int32_t ast_rxeol; /* rx eol interrupts */
+ u_int32_t ast_txurn; /* tx underrun interrupts */
+ u_int32_t ast_mib; /* mib interrupts */
+ u_int32_t ast_tx_packets; /* packet sent on the interface */
+ u_int32_t ast_tx_mgmt; /* management frames transmitted */
+ u_int32_t ast_tx_discard; /* frames discarded prior to assoc */
+ u_int32_t ast_tx_invalid; /* frames discarded due to is device gone */
+ u_int32_t ast_tx_qstop; /* tx queue stopped because it's full */
+ u_int32_t ast_tx_encap; /* tx encapsulation failed */
+ u_int32_t ast_tx_nonode; /* tx failed due to of no node */
+ u_int32_t ast_tx_nobuf; /* tx failed due to of no tx buffer (data) */
+ u_int32_t ast_tx_nobufmgt; /* tx failed due to of no tx buffer (mgmt)*/
+ u_int32_t ast_tx_xretries; /* tx failed due to of too many retries */
+ u_int32_t ast_tx_fifoerr; /* tx failed due to of FIFO underrun */
+ u_int32_t ast_tx_filtered; /* tx failed due to xmit filtered */
+ u_int32_t ast_tx_shortretry; /* tx on-chip retries (short) */
+ u_int32_t ast_tx_longretry; /* tx on-chip retries (long) */
+ u_int32_t ast_tx_badrate; /* tx failed due to of bogus xmit rate */
+ u_int32_t ast_tx_noack; /* tx frames with no ack marked */
+ u_int32_t ast_tx_rts; /* tx frames with rts enabled */
+ u_int32_t ast_tx_cts; /* tx frames with cts enabled */
+ u_int32_t ast_tx_shortpre; /* tx frames with short preamble */
+ u_int32_t ast_tx_altrate; /* tx frames with alternate rate */
+ u_int32_t ast_tx_protect; /* tx frames with protection */
+ u_int32_t ast_rx_orn; /* rx failed due to of desc overrun */
+ u_int32_t ast_rx_crcerr; /* rx failed due to of bad CRC */
+ u_int32_t ast_rx_fifoerr; /* rx failed due to of FIFO overrun */
+ u_int32_t ast_rx_badcrypt; /* rx failed due to of decryption */
+ u_int32_t ast_rx_badmic; /* rx failed due to of MIC failure */
+ u_int32_t ast_rx_phyerr; /* rx PHY error summary count */
+ u_int32_t ast_rx_phy[32]; /* rx PHY error per-code counts */
+ u_int32_t ast_rx_tooshort; /* rx discarded due to frame too short */
+ u_int32_t ast_rx_toobig; /* rx discarded due to frame too large */
+ u_int32_t ast_rx_nobuf; /* rx setup failed due to of no skbuff */
+ u_int32_t ast_rx_packets; /* packet recv on the interface */
+ u_int32_t ast_rx_mgt; /* management frames received */
+ u_int32_t ast_rx_ctl; /* control frames received */
+ int8_t ast_tx_rssi; /* tx rssi of last ack */
+ int8_t ast_rx_rssi; /* rx rssi from histogram */
+ u_int32_t ast_be_xmit; /* beacons transmitted */
+ u_int32_t ast_be_nobuf; /* no skbuff available for beacon */
+ u_int32_t ast_per_cal; /* periodic calibration calls */
+ u_int32_t ast_per_calfail; /* periodic calibration failed */
+ u_int32_t ast_per_rfgain; /* periodic calibration rfgain reset */
+ u_int32_t ast_rate_calls; /* rate control checks */
+ u_int32_t ast_rate_raise; /* rate control raised xmit rate */
+ u_int32_t ast_rate_drop; /* rate control dropped xmit rate */
+ u_int32_t ast_ant_defswitch; /* rx/default antenna switches */
+ u_int32_t ast_ant_txswitch; /* tx antenna switches */
+ u_int32_t ast_ant_rx[8]; /* rx frames with antenna */
+ u_int32_t ast_ant_tx[8]; /* tx frames with antenna */
};
-#define SIOCGATHSTATS (SIOCDEVPRIVATE+0)
-#define SIOCGATHDIAG (SIOCDEVPRIVATE+1)
-#define SIOCGATHRADARSIG (SIOCDEVPRIVATE+2)
-#define SIOCGATHHALDIAG (SIOCDEVPRIVATE+3)
-#define SIOCG80211STATS (SIOCDEVPRIVATE+2)
+#define SIOCGATHSTATS (SIOCDEVPRIVATE + 0)
+#define SIOCGATHDIAG (SIOCDEVPRIVATE + 1)
+#define SIOCGATHRADARSIG (SIOCDEVPRIVATE + 2)
+#define SIOCGATHHALDIAG (SIOCDEVPRIVATE + 3)
+#define SIOCG80211STATS (SIOCDEVPRIVATE + 2)
/* NB: require in+out parameters so cannot use wireless extensions, yech */
-#define IEEE80211_IOCTL_GETKEY (SIOCDEVPRIVATE+3)
-#define IEEE80211_IOCTL_GETWPAIE (SIOCDEVPRIVATE+4)
-#define IEEE80211_IOCTL_STA_STATS (SIOCDEVPRIVATE+5)
-#define IEEE80211_IOCTL_STA_INFO (SIOCDEVPRIVATE+6)
-#define SIOC80211IFCREATE (SIOCDEVPRIVATE+7)
-#define SIOC80211IFDESTROY (SIOCDEVPRIVATE+8)
-#define IEEE80211_IOCTL_SCAN_RESULTS (SIOCDEVPRIVATE+9)
-
+#define IEEE80211_IOCTL_GETKEY (SIOCDEVPRIVATE + 3)
+#define IEEE80211_IOCTL_GETWPAIE (SIOCDEVPRIVATE + 4)
+#define IEEE80211_IOCTL_STA_STATS (SIOCDEVPRIVATE + 5)
+#define IEEE80211_IOCTL_STA_INFO (SIOCDEVPRIVATE + 6)
+#define SIOC80211IFCREATE (SIOCDEVPRIVATE + 7)
+#define SIOC80211IFDESTROY (SIOCDEVPRIVATE + 8)
+#define IEEE80211_IOCTL_SCAN_RESULTS (SIOCDEVPRIVATE + 9)
#endif
} /* }}} int mec_match */
void module_register(void) {
- fc_register_match(
- "empty_counter",
- (match_proc_t){
- .create = mec_create, .destroy = mec_destroy, .match = mec_match,
- });
+ fc_register_match("empty_counter", (match_proc_t){
+ .create = mec_create,
+ .destroy = mec_destroy,
+ .match = mec_match,
+ });
} /* module_register */
static int socket_receive(socket_adapter_t *self, FILE **p_file);
static mcelog_config_t g_mcelog_config = {
- .logfile = "/var/log/mcelog", .persist = false,
+ .logfile = "/var/log/mcelog",
+ .persist = false,
};
static socket_adapter_t socket_adapter = {
.sock_fd = -1,
.unix_sock =
{
- .sun_family = AF_UNIX, .sun_path = "/var/run/mcelog-client",
+ .sun_family = AF_UNIX,
+ .sun_path = "/var/run/mcelog-client",
},
.lock = PTHREAD_RWLOCK_INITIALIZER,
.close = socket_close,
int res = -1;
pthread_rwlock_rdlock(&self->lock);
struct pollfd poll_fd = {
- .fd = self->sock_fd, .events = POLLIN | POLLPRI,
+ .fd = self->sock_fd,
+ .events = POLLIN | POLLPRI,
};
if ((res = poll(&poll_fd, 1, MCELOG_POLL_TIMEOUT)) <= 0) {
/* Wait until connection establishes */
struct pollfd pollfd = {
- .fd = fd, .events = POLLOUT,
+ .fd = fd,
+ .events = POLLOUT,
};
do
status = poll(&pollfd, 1, MEMCACHED_CONNECT_TIMEOUT);
}
struct pollfd pollfd = {
- .fd = st->fd, .events = POLLOUT,
+ .fd = st->fd,
+ .events = POLLOUT,
};
do
derive_t value0, derive_t value1, memcached_t *st) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = value0}, {.derive = value1},
+ {.derive = value0},
+ {.derive = value1},
};
memcached_init_vl(&vl, st);
gauge_t value0, gauge_t value1, memcached_t *st) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.gauge = value0}, {.gauge = value1},
+ {.gauge = value0},
+ {.gauge = value1},
};
memcached_init_vl(&vl, st);
/* callback = */ memcached_read,
/* interval = */ 0,
&(user_data_t){
- .data = st, .free_func = memcached_free,
+ .data = st,
+ .free_func = memcached_free,
});
} /* int memcached_add_read_callback */
#if HAVE_HOST_STATISTICS
port_host = mach_host_self();
host_page_size(port_host, &pagesize);
-/* #endif HAVE_HOST_STATISTICS */
+ /* #endif HAVE_HOST_STATISTICS */
#elif HAVE_SYSCTLBYNAME
/* no init stuff */
return -1;
}
-/* #endif HAVE_LIBKSTAT */
+ /* #endif HAVE_LIBKSTAT */
#elif HAVE_SYSCTL
pagesize = getpagesize();
ERROR("memory plugin: Invalid pagesize: %i", pagesize);
return -1;
}
-/* #endif HAVE_SYSCTL */
+ /* #endif HAVE_SYSCTL */
#elif HAVE_LIBSTATGRAB
/* no init stuff */
MEMORY_SUBMIT("wired", wired, "active", active, "inactive", inactive, "free",
free);
-/* #endif HAVE_HOST_STATISTICS */
+ /* #endif HAVE_HOST_STATISTICS */
#elif HAVE_SYSCTLBYNAME
/*
(gauge_t)sysctl_vals[3], "active", (gauge_t)sysctl_vals[4],
"inactive", (gauge_t)sysctl_vals[5], "cache",
(gauge_t)sysctl_vals[6]);
-/* #endif HAVE_SYSCTLBYNAME */
+ /* #endif HAVE_SYSCTLBYNAME */
#elif KERNEL_LINUX
FILE *fh;
else
MEMORY_SUBMIT("used", mem_used, "buffered", mem_buffered, "cached",
mem_cached, "free", mem_free, "slab", mem_slab_total);
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
/* Most of the additions here were taken as-is from the k9toolkit from
MEMORY_SUBMIT("used", (gauge_t)mem_used, "free", (gauge_t)mem_free, "locked",
(gauge_t)mem_lock, "kernel", (gauge_t)mem_kern, "arc",
(gauge_t)arcsize, "unusable", (gauge_t)mem_unus);
-/* #endif HAVE_LIBKSTAT */
+ /* #endif HAVE_LIBKSTAT */
#elif HAVE_SYSCTL
int mib[] = {CTL_VM, VM_METER};
MEMORY_SUBMIT("active", mem_active, "inactive", mem_inactive, "free",
mem_free);
-/* #endif HAVE_SYSCTL */
+ /* #endif HAVE_SYSCTL */
#elif HAVE_LIBSTATGRAB
sg_mem_stats *ios;
MEMORY_SUBMIT("used", (gauge_t)ios->used, "cached", (gauge_t)ios->cache,
"free", (gauge_t)ios->free);
-/* #endif HAVE_LIBSTATGRAB */
+ /* #endif HAVE_LIBSTATGRAB */
#elif HAVE_PERFSTAT
perfstat_memory_total_t pmemory = {0};
host->is_connected = true;
return 0;
} /* }}} int mb_init_connection */
-/* #endif LEGACY_LIBMODBUS */
+ /* #endif LEGACY_LIBMODBUS */
#else /* if !LEGACY_LIBMODBUS */
/* Version 2.9.2 */
/* 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);
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,
/* 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);
/* 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;
return 0;
} /* }}} int parse_part_sign_sha256 */
-/* #endif HAVE_GCRYPT_H */
+ /* #endif HAVE_GCRYPT_H */
#else /* if !HAVE_GCRYPT_H */
static int parse_part_sign_sha256(sockent_t *se, /* {{{ */
return 0;
} /* }}} int parse_part_encr_aes256 */
-/* #endif HAVE_GCRYPT_H */
+ /* #endif HAVE_GCRYPT_H */
#else /* if !HAVE_GCRYPT_H */
static int parse_part_encr_aes256(sockent_t *se, /* {{{ */
ERROR("network plugin: setsockopt (bind-if): %s", STRERRNO);
return -1;
}
-/* #endif HAVE_IF_INDEXTONAME && SO_BINDTODEVICE */
+ /* #endif HAVE_IF_INDEXTONAME && SO_BINDTODEVICE */
#else
WARNING("network plugin: Cannot set the interface on a unicast "
#if KERNEL_LINUX
static int nfs_init(void) { return 0; }
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
static int nfs_init(void) {
return 0;
}
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
static int nfs_read(void) {
/* name = */ cb_name,
/* callback = */ nut_read,
/* interval = */ 0,
- /* user_data = */ &(user_data_t){
- .data = ups, .free_func = free_nut_ups_t,
+ /* user_data = */
+ &(user_data_t){
+ .data = ups,
+ .free_func = free_nut_ups_t,
});
sfree(cb_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 */
}
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,
/* Find offset of PCI Express Capability Structure
* in PCI configuration space.
* Returns offset, -1 if not found.
-**/
+ **/
static int pcie_find_cap_exp(pcie_device_t *dev) {
int pos = pcie_read8(dev, PCI_CAPABILITY_LIST) & ~3;
/* Find offset of Advanced Error Reporting Capability.
* Returns AER offset, -1 if not found.
-**/
+ **/
static int pcie_find_ecap_aer(pcie_device_t *dev) {
int pos = PCIE_ECAP_OFFSET;
uint32_t header = pcie_read32(dev, pos);
pset_list_len = 0;
return -1;
}
-/* #endif HAVE_THREAD_INFO */
+ /* #endif HAVE_THREAD_INFO */
#elif KERNEL_LINUX
pagesize_g = sysconf(_SC_PAGESIZE);
}
}
#endif
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBKVM_GETPROCS && \
(HAVE_STRUCT_KINFO_PROC_FREEBSD || HAVE_STRUCT_KINFO_PROC_OPENBSD)
pagesize = getpagesize();
-/* #endif HAVE_LIBKVM_GETPROCS && (HAVE_STRUCT_KINFO_PROC_FREEBSD ||
- * HAVE_STRUCT_KINFO_PROC_OPENBSD) */
+ /* #endif HAVE_LIBKVM_GETPROCS && (HAVE_STRUCT_KINFO_PROC_FREEBSD ||
+ * HAVE_STRUCT_KINFO_PROC_OPENBSD) */
#elif HAVE_PROCINFO_H
pagesize = getpagesize();
/*
* TODO: context switch counters for Solaris
-*/
+ */
ps->cswitch_vol = -1;
ps->cswitch_invol = -1;
for (ps = list_head_g; ps != NULL; ps = ps->next)
ps_submit_proc_list(ps);
-/* #endif HAVE_THREAD_INFO */
+ /* #endif HAVE_THREAD_INFO */
#elif KERNEL_LINUX
int running = 0;
ps_submit_proc_list(ps_ptr);
read_fork_rate();
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
int running = 0;
for (procstat_t *ps_ptr = list_head_g; ps_ptr != NULL; ps_ptr = ps_ptr->next)
ps_submit_proc_list(ps_ptr);
-/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
+ /* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_OPENBSD
int running = 0;
for (procstat_t *ps_ptr = list_head_g; ps_ptr != NULL; ps_ptr = ps_ptr->next)
ps_submit_proc_list(ps_ptr);
-/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_OPENBSD */
+ /* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_OPENBSD */
#elif HAVE_PROCINFO_H
/* AIX */
for (procstat_t *ps = list_head_g; ps != NULL; ps = ps->next)
ps_submit_proc_list(ps);
-/* #endif HAVE_PROCINFO_H */
+ /* #endif HAVE_PROCINFO_H */
#elif KERNEL_SOLARIS
/*
* Global variables
*/
static const char *config_keys[] = {
- "Value", "IgnoreSelected",
+ "Value",
+ "IgnoreSelected",
};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
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;
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 */
}
char *values_array[2] = {
- [0] = values, [1] = NULL,
+ [0] = values,
+ [1] = NULL,
};
while (42) {
return status;
} /* int srrd_update */
-/* #endif HAVE_THREADSAFE_LIBRRD */
+ /* #endif HAVE_THREADSAFE_LIBRRD */
#else /* !HAVE_THREADSAFE_LIBRRD */
static int srrd_update(char *filename, char *template, int argc,
last_feature = fl;
} /* while sensors_get_all_features */
} /* while sensors_get_detected_chips */
-/* #endif SENSORS_API_VERSION < 0x400 */
+ /* #endif SENSORS_API_VERSION < 0x400 */
#elif (SENSORS_API_VERSION >= 0x400)
chip_num = 0;
sensors_submit(plugin_instance, sensor_type_name_map[fl->type],
type_instance, value);
} /* for fl = first_feature .. NULL */
-/* #endif SENSORS_API_VERSION < 0x400 */
+ /* #endif SENSORS_API_VERSION < 0x400 */
#elif (SENSORS_API_VERSION >= 0x400)
for (featurelist_t *fl = first_feature; fl != NULL; fl = fl->next) {
static void serial_submit(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;
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.");
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;
{
#if KERNEL_LINUX
pagesize = (derive_t)sysconf(_SC_PAGESIZE);
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS
/* getpagesize(3C) tells me this does not fail.. */
pagesize = (derive_t)getpagesize();
-/* #endif HAVE_SWAPCTL */
+ /* #endif HAVE_SWAPCTL */
#elif defined(VM_SWAPUSAGE)
/* No init stuff */
ERROR("swap plugin: kvm_openfiles failed, %s", errbuf);
return -1;
}
-/* #endif HAVE_LIBKVM_GETSWAPINFO */
+ /* #endif HAVE_LIBKVM_GETSWAPINFO */
#elif HAVE_LIBSTATGRAB
/* No init stuff */
status = plugin_register_complex_read(
NULL, cb_name, tcsv_read, interval,
&(user_data_t){
- .data = id, .free_func = tcsv_instance_definition_destroy,
+ .data = id,
+ .free_func = tcsv_instance_definition_destroy,
});
if (status != 0) {
ERROR("tail_csv plugin: Registering complex read function failed.");
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;
#if TCP_STATE_MIN > 0
|| (state < TCP_STATE_MIN)
#endif
- ) {
+ ) {
NOTICE("tcpconns plugin: Ignoring connection with "
"unknown state 0x%02" PRIx8 ".",
state);
return 0;
} /* int conn_read_file */
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_SYSCTLBYNAME
-/* #endif HAVE_SYSCTLBYNAME */
+ /* #endif HAVE_SYSCTLBYNAME */
#elif HAVE_LIBKVM_NLIST
#endif /* HAVE_LIBKVM_NLIST */
return 0;
} /* int conn_read */
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_SYSCTLBYNAME
static int conn_read(void) {
return 0;
}
-/* int conn_read */
-/* #endif HAVE_KVM_GETFILES */
+ /* int conn_read */
+ /* #endif HAVE_KVM_GETFILES */
#elif HAVE_LIBKVM_NLIST
static int kread(u_long addr, void *buf, int size) {
return 0;
}
-/* #endif HAVE_LIBKVM_NLIST */
+ /* #endif HAVE_LIBKVM_NLIST */
#elif KERNEL_AIX
*/
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
vl.values = values;
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.",
+ 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 "
((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.",
+ 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",
(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.",
+ 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",
package_delta = NULL;
}
-/**********************
- * Collectd functions *
- **********************/
+ /**********************
+ * Collectd functions *
+ **********************/
#define DO_OR_GOTO_ERR(something) \
do { \
}
result = (time_t)info.uptime;
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
kstat_t *ksp;
}
result = time(NULL) - (time_t)knp->value.ui32;
-/* #endif HAVE_LIBKSTAT */
+ /* #endif HAVE_LIBKSTAT */
#elif HAVE_SYS_SYSCTL_H
struct timeval boottv = {0};
}
result = time(NULL) - boottv.tv_sec;
-/* #endif HAVE_SYS_SYSCTL_H */
+ /* #endif HAVE_SYS_SYSCTL_H */
#elif HAVE_PERFSTAT
int status;
endutxent();
users_submit(users);
-/* #endif HAVE_GETUTXENT */
+ /* #endif HAVE_GETUTXENT */
#elif HAVE_GETUTENT
unsigned int users = 0;
endutent();
users_submit(users);
-/* #endif HAVE_GETUTENT */
+ /* #endif HAVE_GETUTENT */
#elif HAVE_LIBSTATGRAB
sg_user_stats *us;
#else
us->num_entries);
#endif
-/* #endif HAVE_LIBSTATGRAB */
+ /* #endif HAVE_LIBSTATGRAB */
#else
#error "No applicable input method."
} parse_data[] = {
/* Valid FLUSH commands. */
{
- "FLUSH", NULL, CMD_OK, CMD_FLUSH,
+ "FLUSH",
+ NULL,
+ CMD_OK,
+ CMD_FLUSH,
},
{
- "FLUSH identifier=myhost/magic/MAGIC", NULL, CMD_OK, CMD_FLUSH,
+ "FLUSH identifier=myhost/magic/MAGIC",
+ NULL,
+ CMD_OK,
+ CMD_FLUSH,
},
{
- "FLUSH identifier=magic/MAGIC", &default_host_opts, CMD_OK, CMD_FLUSH,
+ "FLUSH identifier=magic/MAGIC",
+ &default_host_opts,
+ CMD_OK,
+ CMD_FLUSH,
},
{
- "FLUSH timeout=123 plugin=\"A\"", NULL, CMD_OK, CMD_FLUSH,
+ "FLUSH timeout=123 plugin=\"A\"",
+ NULL,
+ CMD_OK,
+ CMD_FLUSH,
},
/* Invalid FLUSH commands. */
{
/* Missing hostname; no default. */
- "FLUSH identifier=magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "FLUSH identifier=magic/MAGIC",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
/* Missing 'identifier' key. */
- "FLUSH myhost/magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "FLUSH myhost/magic/MAGIC",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
/* Invalid timeout. */
- "FLUSH timeout=A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "FLUSH timeout=A",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
/* Invalid identifier. */
- "FLUSH identifier=invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "FLUSH identifier=invalid",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
/* Invalid option. */
- "FLUSH invalid=option", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "FLUSH invalid=option",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
/* Valid GETVAL commands. */
{
- "GETVAL myhost/magic/MAGIC", NULL, CMD_OK, CMD_GETVAL,
+ "GETVAL myhost/magic/MAGIC",
+ NULL,
+ CMD_OK,
+ CMD_GETVAL,
},
{
- "GETVAL magic/MAGIC", &default_host_opts, CMD_OK, CMD_GETVAL,
+ "GETVAL magic/MAGIC",
+ &default_host_opts,
+ CMD_OK,
+ CMD_GETVAL,
},
/* Invalid GETVAL commands. */
{
- "GETVAL magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "GETVAL magic/MAGIC",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "GETVAL", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "GETVAL",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "GETVAL invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "GETVAL invalid",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
/* Valid LISTVAL commands. */
{
- "LISTVAL", NULL, CMD_OK, CMD_LISTVAL,
+ "LISTVAL",
+ NULL,
+ CMD_OK,
+ CMD_LISTVAL,
},
/* Invalid LISTVAL commands. */
{
- "LISTVAL invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "LISTVAL invalid",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
/* Valid PUTVAL commands. */
{
- "PUTVAL magic/MAGIC N:42", &default_host_opts, CMD_OK, CMD_PUTVAL,
+ "PUTVAL magic/MAGIC N:42",
+ &default_host_opts,
+ CMD_OK,
+ CMD_PUTVAL,
},
{
- "PUTVAL myhost/magic/MAGIC N:42", NULL, CMD_OK, CMD_PUTVAL,
+ "PUTVAL myhost/magic/MAGIC N:42",
+ NULL,
+ CMD_OK,
+ CMD_PUTVAL,
},
{
- "PUTVAL myhost/magic/MAGIC 1234:42", NULL, CMD_OK, CMD_PUTVAL,
+ "PUTVAL myhost/magic/MAGIC 1234:42",
+ NULL,
+ CMD_OK,
+ CMD_PUTVAL,
},
{
- "PUTVAL myhost/magic/MAGIC 1234:42 2345:23", NULL, CMD_OK, CMD_PUTVAL,
+ "PUTVAL myhost/magic/MAGIC 1234:42 2345:23",
+ NULL,
+ CMD_OK,
+ CMD_PUTVAL,
},
{
- "PUTVAL myhost/magic/MAGIC interval=2 1234:42", NULL, CMD_OK,
+ "PUTVAL myhost/magic/MAGIC interval=2 1234:42",
+ NULL,
+ CMD_OK,
CMD_PUTVAL,
},
{
- "PUTVAL myhost/magic/MAGIC interval=2 1234:42 interval=5 2345:23", NULL,
- CMD_OK, CMD_PUTVAL,
+ "PUTVAL myhost/magic/MAGIC interval=2 1234:42 interval=5 2345:23",
+ NULL,
+ CMD_OK,
+ CMD_PUTVAL,
},
/* Invalid PUTVAL commands. */
{
- "PUTVAL magic/MAGIC N:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "PUTVAL magic/MAGIC N:42",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "PUTVAL", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "PUTVAL",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "PUTVAL invalid N:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "PUTVAL invalid N:42",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "PUTVAL myhost/magic/MAGIC A:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "PUTVAL myhost/magic/MAGIC A:42",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "PUTVAL myhost/magic/MAGIC 1234:A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "PUTVAL myhost/magic/MAGIC 1234:A",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "PUTVAL myhost/magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "PUTVAL myhost/magic/MAGIC",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "PUTVAL 1234:A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
+ "PUTVAL 1234:A",
+ NULL,
+ CMD_PARSE_ERROR,
+ CMD_UNKNOWN,
},
{
- "PUTVAL myhost/magic/UNKNOWN 1234:42", NULL, CMD_PARSE_ERROR,
+ "PUTVAL myhost/magic/UNKNOWN 1234:42",
+ NULL,
+ CMD_PARSE_ERROR,
CMD_UNKNOWN,
},
/*
/* Invalid commands. */
{
- "INVALID", NULL, CMD_UNKNOWN_COMMAND, CMD_UNKNOWN,
+ "INVALID",
+ NULL,
+ CMD_UNKNOWN_COMMAND,
+ CMD_UNKNOWN,
},
{
- "INVALID interval=2", NULL, CMD_UNKNOWN_COMMAND, CMD_UNKNOWN,
+ "INVALID interval=2",
+ NULL,
+ CMD_UNKNOWN_COMMAND,
+ CMD_UNKNOWN,
},
};
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])",
+ 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,
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 */
#endif /* HAVE_HTONLL */
#if FP_LAYOUT_NEED_NOTHING
-/* Well, we need nothing.. */
-/* #endif FP_LAYOUT_NEED_NOTHING */
+ /* Well, we need nothing.. */
+ /* #endif FP_LAYOUT_NEED_NOTHING */
#elif FP_LAYOUT_NEED_ENDIANFLIP || FP_LAYOUT_NEED_INTSWAP
#if FP_LAYOUT_NEED_ENDIANFLIP
return 1; /* Success */
} /* int handle_ipv6 */
-/* #endif HAVE_IPV6 */
+ /* #endif HAVE_IPV6 */
#else /* if !HAVE_IPV6 */
static int handle_ipv6(__attribute__((unused)) void *pkg,
/* 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,
}
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");
static int expect_json_labels(char *json, label_t *labels, size_t labels_num) {
yajl_callbacks funcs = {
- .yajl_string = test_string, .yajl_map_key = test_map_key,
+ .yajl_string = test_string,
+ .yajl_map_key = test_map_key,
};
test_case_t c = {labels, labels_num, NULL};
DEF_TEST(sd_format_metric_descriptor) {
value_list_t vl = {
- .host = "example.com", .plugin = "unit-test", .type = "example",
+ .host = "example.com",
+ .plugin = "unit-test",
+ .type = "example",
};
char got[1024];
.ds_num = 1,
.ds =
&(data_source_t){
- .name = "value", .type = DS_TYPE_GAUGE, .min = NAN, .max = NAN,
+ .name = "value",
+ .type = DS_TYPE_GAUGE,
+ .min = NAN,
+ .max = NAN,
},
};
EXPECT_EQ_INT(
};
/*
-* Histogram represents the distribution of data, it has a list of "bins".
-* Each bin represents an interval and has a count (frequency) of
-* number of values fall within its interval.
-*
-* Histogram's range is determined by the number of bins and the bin width,
-* There are 1000 bins and all bins have the same width of default 1 millisecond.
-* When a value above this range is added, Histogram's range is increased by
-* increasing the bin width (note that number of bins remains always at 1000).
-* This operation of increasing bin width is little expensive as each bin need
-* to be visited to update its count. To reduce frequent change of bin width,
-* new bin width will be the next nearest power of 2. Example: 2, 4, 8, 16, 32,
-* 64, 128, 256, 512, 1024, 2048, 5086, ...
-*
-* So, if the required bin width is 300, then new bin width will be 512 as it is
-* the next nearest power of 2.
-*/
+ * Histogram represents the distribution of data, it has a list of "bins".
+ * Each bin represents an interval and has a count (frequency) of
+ * number of values fall within its interval.
+ *
+ * Histogram's range is determined by the number of bins and the bin width,
+ * There are 1000 bins and all bins have the same width of default 1
+ * millisecond. When a value above this range is added, Histogram's range is
+ * increased by increasing the bin width (note that number of bins remains
+ * always at 1000). This operation of increasing bin width is little expensive
+ * as each bin need to be visited to update its count. To reduce frequent change
+ * of bin width, new bin width will be the next nearest power of 2. Example: 2,
+ * 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 5086, ...
+ *
+ * So, if the required bin width is 300, then new bin width will be 512 as it is
+ * the next nearest power of 2.
+ */
static void change_bin_width(latency_counter_t *lc, cdtime_t latency) /* {{{ */
{
/* This function is called because the new value is above histogram's range.
int latency_config_copy(latency_config_t *dst, const latency_config_t src) {
*dst = (latency_config_t){
- .percentile_num = src.percentile_num, .buckets_num = src.buckets_num,
+ .percentile_num = src.percentile_num,
+ .buckets_num = src.buckets_num,
};
dst->percentile = calloc(dst->percentile_num, sizeof(*dst->percentile));
} cases[] = {
{
// bucket 6 is zero
- DOUBLE_TO_CDTIME_T_STATIC(0.750), DOUBLE_TO_CDTIME_T_STATIC(0.875),
+ DOUBLE_TO_CDTIME_T_STATIC(0.750),
+ DOUBLE_TO_CDTIME_T_STATIC(0.875),
0.00,
},
{
// bucket 7 contains the t=1 update
- DOUBLE_TO_CDTIME_T_STATIC(0.875), DOUBLE_TO_CDTIME_T_STATIC(1.000),
+ DOUBLE_TO_CDTIME_T_STATIC(0.875),
+ DOUBLE_TO_CDTIME_T_STATIC(1.000),
1.00,
},
{
// range: bucket 7 - bucket 15; contains the t=1 and t=2 updates
- DOUBLE_TO_CDTIME_T_STATIC(0.875), DOUBLE_TO_CDTIME_T_STATIC(2.000),
+ DOUBLE_TO_CDTIME_T_STATIC(0.875),
+ DOUBLE_TO_CDTIME_T_STATIC(2.000),
2.00,
},
{
// lower bucket is only partially applied
DOUBLE_TO_CDTIME_T_STATIC(0.875 + (0.125 / 4)),
- DOUBLE_TO_CDTIME_T_STATIC(2.000), 1.75,
+ DOUBLE_TO_CDTIME_T_STATIC(2.000),
+ 1.75,
},
{
// upper bucket is only partially applied
DOUBLE_TO_CDTIME_T_STATIC(0.875),
- DOUBLE_TO_CDTIME_T_STATIC(2.000 - (0.125 / 4)), 1.75,
+ DOUBLE_TO_CDTIME_T_STATIC(2.000 - (0.125 / 4)),
+ 1.75,
},
{
// both buckets are only partially applied
DOUBLE_TO_CDTIME_T_STATIC(0.875 + (0.125 / 4)),
- DOUBLE_TO_CDTIME_T_STATIC(2.000 - (0.125 / 4)), 1.50,
+ DOUBLE_TO_CDTIME_T_STATIC(2.000 - (0.125 / 4)),
+ 1.50,
},
{
// lower bound is unspecified
- 0, DOUBLE_TO_CDTIME_T_STATIC(2.000), 2.00,
+ 0,
+ DOUBLE_TO_CDTIME_T_STATIC(2.000),
+ 2.00,
},
{
// upper bound is unspecified
- DOUBLE_TO_CDTIME_T_STATIC(125.000 - 0.125), 0, 1.00,
+ DOUBLE_TO_CDTIME_T_STATIC(125.000 - 0.125),
+ 0,
+ 1.00,
},
{
// overflow test: upper >> longest latency
- DOUBLE_TO_CDTIME_T_STATIC(1.000), DOUBLE_TO_CDTIME_T_STATIC(999999),
+ DOUBLE_TO_CDTIME_T_STATIC(1.000),
+ DOUBLE_TO_CDTIME_T_STATIC(999999),
124.00,
},
{
// overflow test: lower > longest latency
- DOUBLE_TO_CDTIME_T_STATIC(130), 0, 0.00,
+ DOUBLE_TO_CDTIME_T_STATIC(130),
+ 0,
+ 0.00,
},
{
// lower > upper => error
- DOUBLE_TO_CDTIME_T_STATIC(10), DOUBLE_TO_CDTIME_T_STATIC(9), NAN,
+ DOUBLE_TO_CDTIME_T_STATIC(10),
+ DOUBLE_TO_CDTIME_T_STATIC(9),
+ NAN,
},
{
// lower == upper => zero
- DOUBLE_TO_CDTIME_T_STATIC(9), DOUBLE_TO_CDTIME_T_STATIC(9), 0.00,
+ DOUBLE_TO_CDTIME_T_STATIC(9),
+ DOUBLE_TO_CDTIME_T_STATIC(9),
+ 0.00,
},
};
*
* Author:
* Niki W. Waibel <niki.waibel@gmx.net>
-**/
+ **/
#if HAVE_CONFIG_H
#include "config.h"
if (isdigit((int)s[-1])) {
/*
- * Note: this is a heuristic only - there is no reason
- * why these devices should live in /dev.
- * Perhaps this directory should be specifiable by option.
- * One might for example have /devlabel with links to /dev
- * for the devices that may be accessed in this way.
- * (This is useful, if the cdrom on /dev/hdc must not
- * be accessed.)
- */
+ * Note: this is a heuristic only - there is no reason
+ * why these devices should live in /dev.
+ * Perhaps this directory should be specifiable by option.
+ * One might for example have /devlabel with links to /dev
+ * for the devices that may be accessed in this way.
+ * (This is useful, if the cdrom on /dev/hdc must not
+ * be accessed.)
+ */
snprintf(device, sizeof(device), "%s/%s", DEVLABELDIR, ptname);
if (!get_label_uuid(device, &label, uuid)) {
uuidcache_addentry(sstrdup(device), label, uuid);
#elif HAVE_SEQ_GETMNTENT
#warn "This version of `getmntent' hat not yet been implemented!"
-/* #endif HAVE_SEQ_GETMNTENT */
+ /* #endif HAVE_SEQ_GETMNTENT */
#elif HAVE_GETMNTENT_R
static cu_mount_t *cu_mount_getmntent(void) {
*
* Author:
* Niki W. Waibel <niki.waibel@gmx.net>
-**/
+ **/
/* See below for instructions how to use the public functions. */
} cases[] = {
{
"{\"access_token\":\"MaeC6kaePhie1ree\",\"expires_in\":3600}",
- /* status = */ 0, "MaeC6kaePhie1ree", TIME_T_TO_CDTIME_T_STATIC(3600),
+ /* status = */ 0,
+ "MaeC6kaePhie1ree",
+ TIME_T_TO_CDTIME_T_STATIC(3600),
},
{
"{\"token_type\":\"Bearer\",\"expires_in\":1800,\"access_token\":"
"\"aeThiebee2gushuY\"}",
- /* status = */ 0, "aeThiebee2gushuY", TIME_T_TO_CDTIME_T_STATIC(1800),
+ /* status = */ 0,
+ "aeThiebee2gushuY",
+ TIME_T_TO_CDTIME_T_STATIC(1800),
},
{
"{\"ignored_key\":\"uaph5aewaeghi1Ge\",\"expires_in\":3600}",
- /* status = */ -1, NULL, 0,
+ /* status = */ -1,
+ NULL,
+ 0,
},
{
/* expires_in missing */
"{\"access_token\":\"shaephohbie9Ahch\"}",
- /* status = */ -1, NULL, 0,
+ /* status = */ -1,
+ NULL,
+ 0,
},
};
* RETURN VALUE
* On success, the number of read bytes (includes stripped \n).
* -1 on file open error
-*/
+ */
static int read_proc_name(const char *procfs_path,
const struct dirent *pid_entry, char *name,
const size_t out_size) {
return status;
} /* }}} int srrd_create */
-/* #endif HAVE_THREADSAFE_LIBRRD */
+ /* #endif HAVE_THREADSAFE_LIBRRD */
#else /* !HAVE_THREADSAFE_LIBRRD */
static int srrd_create(const char *filename, /* {{{ */
struct genlmsghdr *genh = mnl_nlmsg_put_extra_header(nlh, sizeof(*genh));
*genh = (struct genlmsghdr){
- .cmd = CTRL_CMD_GETFAMILY, .version = 0x01,
+ .cmd = CTRL_CMD_GETFAMILY,
+ .version = 0x01,
};
mnl_attr_put_strz(nlh, CTRL_ATTR_FAMILY_NAME, TASKSTATS_GENL_NAME);
*
* RETURN VALUE
* Zero on success, nonzero on failure.
-*/
+ */
int tail_match_read(cu_tail_match_t *obj);
/* 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);
/* 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 */
const char *namespace = NULL;
if (hm_ns == NULL) {
namespace = "http://openstack.org/xmlns/libvirt/nova/1.0";
- } else {
+ } // namespace =hm_ns;
+ else {
namespace = hm_ns;
}
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));
}
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));
}
static void submit_two(const char *plugin_instance, const char *type,
const char *type_instance, derive_t c0, derive_t c1) {
value_t values[] = {
- {.derive = c0}, {.derive = c1},
+ {.derive = c0},
+ {.derive = c1},
};
submit(plugin_instance, type, type_instance, values,
derive_t tx) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
vl.values = values;
gauge_t lnum) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.gauge = snum}, {.gauge = mnum}, {.gauge = lnum},
+ {.gauge = snum},
+ {.gauge = mnum},
+ {.gauge = lnum},
};
vl.values = values;
plugin_register_write(callback_name, wg_write,
&(user_data_t){
- .data = cb, .free_func = wg_callback_free,
+ .data = cb,
+ .free_func = wg_callback_free,
});
plugin_register_flush(callback_name, wg_flush, &(user_data_t){.data = cb});
callback_name, cb->location);
user_data_t user_data = {
- .data = cb, .free_func = wh_callback_free,
+ .data = cb,
+ .free_func = wh_callback_free,
};
if (cb->send_metrics) {
ssnprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
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.",
snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name);
- status =
- plugin_register_write(cb_name, wm_write,
- &(user_data_t){
- .data = node, .free_func = wm_config_free,
- });
+ status = plugin_register_write(cb_name, wm_write,
+ &(user_data_t){
+ .data = node,
+ .free_func = wm_config_free,
+ });
INFO("write_mongodb plugin: registered write plugin %s %d", cb_name,
status);
}
#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},
};