* have the same timestamp. */
/* vl.time = cdtime(); */
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "myplugin", sizeof (vl.plugin));
/* it is strongly recommended to use a type defined in the types.db file
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, (st->host != NULL) ? st->host : hostname_g,
- sizeof (vl.host));
+ if (st->host != NULL)
+ sstrncpy (vl.host, st->host, sizeof (vl.host));
sstrncpy (vl.plugin, "apache", sizeof (vl.plugin));
if (st->name != NULL)
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "apcups", sizeof (vl.plugin));
- sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
vl.values = &(value_t) { .gauge = val };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "apple_sensors", sizeof (vl.plugin));
- sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "aquaero", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ascent", sizeof (vl.plugin));
if (plugin_instance != NULL)
norm_pressure = abs_to_mean_sea_level_pressure(pressure);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "barometer", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, "mpl115", sizeof (vl.plugin_instance));
norm_pressure = abs_to_mean_sea_level_pressure(pressure);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "barometer", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, "mpl3115", sizeof (vl.plugin_instance));
norm_pressure = abs_to_mean_sea_level_pressure(pressure);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "barometer", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, "bmp085", sizeof (vl.plugin_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "battery", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "battery", sizeof(vl.plugin));
/* statefs supports 1 battery at present */
sstrncpy(vl.plugin_instance, "0", sizeof(vl.plugin_instance));
vl.values_len = 1;
if (config_parse_time)
vl.time = TIME_T_TO_CDTIME_T (ts);
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "bind", sizeof(vl.plugin));
if (plugin_instance) {
sstrncpy(vl.plugin_instance, plugin_instance,
}
vtmp->vlist = (value_list_t)VALUE_LIST_INIT;
- sstrncpy(vtmp->vlist.host, hostname_g, sizeof(vtmp->vlist.host));
sstrncpy(vtmp->vlist.plugin, "ceph", sizeof(vtmp->vlist.plugin));
sstrncpy(vtmp->vlist.plugin_instance, io->d->name, sizeof(vtmp->vlist.plugin_instance));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "cgroups", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
vl.values_len = 1;
/* XXX: Shall g_chrony_host/g_chrony_port be reflected in the plugin's output? */
- /* hostname_g is set in daemon/collectd.c (from config, via gethostname or by resolving localhost) */
- /* defined as: char hostname_g[DATA_MAX_NAME_LEN]; (never NULL) */
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, PLUGIN_NAME_SHORT, sizeof(vl.plugin));
if (g_chrony_plugin_instance != NULL)
{
vl.values = &conntrack;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "conntrack", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)
vl.values = &(value_t) { .derive = context_switches };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "contextswitch", sizeof (vl.plugin));
sstrncpy (vl.type, "contextswitch", sizeof (vl.type));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "cpu", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, cpu_state_names[cpu_state],
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "cpu", sizeof (vl.plugin));
sstrncpy (vl.type, "count", sizeof (vl.type));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "cpufreq", sizeof (vl.plugin));
sstrncpy (vl.type, "cpufreq", sizeof (vl.type));
ssnprintf (vl.type_instance, sizeof (vl.type_instance), "%i", cpu_num);
vl.values = &(value_t) { .derive = cpu_sleep };
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "cpusleep", sizeof(vl.plugin));
sstrncpy(vl.type, "total_time_in_ms", sizeof(vl.type));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, wm->type, sizeof (vl.type));
vl.values = &(value_t) { .gauge = (gauge_t) code };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "response_code", sizeof (vl.type));
vl.values = &(value_t) { .gauge = CDTIME_T_TO_DOUBLE (response_time) };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "response_time", sizeof (vl.type));
vl.values = values;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, data->plugin, sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, data->plugin_instance,
sizeof (vl.plugin_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "df", sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance,
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "disk", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "disk", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "disk_io_time", sizeof (vl.type));
vl.values = &(value_t) { .gauge = in_progress };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "disk", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, disk_name, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "pending_operations", sizeof (vl.type));
vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "dns", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "dns", sizeof (vl.plugin));
sstrncpy (vl.type, "dns_octets", sizeof (vl.type));
const struct rte_eth_xstats *xstats,
uint32_t counters, cdtime_t port_read_time) {
for (uint32_t j = 0; j < counters; j++) {
- value_list_t dpdkstat_vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT;
char *type_end;
- dpdkstat_vl.values = &(value_t){.derive = (derive_t)xstats[j].value};
- dpdkstat_vl.values_len = 1; /* Submit stats one at a time */
- dpdkstat_vl.time = port_read_time;
- sstrncpy(dpdkstat_vl.host, hostname_g, sizeof(dpdkstat_vl.host));
- sstrncpy(dpdkstat_vl.plugin, "dpdkstat", sizeof(dpdkstat_vl.plugin));
- sstrncpy(dpdkstat_vl.plugin_instance, dev_name,
- sizeof(dpdkstat_vl.plugin_instance));
+ vl.values = &(value_t){.derive = (derive_t)xstats[j].value};
+ vl.values_len = 1; /* Submit stats one at a time */
+ vl.time = port_read_time;
+ sstrncpy(vl.plugin, "dpdkstat", sizeof(vl.plugin));
+ sstrncpy(vl.plugin_instance, dev_name,
+ sizeof(vl.plugin_instance));
type_end = strrchr(xstats[j].name, '_');
if ((type_end != NULL) &&
(strncmp(xstats[j].name, "rx_", strlen("rx_")) == 0)) {
if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_rx_errors", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
} else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_rx_dropped", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_rx_dropped", sizeof(vl.type));
} else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_rx_octets", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_rx_octets", sizeof(vl.type));
} else if (strncmp(type_end, "_packets", strlen("_packets")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_rx_packets", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_rx_packets", sizeof(vl.type));
} else if (strncmp(type_end, "_placement", strlen("_placement")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_rx_errors", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
} else if (strncmp(type_end, "_buff", strlen("_buff")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_rx_errors", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_rx_errors", sizeof(vl.type));
} else {
/* Does not fit obvious type: use a more generic one */
- sstrncpy(dpdkstat_vl.type, "derive", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "derive", sizeof(vl.type));
}
} else if ((type_end != NULL) &&
(strncmp(xstats[j].name, "tx_", strlen("tx_"))) == 0) {
if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_tx_errors", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_tx_errors", sizeof(vl.type));
} else if (strncmp(type_end, "_dropped", strlen("_dropped")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_tx_dropped", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_tx_dropped", sizeof(vl.type));
} else if (strncmp(type_end, "_bytes", strlen("_bytes")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_tx_octets", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_tx_octets", sizeof(vl.type));
} else if (strncmp(type_end, "_packets", strlen("_packets")) == 0) {
- sstrncpy(dpdkstat_vl.type, "if_tx_packets", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "if_tx_packets", sizeof(vl.type));
} else {
/* Does not fit obvious type: use a more generic one */
- sstrncpy(dpdkstat_vl.type, "derive", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "derive", sizeof(vl.type));
}
} else if ((type_end != NULL) &&
(strncmp(xstats[j].name, "flow_", strlen("flow_"))) == 0) {
if (strncmp(type_end, "_filters", strlen("_filters")) == 0) {
- sstrncpy(dpdkstat_vl.type, "operations", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "operations", sizeof(vl.type));
} else if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
- sstrncpy(dpdkstat_vl.type, "errors", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "errors", sizeof(vl.type));
} else if (strncmp(type_end, "_filters", strlen("_filters")) == 0) {
- sstrncpy(dpdkstat_vl.type, "filter_result", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "filter_result", sizeof(vl.type));
}
} else if ((type_end != NULL) &&
(strncmp(xstats[j].name, "mac_", strlen("mac_"))) == 0) {
if (strncmp(type_end, "_errors", strlen("_errors")) == 0) {
- sstrncpy(dpdkstat_vl.type, "errors", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "errors", sizeof(vl.type));
}
} else {
/* Does not fit obvious type, or strrchr error:
* use a more generic type */
- sstrncpy(dpdkstat_vl.type, "derive", sizeof(dpdkstat_vl.type));
+ sstrncpy(vl.type, "derive", sizeof(vl.type));
}
- sstrncpy(dpdkstat_vl.type_instance, xstats[j].name,
- sizeof(dpdkstat_vl.type_instance));
- plugin_dispatch_values(&dpdkstat_vl);
+ sstrncpy(vl.type_instance, xstats[j].name,
+ sizeof(vl.type_instance));
+ plugin_dispatch_values(&vl);
}
}
}
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "drbd", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "email", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "entropy", sizeof (vl.plugin));
sstrncpy (vl.type, "entropy", sizeof (vl.type));
vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ethstat", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, device, sizeof (vl.plugin_instance));
if (map != NULL)
CDTIME_T_TO_DOUBLE (plugin_get_interval ()));
setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
- ssnprintf (buffer, sizeof (buffer), "%s", hostname_g);
+ sstrncpy (buffer, hostname_g, sizeof (buffer));
setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
#else
ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%.3f",
vl.values_len = 1;
// Compose the metric
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "fhcount", sizeof(vl.plugin));
sstrncpy(vl.type, type, sizeof(vl.type));
sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
vl.values = &(value_t) { .gauge = (gauge_t) dir->files_num };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "filecount", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dir->instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "files", sizeof (vl.type));
vl.values = &value;
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof (vl.host));
sstrncpy(vl.plugin, "fscache", sizeof (vl.plugin));
sstrncpy(vl.plugin_instance, section, sizeof (vl.plugin_instance));
sstrncpy(vl.type, "fscache_stat", sizeof(vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "gps", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "hddtemp", sizeof (vl.plugin));
sstrncpy (vl.type, "temperature", sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = &(value_t) { .gauge = NAN };
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, g_plugin_name, sizeof(vl.plugin));
if (info->node) {
ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%zuKb",
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "interface", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ipc", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ipmi", sizeof (vl.plugin));
sstrncpy (vl.type, list_item->sensor_type, sizeof (vl.type));
sstrncpy (vl.type_instance, list_item->sensor_name, sizeof (vl.type_instance));
return (0);
}
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ip6tables", sizeof (vl.plugin));
status = ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
return (0);
}
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "iptables", sizeof (vl.plugin));
status = ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "connections", sizeof (vl.type));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance));
sstrncpy (vl.type, t, sizeof (vl.type));
vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "irq", sizeof (vl.plugin));
sstrncpy (vl.type, "irq", sizeof (vl.type));
sstrncpy (vl.type_instance, irq_name, sizeof (vl.type_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "load", sizeof (vl.plugin));
sstrncpy (vl.type, "load", sizeof (vl.type));
sstrncpy (vl.host, serial, sizeof (vl.host));
sstrncpy (vl.plugin_instance, hostname_g, sizeof (vl.plugin));
}
- else
- {
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
- }
sstrncpy (vl.plugin, "lpar", sizeof (vl.plugin));
sstrncpy (vl.type, "vcpu", sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = &(value_t) { .gauge = (gauge_t) ivalue };
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof (vl.host));
sstrncpy(vl.plugin, "lvm", sizeof (vl.plugin));
sstrncpy(vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy(vl.type, "df_complex", sizeof (vl.type));
vl.values = val;
vl.values_len = len;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "madwifi", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "mbmon", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "md", sizeof (vl.plugin));
ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
"%i", minor);
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "memcachec", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, wm->type, sizeof (vl.type));
{
char const *host = st->host;
- /* Set vl->host to hostname_g, if:
+ /* Keep default hostname, if:
* - Legacy mode is used.
* - "Socket" option is given (doc: "Host option is ignored").
* - "Host" option is not provided.
* - "Host" option is set to "localhost" or "127.0.0.1". */
- if ((strcmp (st->name, "__legacy__") == 0)
- || (st->socket != NULL)
- || (st->host == NULL)
- || (strcmp ("127.0.0.1", st->host) == 0)
- || (strcmp ("localhost", st->host) == 0))
- host = hostname_g;
+ if ((strcmp (st->name, "__legacy__") != 0)
+ && (st->socket == NULL)
+ && (st->host != NULL)
+ && (strcmp ("127.0.0.1", st->host) != 0)
+ && (strcmp ("localhost", st->host) != 0))
+ sstrncpy (vl->host, host, sizeof (vl->host));
sstrncpy (vl->plugin, "memcached", sizeof (vl->plugin));
- sstrncpy (vl->host, host, sizeof (vl->host));
if (strcmp (st->name, "__legacy__") != 0)
sstrncpy (vl->plugin_instance, st->name, sizeof (vl->plugin_instance));
}
vl.values = v;
vl.values_len = STATIC_ARRAY_SIZE (v);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "memory", sizeof (vl.plugin));
sstrncpy (vl.type, "memory", sizeof (vl.type));
vl.time = cdtime ();
vl.values = &(value_t) { .gauge = ((gauge_t)value) * 1024.0 };
vl.values_len = 1;
- strncpy (vl.host, hostname_g, sizeof (vl.host));
strncpy (vl.plugin, "mic", sizeof (vl.plugin));
ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance), "%i", micnumber);
strncpy (vl.type, "memory", sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "multimeter", sizeof (vl.plugin));
sstrncpy (vl.type, "multimeter", sizeof (vl.type));
if (host != NULL)
sstrncpy (vl.host, host, sizeof (vl.host));
- else
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "netapp", sizeof (vl.plugin));
if (plugin_inst != NULL)
sstrncpy (vl.plugin_instance, plugin_inst, sizeof (vl.plugin_instance));
vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "netlink", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "netlink", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = values;
vl.values_len = 2;
vl.time = 0;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "network", sizeof (vl.plugin));
/* Octets received / sent */
value_list_t vl = VALUE_LIST_INIT;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "nfs", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "nginx", sizeof (vl.plugin));
- sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
if (inst != NULL)
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ntpd", sizeof (vl.plugin));
- sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
vl.values = &v;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "numa", sizeof (vl.plugin));
ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance), "node%i", node);
sstrncpy (vl.type, "vmpage_action", sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "olsrd", sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance,
return 0;
}
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "onewire", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, name, sizeof (vl.plugin_instance));
/* traverse list and check entries */
for (traverse = direct_list; traverse != NULL; traverse = traverse->next)
{
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "onewire", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, traverse->address, sizeof (vl.plugin_instance));
vl.values = &value;
vl.values_len = 1;
- if ((st->host == NULL)
- || (strcmp ("", st->host) == 0)
- || (strcmp ("localhost", st->host) == 0))
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
- else
+ if ((st->host != NULL) && (strcmp ("localhost", st->host) != 0))
sstrncpy (vl.host, st->host, sizeof (vl.host));
sstrncpy (vl.plugin, "openldap", sizeof (vl.plugin));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "openvpn", sizeof (vl.plugin));
sstrncpy (vl.type, "users", sizeof (vl.type));
if (pinst != NULL)
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "openvpn", sizeof (vl.plugin));
if (pinst != NULL)
sstrncpy (vl.plugin_instance, pinst,
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "openvpn", sizeof (vl.plugin));
if (pinst != NULL)
sstrncpy (vl.plugin_instance, pinst,
vl.values = values;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "pf", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof(vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof(vl.type_instance));
value_list_t vl = VALUE_LIST_INIT;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "pinba", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, res->name, sizeof (vl.plugin_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ping", sizeof (vl.plugin));
- sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type_instance, host, sizeof (vl.type_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "powerdns", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_instance != NULL)
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "processes", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, "ps_state", sizeof (vl.type));
value_t values[2];
vl.values = values;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "processes", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, ps->name, sizeof (vl.plugin_instance));
vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof (vl.host));
sstrncpy(vl.plugin, "processes", sizeof (vl.plugin));
sstrncpy(vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy(vl.type, "fork_rate", sizeof (vl.type));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "protocols", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, protocol_name, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "protocol_counter", sizeof (vl.type));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "redis", sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance,
if (!config_collect_stats)
return (-1);
- if ((strncmp ("unix:", daemon_address, strlen ("unix:")) == 0)
- || (daemon_address[0] == '/'))
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
- else
+ if ((strncmp ("unix:", daemon_address, strlen ("unix:")) != 0)
+ && (daemon_address[0] != '/'))
sstrncpy (vl.host, daemon_address, sizeof (vl.host));
sstrncpy (vl.plugin, "rrdcached", sizeof (vl.plugin));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "sensors", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "serial", sizeof (vl.plugin));
sstrncpy (vl.type, "serial_octets", sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance,
analog = packet->payload;
vl.values = &(value_t) { .gauge = analog->data[0] };
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "sigrok", sizeof(vl.plugin));
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
- "%s", cfdev->name);
+ sstrncpy(vl.plugin_instance, cfdev->name, sizeof(vl.plugin_instance));
sstrncpy(vl.type, sigrok_value_type(analog), sizeof(vl.type));
plugin_dispatch_values(&vl);
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "smart", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "smart", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "smart_attribute", sizeof (vl.type));
vl.values = &(value_t) { .gauge = NAN };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "statsd", sizeof (vl.plugin));
if (metric->type == STATSD_GAUGE)
vl.values = &(value_t) { .gauge = NAN };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "swap", sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance,
vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "swap", sizeof (vl.plugin));
sstrncpy (vl.type, "swap_io", sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "table", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, tbl->instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, res->type, sizeof (vl.type));
vl.values_len = 1;
vl.values = &v;
- sstrncpy(vl.host, hostname_g, sizeof (vl.host));
sstrncpy(vl.plugin, "tail_csv", sizeof(vl.plugin));
if (id->instance != NULL)
sstrncpy(vl.plugin_instance, id->instance, sizeof(vl.plugin_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "tape", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
{
vl->values = values;
vl->values_len = 1;
- sstrncpy (vl->host, hostname_g, sizeof (vl->host));
sstrncpy (vl->plugin, "tcpconns", sizeof (vl->plugin));
sstrncpy (vl->type, "tcp_connections", sizeof (vl->type));
}
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "teamspeak2", sizeof (vl.plugin));
if (plugin_instance != NULL)
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "teamspeak2", sizeof (vl.plugin));
if (plugin_instance != NULL)
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ted", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "thermal", sizeof(vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance,
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, PLUGIN_NAME, sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "uptime", sizeof (vl.plugin));
sstrncpy (vl.type, "uptime", sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "users", sizeof (vl.plugin));
sstrncpy (vl.type, "users", sizeof (vl.plugin));
vl.values = &value;
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
-
sstrncpy (vl.plugin, "varnish", sizeof (vl.plugin));
if (plugin_instance == NULL)
plugin_instance = "default";
-
ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
"%s-%s", plugin_instance, category);
vl.values = values;
vl.values_len = values_len;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vmem", sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "if_octets", sizeof (vl.type));
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "load", sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "wireless", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "xencpu", sizeof (vl.plugin));
sstrncpy (vl.type, "percent", sizeof (vl.type));
sstrncpy (vl.type_instance, "load", sizeof (vl.type_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "xmms", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
vl.values = values;
vl.values_len = values_len;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "zfs_arc", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.values = values;
vl.values_len = 1; /*STATIC_ARRAY_SIZE (values);*/
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "zone", sizeof (vl.plugin));
sstrncpy (vl.type, "percent", sizeof (vl.type));
sstrncpy (vl.type_instance, zone, sizeof (vl.type_instance));
vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "zookeeper", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)
vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "zookeeper", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)