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. */
char cbname[128];
ssnprintf(cbname, sizeof(cbname), "amqp/%s", conf->name);
- status =
- plugin_register_write(cbname, camqp_write,
- &(user_data_t){
- .data = conf, .free_func = camqp_config_free,
- });
+ status = plugin_register_write(cbname, camqp_write,
+ &(user_data_t){
+ .data = conf,
+ .free_func = camqp_config_free,
+ });
if (status != 0) {
camqp_config_free(conf);
return status;
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) {
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;
}
/* update global proc_pids table */
- proc_pids_t **proc_pids = realloc(g_rdt->proc_pids,
- (g_rdt->num_proc_pids + ng->num_names) *
- sizeof(*g_rdt->proc_pids));
+ proc_pids_t **proc_pids =
+ realloc(g_rdt->proc_pids, (g_rdt->num_proc_pids + ng->num_names) *
+ sizeof(*g_rdt->proc_pids));
if (NULL == proc_pids) {
ERROR(RDT_PLUGIN ": Alloc error\n");
continue;
* (Module-)Global variables
*/
static const char *config_keys[] = {
- "Interface", "IgnoreSelected", "ReportInactive",
+ "Interface",
+ "IgnoreSelected",
+ "ReportInactive",
};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
derive_t tx) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
if (ignorelist_match(ignorelist, dev) != 0)
#define IFA_TX_PACKT ifi_opackets
#define IFA_RX_ERROR ifi_ierrors
#define IFA_TX_ERROR ifi_oerrors
-/* #endif HAVE_STRUCT_IF_DATA */
+ /* #endif HAVE_STRUCT_IF_DATA */
#elif HAVE_STRUCT_NET_DEVICE_STATS
#define IFA_DATA net_device_stats
}
freeifaddrs(if_list);
-/* #endif HAVE_GETIFADDRS */
+ /* #endif HAVE_GETIFADDRS */
#elif KERNEL_LINUX
FILE *fh;
}
fclose(fh);
-/* #endif KERNEL_LINUX */
+ /* #endif KERNEL_LINUX */
#elif HAVE_LIBKSTAT
derive_t rx;
if ((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;
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)
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;
notification = notify_notification_new(summary, n->message, NULL
#if NOTIFY_CHECK_VERSION(0, 7, 0)
- );
+ );
#else
,
NULL);
/* 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,
* 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,
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.");
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",
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,
}
oauth_google_t ret = {
- .project_id = strdup(project_id), .oauth = oauth,
+ .project_id = strdup(project_id),
+ .oauth = oauth,
};
yajl_tree_free(root);
ovs_db_t *pdb = (ovs_db_t *)arg; /* pointer to OVS DB */
ovs_json_reader_t *jreader = NULL;
struct pollfd poll_fd = {
- .fd = pdb->sock, .events = POLLIN | POLLPRI, .revents = 0,
+ .fd = pdb->sock,
+ .events = POLLIN | POLLPRI,
+ .revents = 0,
};
/* create JSON reader instance */
return status;
} /* }}} int srrd_create */
-/* #endif HAVE_THREADSAFE_LIBRRD */
+ /* #endif HAVE_THREADSAFE_LIBRRD */
#else /* !HAVE_THREADSAFE_LIBRRD */
static int srrd_create(const char *filename, /* {{{ */
/* 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));
}
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.",
#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},
};
ssnprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
- status =
- plugin_register_write(cb_name, wr_write,
- &(user_data_t){
- .data = node, .free_func = wr_config_free,
- });
+ status = plugin_register_write(cb_name, wr_write,
+ &(user_data_t){
+ .data = node,
+ .free_func = wr_config_free,
+ });
}
if (status != 0)