projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a95b83
)
Tree wide: Use compound literals when dealing with value_t.
author
Florian Forster
<octo@collectd.org>
Wed, 14 Sep 2016 06:19:41 +0000
(08:19 +0200)
committer
Florian Forster
<octo@collectd.org>
Wed, 14 Sep 2016 06:45:58 +0000
(08:45 +0200)
74 files changed:
src/apache.c
patch
|
blob
|
history
src/apcups.c
patch
|
blob
|
history
src/apple_sensors.c
patch
|
blob
|
history
src/aquaero.c
patch
|
blob
|
history
src/ascent.c
patch
|
blob
|
history
src/battery.c
patch
|
blob
|
history
src/battery_statefs.c
patch
|
blob
|
history
src/bind.c
patch
|
blob
|
history
src/chrony.c
patch
|
blob
|
history
src/contextswitch.c
patch
|
blob
|
history
src/cpu.c
patch
|
blob
|
history
src/cpusleep.c
patch
|
blob
|
history
src/curl.c
patch
|
blob
|
history
src/daemon/plugin.c
patch
|
blob
|
history
src/df.c
patch
|
blob
|
history
src/disk.c
patch
|
blob
|
history
src/dns.c
patch
|
blob
|
history
src/email.c
patch
|
blob
|
history
src/ethstat.c
patch
|
blob
|
history
src/fhcount.c
patch
|
blob
|
history
src/filecount.c
patch
|
blob
|
history
src/gps.c
patch
|
blob
|
history
src/hddtemp.c
patch
|
blob
|
history
src/ipc.c
patch
|
blob
|
history
src/ipmi.c
patch
|
blob
|
history
src/iptables.c
patch
|
blob
|
history
src/ipvs.c
patch
|
blob
|
history
src/irq.c
patch
|
blob
|
history
src/lpar.c
patch
|
blob
|
history
src/lvm.c
patch
|
blob
|
history
src/madwifi.c
patch
|
blob
|
history
src/mbmon.c
patch
|
blob
|
history
src/md.c
patch
|
blob
|
history
src/memcachec.c
patch
|
blob
|
history
src/memcached.c
patch
|
blob
|
history
src/mic.c
patch
|
blob
|
history
src/multimeter.c
patch
|
blob
|
history
src/mysql.c
patch
|
blob
|
history
src/netapp.c
patch
|
blob
|
history
src/netlink.c
patch
|
blob
|
history
src/nginx.c
patch
|
blob
|
history
src/ntpd.c
patch
|
blob
|
history
src/nut.c
patch
|
blob
|
history
src/olsrd.c
patch
|
blob
|
history
src/onewire.c
patch
|
blob
|
history
src/openldap.c
patch
|
blob
|
history
src/openvpn.c
patch
|
blob
|
history
src/pinba.c
patch
|
blob
|
history
src/ping.c
patch
|
blob
|
history
src/powerdns.c
patch
|
blob
|
history
src/processes.c
patch
|
blob
|
history
src/protocols.c
patch
|
blob
|
history
src/redis.c
patch
|
blob
|
history
src/rrdcached.c
patch
|
blob
|
history
src/sensors.c
patch
|
blob
|
history
src/sigrok.c
patch
|
blob
|
history
src/smart.c
patch
|
blob
|
history
src/statsd.c
patch
|
blob
|
history
src/swap.c
patch
|
blob
|
history
src/target_v5upgrade.c
patch
|
blob
|
history
src/teamspeak2.c
patch
|
blob
|
history
src/ted.c
patch
|
blob
|
history
src/tokyotyrant.c
patch
|
blob
|
history
src/turbostat.c
patch
|
blob
|
history
src/uptime.c
patch
|
blob
|
history
src/users.c
patch
|
blob
|
history
src/varnish.c
patch
|
blob
|
history
src/virt.c
patch
|
blob
|
history
src/vserver.c
patch
|
blob
|
history
src/wireless.c
patch
|
blob
|
history
src/xencpu.c
patch
|
blob
|
history
src/xmms.c
patch
|
blob
|
history
src/zfs_arc.c
patch
|
blob
|
history
src/zookeeper.c
patch
|
blob
|
history
diff --git
a/src/apache.c
b/src/apache.c
index
c02dfe0
..
20a2a3c
100644
(file)
--- a/
src/apache.c
+++ b/
src/apache.c
@@
-411,19
+411,15
@@
static void submit_value (const char *type, const char *type_instance,
} /* void submit_value */
static void submit_derive (const char *type, const char *type_instance,
} /* void submit_value */
static void submit_derive (const char *type, const char *type_instance,
- derive_t
c
, apache_t *st)
+ derive_t
d
, apache_t *st)
{
{
- value_t v;
- v.derive = c;
- submit_value (type, type_instance, v, st);
+ submit_value (type, type_instance, (value_t) { .derive = d }, st);
} /* void submit_derive */
static void submit_gauge (const char *type, const char *type_instance,
gauge_t g, apache_t *st)
{
} /* void submit_derive */
static void submit_gauge (const char *type, const char *type_instance,
gauge_t g, apache_t *st)
{
- value_t v;
- v.gauge = g;
- submit_value (type, type_instance, v, st);
+ submit_value (type, type_instance, (value_t) { .gauge = g }, st);
} /* void submit_gauge */
static void submit_scoreboard (char *buf, apache_t *st)
} /* void submit_gauge */
static void submit_scoreboard (char *buf, apache_t *st)
diff --git
a/src/apcups.c
b/src/apcups.c
index
af5f24c
..
821bd65
100644
(file)
--- a/
src/apcups.c
+++ b/
src/apcups.c
@@
-416,12
+416,9
@@
static int apcups_config (oconfig_item_t *ci)
static void apc_submit_generic (const char *type, const char *type_inst, double value)
{
static void apc_submit_generic (const char *type, const char *type_inst, double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "apcups", sizeof (vl.plugin));
diff --git
a/src/apple_sensors.c
b/src/apple_sensors.c
index
48fbcb9
..
06ca7a8
100644
(file)
--- a/
src/apple_sensors.c
+++ b/
src/apple_sensors.c
@@
-83,15
+83,9
@@
static int as_init (void)
static void as_submit (const char *type, const char *type_instance,
double val)
{
static void as_submit (const char *type, const char *type_instance,
double val)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- DEBUG ("type = %s; type_instance = %s; val = %f;",
- type, type_instance, val);
-
- values[0].gauge = val;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "apple_sensors", sizeof (vl.plugin));
diff --git
a/src/aquaero.c
b/src/aquaero.c
index
81a4efd
..
08271f8
100644
(file)
--- a/
src/aquaero.c
+++ b/
src/aquaero.c
@@
-60,16
+60,13
@@
static void aquaero_submit (const char *type, const char *type_instance,
double value)
{
const char *instance = conf_device?conf_device:"default";
double value)
{
const char *instance = conf_device?conf_device:"default";
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
/* Don't report undefined values. */
if (value == AQ5_FLOAT_UNDEF)
return;
value_list_t vl = VALUE_LIST_INIT;
/* Don't report undefined values. */
if (value == AQ5_FLOAT_UNDEF)
return;
- values[0].gauge = value;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
diff --git
a/src/ascent.c
b/src/ascent.c
index
11bb97f
..
16568e6
100644
(file)
--- a/
src/ascent.c
+++ b/
src/ascent.c
@@
-126,12
+126,9
@@
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
static int ascent_submit_gauge (const char *plugin_instance, /* {{{ */
const char *type, const char *type_instance, gauge_t value)
{
static int ascent_submit_gauge (const char *plugin_instance, /* {{{ */
const char *type, const char *type_instance, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ascent", sizeof (vl.plugin));
diff --git
a/src/battery.c
b/src/battery.c
index
d227d55
..
ebf41de
100644
(file)
--- a/
src/battery.c
+++ b/
src/battery.c
@@
-78,12
+78,9
@@
static _Bool query_statefs = 0;
static void battery_submit2 (char const *plugin_instance, /* {{{ */
char const *type, char const *type_instance, gauge_t value)
{
static void battery_submit2 (char const *plugin_instance, /* {{{ */
char const *type, char const *type_instance, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "battery", sizeof (vl.plugin));
diff --git
a/src/battery_statefs.c
b/src/battery_statefs.c
index
ee739bf
..
03729fd
100644
(file)
--- a/
src/battery_statefs.c
+++ b/
src/battery_statefs.c
@@
-54,12
+54,9
@@
SOFTWARE.
static void battery_submit(const char *type, gauge_t value,
const char *type_instance) {
static void battery_submit(const char *type, gauge_t value,
const char *type_instance) {
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "battery", sizeof(vl.plugin));
diff --git
a/src/bind.c
b/src/bind.c
index
9b6b32e
..
09de4a3
100644
(file)
--- a/
src/bind.c
+++ b/
src/bind.c
@@
-247,12
+247,9
@@
static int memsummary_translation_table_length =
static void submit (time_t ts, const char *plugin_instance, /* {{{ */
const char *type, const char *type_instance, value_t value)
{
static void submit (time_t ts, const char *plugin_instance, /* {{{ */
const char *type, const char *type_instance, value_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0] = value;
-
- vl.values = values;
+ vl.values = &value;
vl.values_len = 1;
if (config_parse_time)
vl.time = TIME_T_TO_CDTIME_T (ts);
vl.values_len = 1;
if (config_parse_time)
vl.time = TIME_T_TO_CDTIME_T (ts);
diff --git
a/src/chrony.c
b/src/chrony.c
index
f6294e4
..
353ede7
100644
(file)
--- a/
src/chrony.c
+++ b/
src/chrony.c
@@
-677,12
+677,9
@@
ntohf(tFloat p_float)
static void
chrony_push_data(const char *p_type, const char *p_type_inst, double p_value)
{
static void
chrony_push_data(const char *p_type, const char *p_type_inst, double p_value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = p_value; /* TODO: Check type??? (counter, gauge, derive, absolute) */
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = p_value };
vl.values_len = 1;
/* XXX: Shall g_chrony_host/g_chrony_port be reflected in the plugin's output? */
vl.values_len = 1;
/* XXX: Shall g_chrony_host/g_chrony_port be reflected in the plugin's output? */
diff --git
a/src/contextswitch.c
b/src/contextswitch.c
index
76e2a6c
..
3bd6d9f
100644
(file)
--- a/
src/contextswitch.c
+++ b/
src/contextswitch.c
@@
-49,12
+49,9
@@
static void cs_submit (derive_t context_switches)
{
static void cs_submit (derive_t context_switches)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = (derive_t) context_switches;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "contextswitch", sizeof (vl.plugin));
diff --git
a/src/cpu.c
b/src/cpu.c
index
1ac5b4a
..
fbd0714
100644
(file)
--- a/
src/cpu.c
+++ b/
src/cpu.c
@@
-325,12
+325,9
@@
static int init (void)
static void submit_value (int cpu_num, int cpu_state, const char *type, value_t value)
{
static void submit_value (int cpu_num, int cpu_state, const char *type, value_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- memcpy(&values[0], &value, sizeof(value));
-
- vl.values = values;
+ vl.values = &value;
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
@@
-346,26
+343,22
@@
static void submit_value (int cpu_num, int cpu_state, const char *type, value_t
plugin_dispatch_values (&vl);
}
plugin_dispatch_values (&vl);
}
-static void submit_percent
(int cpu_num, int cpu_state, gauge_t percent
)
+static void submit_percent
(int cpu_num, int cpu_state, gauge_t value
)
{
{
- value_t value;
-
/* This function is called for all known CPU states, but each read
* method will only report a subset. The remaining states are left as
* NAN and we ignore them here. */
/* This function is called for all known CPU states, but each read
* method will only report a subset. The remaining states are left as
* NAN and we ignore them here. */
- if (isnan (
percent
))
+ if (isnan (
value
))
return;
return;
- value.gauge = percent;
-
submit_value (cpu_num, cpu_state, "percent", value
);
+ submit_value (cpu_num, cpu_state, "percent",
+
(value_t) { .gauge = value }
);
}
}
-static void submit_derive
(int cpu_num, int cpu_state, derive_t deriv
e)
+static void submit_derive
(int cpu_num, int cpu_state, derive_t valu
e)
{
{
- value_t value;
-
- value.derive = derive;
- submit_value (cpu_num, cpu_state, "cpu", value);
+ submit_value (cpu_num, cpu_state, "cpu",
+ (value_t) { .derive = value });
}
/* Takes the zero-index number of a CPU and makes sure that the module-global
}
/* Takes the zero-index number of a CPU and makes sure that the module-global
@@
-464,14
+457,11
@@
static void cpu_commit_one (int cpu_num, /* {{{ */
} /* }}} void cpu_commit_one */
/* Commits the number of cores */
} /* }}} void cpu_commit_one */
/* Commits the number of cores */
-static void cpu_commit_num_cpu (gauge_t
num_cpu
) /* {{{ */
+static void cpu_commit_num_cpu (gauge_t
value
) /* {{{ */
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = num_cpu;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
@@
-555,7
+545,7
@@
static int cpu_stage (size_t cpu_num, size_t state, derive_t d, cdtime_t now) /*
int status;
cpu_state_t *s;
gauge_t rate = NAN;
int status;
cpu_state_t *s;
gauge_t rate = NAN;
- value_t val = {
.derive = d
};
+ value_t val = {
.derive = d
};
if (state >= COLLECTD_CPU_STATE_ACTIVE)
return (EINVAL);
if (state >= COLLECTD_CPU_STATE_ACTIVE)
return (EINVAL);
diff --git
a/src/cpusleep.c
b/src/cpusleep.c
index
326c29c
..
5de0e47
100644
(file)
--- a/
src/cpusleep.c
+++ b/
src/cpusleep.c
@@
-37,12
+37,9
@@
#include <time.h>
static void cpusleep_submit(derive_t cpu_sleep) {
#include <time.h>
static void cpusleep_submit(derive_t cpu_sleep) {
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = cpu_sleep;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "cpusleep", sizeof(vl.plugin));
diff --git
a/src/curl.c
b/src/curl.c
index
74ef13c
..
8401e6c
100644
(file)
--- a/
src/curl.c
+++ b/
src/curl.c
@@
-608,14
+608,11
@@
static int cc_init (void) /* {{{ */
} /* }}} int cc_init */
static void cc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */
} /* }}} int cc_init */
static void cc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */
-
const cu_match_value_t *mv
)
+
value_t value
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0] = mv->value;
-
- vl.values = values;
+ vl.values = &value;
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
@@
-629,12
+626,9
@@
static void cc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */
static void cc_submit_response_code (const web_page_t *wp, long code) /* {{{ */
{
static void cc_submit_response_code (const web_page_t *wp, long code) /* {{{ */
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = code;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
@@
-647,12
+641,9
@@
static void cc_submit_response_code (const web_page_t *wp, long code) /* {{{ */
static void cc_submit_response_time (const web_page_t *wp, /* {{{ */
cdtime_t response_time)
{
static void cc_submit_response_time (const web_page_t *wp, /* {{{ */
cdtime_t response_time)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = CDTIME_T_TO_DOUBLE (response_time);
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "curl", sizeof (vl.plugin));
@@
-714,7
+705,7
@@
static int cc_read_page (web_page_t *wp) /* {{{ */
continue;
}
continue;
}
- cc_submit (wp, wm, mv);
+ cc_submit (wp, wm, mv
->value
);
match_value_reset (mv);
} /* for (wm = wp->matches; wm != NULL; wm = wm->next) */
match_value_reset (mv);
} /* for (wm = wp->matches; wm != NULL; wm = wm->next) */
diff --git
a/src/daemon/plugin.c
b/src/daemon/plugin.c
index
c6efc3f
..
d4b962f
100644
(file)
--- a/
src/daemon/plugin.c
+++ b/
src/daemon/plugin.c
@@
-151,34
+151,28
@@
static const char *plugin_get_dir (void)
}
static void plugin_update_internal_statistics (void) { /* {{{ */
}
static void plugin_update_internal_statistics (void) { /* {{{ */
- derive_t copy_write_queue_length;
- value_list_t vl = VALUE_LIST_INIT;
- value_t values[2];
-
copy_write_queue_length =
write_queue_length;
+
gauge_t copy_write_queue_length = (gauge_t)
write_queue_length;
/* Initialize `vl' */
/* Initialize `vl' */
- vl.values = values;
- vl.values_len = 2;
- vl.time = 0;
+ value_list_t vl = VALUE_LIST_INIT;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "collectd", sizeof (vl.plugin));
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "collectd", sizeof (vl.plugin));
- vl.type_instance[0] = 0;
- vl.values_len = 1;
-
/* Write queue */
sstrncpy (vl.plugin_instance, "write_queue",
sizeof (vl.plugin_instance));
/* Write queue : queue length */
/* Write queue */
sstrncpy (vl.plugin_instance, "write_queue",
sizeof (vl.plugin_instance));
/* Write queue : queue length */
- vl.values[0].gauge = (gauge_t) copy_write_queue_length;
+ vl.values = &(value_t) { .gauge = copy_write_queue_length };
+ vl.values_len = 1;
sstrncpy (vl.type, "queue_length", sizeof (vl.type));
vl.type_instance[0] = 0;
plugin_dispatch_values (&vl);
/* Write queue : Values dropped (queue length > low limit) */
sstrncpy (vl.type, "queue_length", sizeof (vl.type));
vl.type_instance[0] = 0;
plugin_dispatch_values (&vl);
/* Write queue : Values dropped (queue length > low limit) */
- vl.values[0].derive = (derive_t) stats_values_dropped;
+ vl.values = &(value_t) { .gauge = (gauge_t) stats_values_dropped };
+ vl.values_len = 1;
sstrncpy (vl.type, "derive", sizeof (vl.type));
sstrncpy (vl.type_instance, "dropped", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "derive", sizeof (vl.type));
sstrncpy (vl.type_instance, "dropped", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
@@
-188,7
+182,8
@@
static void plugin_update_internal_statistics (void) { /* {{{ */
sizeof (vl.plugin_instance));
/* Cache : Nb entry in cache tree */
sizeof (vl.plugin_instance));
/* Cache : Nb entry in cache tree */
- vl.values[0].gauge = (gauge_t) uc_get_size();
+ vl.values = &(value_t) { .gauge = (gauge_t) uc_get_size() };
+ vl.values_len = 1;
sstrncpy (vl.type, "cache_size", sizeof (vl.type));
vl.type_instance[0] = 0;
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "cache_size", sizeof (vl.type));
vl.type_instance[0] = 0;
plugin_dispatch_values (&vl);
diff --git
a/src/df.c
b/src/df.c
index
af54c92
..
632787b
100644
(file)
--- a/
src/df.c
+++ b/
src/df.c
@@
-161,12
+161,9
@@
static void df_submit_one (char *plugin_instance,
const char *type, const char *type_instance,
gauge_t value)
{
const char *type, const char *type_instance,
gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "df", sizeof (vl.plugin));
diff --git
a/src/disk.c
b/src/disk.c
index
465b005
..
f29029c
100644
(file)
--- a/
src/disk.c
+++ b/
src/disk.c
@@
-337,12
+337,9
@@
static void submit_io_time (char const *plugin_instance, derive_t io_time, deriv
#if KERNEL_LINUX
static void submit_in_progress (char const *disk_name, gauge_t in_progress)
{
#if KERNEL_LINUX
static void submit_in_progress (char const *disk_name, gauge_t in_progress)
{
- value_t v;
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- v.gauge = in_progress;
-
- vl.values = &v;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "disk", sizeof (vl.plugin));
@@
-352,7
+349,6
@@
static void submit_in_progress (char const *disk_name, gauge_t in_progress)
plugin_dispatch_values (&vl);
}
plugin_dispatch_values (&vl);
}
-
static counter_t disk_calc_time_incr (counter_t delta_time, counter_t delta_ops)
{
double interval = CDTIME_T_TO_DOUBLE (plugin_get_interval ());
static counter_t disk_calc_time_incr (counter_t delta_time, counter_t delta_ops)
{
double interval = CDTIME_T_TO_DOUBLE (plugin_get_interval ());
diff --git
a/src/dns.c
b/src/dns.c
index
0494b4b
..
ef80e57
100644
(file)
--- a/
src/dns.c
+++ b/
src/dns.c
@@
-370,12
+370,9
@@
static int dns_init (void)
static void submit_derive (const char *type, const char *type_instance,
derive_t value)
{
static void submit_derive (const char *type, const char *type_instance,
derive_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "dns", sizeof (vl.plugin));
diff --git
a/src/email.c
b/src/email.c
index
2662da9
..
97fbdfe
100644
(file)
--- a/
src/email.c
+++ b/
src/email.c
@@
-653,12
+653,9
@@
static int email_shutdown (void)
static void email_submit (const char *type, const char *type_instance, gauge_t value)
{
static void email_submit (const char *type, const char *type_instance, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "email", sizeof (vl.plugin));
diff --git
a/src/ethstat.c
b/src/ethstat.c
index
d0e7728
..
f0b8d9f
100644
(file)
--- a/
src/ethstat.c
+++ b/
src/ethstat.c
@@
-172,7
+172,6
@@
static void ethstat_submit_value (const char *device,
{
static c_complain_t complain_no_map = C_COMPLAIN_INIT_STATIC;
{
static c_complain_t complain_no_map = C_COMPLAIN_INIT_STATIC;
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_map_t *map = NULL;
value_list_t vl = VALUE_LIST_INIT;
value_map_t *map = NULL;
@@
-189,8
+188,7
@@
static void ethstat_submit_value (const char *device,
return;
}
return;
}
- values[0].derive = value;
- vl.values = values;
+ vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
diff --git
a/src/fhcount.c
b/src/fhcount.c
index
4b3abff
..
a2f5aa8
100644
(file)
--- a/
src/fhcount.c
+++ b/
src/fhcount.c
@@
-60,13
+60,9
@@
static int fhcount_config(const char *key, const char *value) {
static void fhcount_submit(
const char *type, const char *type_instance, gauge_t value) {
static void fhcount_submit(
const char *type, const char *type_instance, gauge_t value) {
-
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
// Compose the metric
vl.values_len = 1;
// Compose the metric
@@
-79,7
+75,6
@@
static void fhcount_submit(
plugin_dispatch_values(&vl);
}
plugin_dispatch_values(&vl);
}
-
static int fhcount_read(void) {
int numfields = 0;
int buffer_len = 60;
static int fhcount_read(void) {
int numfields = 0;
int buffer_len = 60;
diff --git
a/src/filecount.c
b/src/filecount.c
index
9de9e6c
..
c1e53a2
100644
(file)
--- a/
src/filecount.c
+++ b/
src/filecount.c
@@
-61,13
+61,10
@@
static size_t directories_num = 0;
static void fc_submit_dir (const fc_directory_conf_t *dir)
{
static void fc_submit_dir (const fc_directory_conf_t *dir)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = (gauge_t) dir->files_num;
-
- vl.values = values;
- vl.values_len = STATIC_ARRAY_SIZE (values);
+ 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.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "filecount", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dir->instance, sizeof (vl.plugin_instance));
@@
-75,7
+72,7
@@
static void fc_submit_dir (const fc_directory_conf_t *dir)
plugin_dispatch_values (&vl);
plugin_dispatch_values (&vl);
- v
alues[0].gauge = (gauge_t) dir->files_size
;
+ v
l.values = &(value_t) { .gauge = (gauge_t) dir->files_size }
;
sstrncpy (vl.type, "bytes", sizeof (vl.type));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "bytes", sizeof (vl.type));
plugin_dispatch_values (&vl);
diff --git
a/src/gps.c
b/src/gps.c
index
f72cef4
..
d5b7176
100644
(file)
--- a/
src/gps.c
+++ b/
src/gps.c
@@
-220,12
+220,9
@@
quit:
*/
static void cgps_submit (const char *type, gauge_t value, const char *type_instance)
{
*/
static void cgps_submit (const char *type, gauge_t value, const char *type_instance)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "gps", sizeof (vl.plugin));
diff --git
a/src/hddtemp.c
b/src/hddtemp.c
index
865ea86
..
31960b5
100644
(file)
--- a/
src/hddtemp.c
+++ b/
src/hddtemp.c
@@
-226,12
+226,9
@@
static int hddtemp_config (const char *key, const char *value)
static void hddtemp_submit (char *type_instance, double value)
{
static void hddtemp_submit (char *type_instance, double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "hddtemp", sizeof (vl.plugin));
diff --git
a/src/ipc.c
b/src/ipc.c
index
b164cdf
..
d6d2bbd
100644
(file)
--- a/
src/ipc.c
+++ b/
src/ipc.c
@@
-97,12
+97,9
@@
static void ipc_submit_g (const char *plugin_instance,
const char *type_instance,
gauge_t value) /* {{{ */
{
const char *type_instance,
gauge_t value) /* {{{ */
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ipc", sizeof (vl.plugin));
diff --git
a/src/ipmi.c
b/src/ipmi.c
index
ad62299
..
a42b787
100644
(file)
--- a/
src/ipmi.c
+++ b/
src/ipmi.c
@@
-115,7
+115,6
@@
static void sensor_read_handler (ipmi_sensor_t *sensor,
ipmi_states_t __attribute__((unused)) *states,
void *user_data)
{
ipmi_states_t __attribute__((unused)) *states,
void *user_data)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
c_ipmi_sensor_list_t *list_item = (c_ipmi_sensor_list_t *)user_data;
value_list_t vl = VALUE_LIST_INIT;
c_ipmi_sensor_list_t *list_item = (c_ipmi_sensor_list_t *)user_data;
@@
-214,9
+213,7
@@
static void sensor_read_handler (ipmi_sensor_t *sensor,
return;
}
return;
}
- values[0].gauge = value;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
diff --git
a/src/iptables.c
b/src/iptables.c
index
f691122
..
35975e6
100644
(file)
--- a/
src/iptables.c
+++ b/
src/iptables.c
@@
-242,7
+242,6
@@
static int submit6_match (const struct ip6t_entry_match *match,
int rule_num)
{
int status;
int rule_num)
{
int status;
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
/* Select the rules to collect */
value_list_t vl = VALUE_LIST_INIT;
/* Select the rules to collect */
@@
-260,8
+259,6
@@
static int submit6_match (const struct ip6t_entry_match *match,
return (0);
}
return (0);
}
- vl.values = values;
- vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ip6tables", sizeof (vl.plugin));
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ip6tables", sizeof (vl.plugin));
@@
-285,16
+282,16
@@
static int submit6_match (const struct ip6t_entry_match *match,
}
sstrncpy (vl.type, "ipt_bytes", sizeof (vl.type));
}
sstrncpy (vl.type, "ipt_bytes", sizeof (vl.type));
- values[0].derive = (derive_t) entry->counters.bcnt;
+ vl.values = &(value_t) { .derive = (derive_t) entry->counters.bcnt };
+ vl.values_len = 1;
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "ipt_packets", sizeof (vl.type));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "ipt_packets", sizeof (vl.type));
- v
alues[0].derive = (derive_t) entry->counters.pcnt
;
+ v
l.values = &(value_t) { .derive = (derive_t) entry->counters.pcnt }
;
plugin_dispatch_values (&vl);
return (0);
plugin_dispatch_values (&vl);
return (0);
-} /* int submit_match */
-
+} /* int submit6_match */
/* This needs to return `int' for IPT_MATCH_ITERATE to work. */
static int submit_match (const struct ipt_entry_match *match,
/* This needs to return `int' for IPT_MATCH_ITERATE to work. */
static int submit_match (const struct ipt_entry_match *match,
@@
-303,7
+300,6
@@
static int submit_match (const struct ipt_entry_match *match,
int rule_num)
{
int status;
int rule_num)
{
int status;
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
/* Select the rules to collect */
value_list_t vl = VALUE_LIST_INIT;
/* Select the rules to collect */
@@
-321,8
+317,6
@@
static int submit_match (const struct ipt_entry_match *match,
return (0);
}
return (0);
}
- vl.values = values;
- vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "iptables", sizeof (vl.plugin));
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "iptables", sizeof (vl.plugin));
@@
-346,11
+340,12
@@
static int submit_match (const struct ipt_entry_match *match,
}
sstrncpy (vl.type, "ipt_bytes", sizeof (vl.type));
}
sstrncpy (vl.type, "ipt_bytes", sizeof (vl.type));
- values[0].derive = (derive_t) entry->counters.bcnt;
+ vl.values = &(value_t) { .derive = (derive_t) entry->counters.bcnt };
+ vl.values_len = 1;
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "ipt_packets", sizeof (vl.type));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "ipt_packets", sizeof (vl.type));
- v
alues[0].derive = (derive_t) entry->counters.pcnt
;
+ v
l.values = &(value_t) { .derive = (derive_t) entry->counters.pcnt }
;
plugin_dispatch_values (&vl);
return (0);
plugin_dispatch_values (&vl);
return (0);
diff --git
a/src/ipvs.c
b/src/ipvs.c
index
92690e8
..
a68d20f
100644
(file)
--- a/
src/ipvs.c
+++ b/
src/ipvs.c
@@
-228,12
+228,9
@@
static int get_ti (struct ip_vs_dest_entry *de, char *ti, size_t size)
static void cipvs_submit_connections (const char *pi, const char *ti,
derive_t value)
{
static void cipvs_submit_connections (const char *pi, const char *ti,
derive_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = value;
-
- vl.values = values;
+ vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
diff --git
a/src/irq.c
b/src/irq.c
index
0f1d3f0
..
cb444a4
100644
(file)
--- a/
src/irq.c
+++ b/
src/irq.c
@@
-72,15
+72,12
@@
static int irq_config (const char *key, const char *value)
static void irq_submit (const char *irq_name, derive_t value)
{
static void irq_submit (const char *irq_name, derive_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
if (ignorelist_match (ignorelist, irq_name) != 0)
return;
value_list_t vl = VALUE_LIST_INIT;
if (ignorelist_match (ignorelist, irq_name) != 0)
return;
- values[0].derive = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "irq", sizeof (vl.plugin));
diff --git
a/src/lpar.c
b/src/lpar.c
index
5b0bd13
..
0e32c83
100644
(file)
--- a/
src/lpar.c
+++ b/
src/lpar.c
@@
-114,12
+114,9
@@
static int lpar_init (void)
static void lpar_submit (const char *type_instance, double value)
{
static void lpar_submit (const char *type_instance, double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = (gauge_t)value;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
if (report_by_serial)
{
vl.values_len = 1;
if (report_by_serial)
{
diff --git
a/src/lvm.c
b/src/lvm.c
index
6b9a031
..
77cb6eb
100644
(file)
--- a/
src/lvm.c
+++ b/
src/lvm.c
@@
-55,12
+55,9
@@
static char const *get_lv_property_string(lv_t lv, char const *property)
static void lvm_submit (char const *plugin_instance, char const *type_instance,
uint64_t ivalue)
{
static void lvm_submit (char const *plugin_instance, char const *type_instance,
uint64_t ivalue)
{
- value_t v;
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- v.gauge = (gauge_t) ivalue;
-
- vl.values = &v;
+ vl.values = &(value_t) { .gauge = (gauge_t) ivalue };
vl.values_len = 1;
sstrncpy(vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy(vl.host, hostname_g, sizeof (vl.host));
diff --git
a/src/madwifi.c
b/src/madwifi.c
index
053bd7f
..
f8065a6
100644
(file)
--- a/
src/madwifi.c
+++ b/
src/madwifi.c
@@
-538,7
+538,7
@@
static int madwifi_config (const char *key, const char *value)
static void submit (const char *dev, const char *type, const char *ti1,
static void submit (const char *dev, const char *type, const char *ti1,
- const char *ti2, value_t *val,
in
t len)
+ const char *ti2, value_t *val,
size_
t len)
{
value_list_t vl = VALUE_LIST_INIT;
{
value_list_t vl = VALUE_LIST_INIT;
@@
-558,11
+558,9
@@
static void submit (const char *dev, const char *type, const char *ti1,
}
static void submit_derive (const char *dev, const char *type, const char *ti1,
}
static void submit_derive (const char *dev, const char *type, const char *ti1,
- const char *ti2, derive_t val)
+ const char *ti2, derive_t val
ue
)
{
{
- value_t item;
- item.derive = val;
- submit (dev, type, ti1, ti2, &item, 1);
+ submit (dev, type, ti1, ti2, &(value_t) { .derive = value }, 1);
}
static void submit_derive2 (const char *dev, const char *type, const char *ti1,
}
static void submit_derive2 (const char *dev, const char *type, const char *ti1,
@@
-575,11
+573,9
@@
static void submit_derive2 (const char *dev, const char *type, const char *ti1,
}
static void submit_gauge (const char *dev, const char *type, const char *ti1,
}
static void submit_gauge (const char *dev, const char *type, const char *ti1,
- const char *ti2, gauge_t val)
+ const char *ti2, gauge_t val
ue
)
{
{
- value_t item;
- item.gauge = val;
- submit (dev, type, ti1, ti2, &item, 1);
+ submit (dev, type, ti1, ti2, &(value_t) { .gauge = value }, 1);
}
static void submit_antx (const char *dev, const char *name,
}
static void submit_antx (const char *dev, const char *name,
diff --git
a/src/mbmon.c
b/src/mbmon.c
index
9629b89
..
b72be89
100644
(file)
--- a/
src/mbmon.c
+++ b/
src/mbmon.c
@@
-218,12
+218,9
@@
static int mbmon_config (const char *key, const char *value)
static void mbmon_submit (const char *type, const char *type_instance,
double value)
{
static void mbmon_submit (const char *type, const char *type_instance,
double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "mbmon", sizeof (vl.plugin));
diff --git
a/src/md.c
b/src/md.c
index
44cad2e
..
db85c46
100644
(file)
--- a/
src/md.c
+++ b/
src/md.c
@@
-72,12
+72,9
@@
static int md_config (const char *key, const char *value)
static void md_submit (const int minor, const char *type_instance,
gauge_t value)
{
static void md_submit (const int minor, const char *type_instance,
gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "md", sizeof (vl.plugin));
diff --git
a/src/memcachec.c
b/src/memcachec.c
index
dff5546
..
97e75c0
100644
(file)
--- a/
src/memcachec.c
+++ b/
src/memcachec.c
@@
-441,14
+441,11
@@
static int cmc_init (void) /* {{{ */
} /* }}} int cmc_init */
static void cmc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */
} /* }}} int cmc_init */
static void cmc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */
-
const cu_match_value_t *mv
)
+
value_t value
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0] = mv->value;
-
- vl.values = values;
+ vl.values = &value;
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "memcachec", sizeof (vl.plugin));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "memcachec", sizeof (vl.plugin));
@@
-496,7
+493,7
@@
static int cmc_read_page (web_page_t *wp) /* {{{ */
continue;
}
continue;
}
- cmc_submit (wp, wm, mv);
+ cmc_submit (wp, wm, mv
->value
);
match_value_reset (mv);
} /* for (wm = wp->matches; wm != NULL; wm = wm->next) */
match_value_reset (mv);
} /* for (wm = wp->matches; wm != NULL; wm = wm->next) */
diff --git
a/src/memcached.c
b/src/memcached.c
index
d83d4c8
..
6d503ea
100644
(file)
--- a/
src/memcached.c
+++ b/
src/memcached.c
@@
-262,13
+262,10
@@
static void memcached_init_vl (value_list_t *vl, memcached_t const *st)
static void submit_derive (const char *type, const char *type_inst,
derive_t value, memcached_t *st)
{
static void submit_derive (const char *type, const char *type_inst,
derive_t value, memcached_t *st)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- memcached_init_vl (&vl, st);
-
- values[0].derive = value;
- vl.values = values;
+ memcached_init_vl (&vl, st);
+ vl.values = &(value_t) { .derive = value };
vl.values_len = 1;
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)
vl.values_len = 1;
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)
@@
-299,13
+296,10
@@
static void submit_derive2 (const char *type, const char *type_inst,
static void submit_gauge (const char *type, const char *type_inst,
gauge_t value, memcached_t *st)
{
static void submit_gauge (const char *type, const char *type_inst,
gauge_t value, memcached_t *st)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- memcached_init_vl (&vl, st);
-
- values[0].gauge = value;
- vl.values = values;
+ memcached_init_vl (&vl, st);
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)
vl.values_len = 1;
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)
diff --git
a/src/mic.c
b/src/mic.c
index
3e31889
..
5ec382b
100644
(file)
--- a/
src/mic.c
+++ b/
src/mic.c
@@
-150,17
+150,15
@@
static int mic_config (const char *key, const char *value) {
return (0);
}
return (0);
}
-static void mic_submit_memory_use(int micnumber, const char *type_instance, U32 val)
+static void mic_submit_memory_use(int micnumber, const char *type_instance, U32 val
ue
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
/* MicAccessAPI reports KB's of memory, adjust for this */
value_list_t vl = VALUE_LIST_INIT;
/* MicAccessAPI reports KB's of memory, adjust for this */
- DEBUG("mic plugin: Memory Value Report; %u %lf",val,((gauge_t)val)*1024.0);
- values[0].gauge = ((gauge_t)val)*1024.0;
+ DEBUG("mic plugin: Memory Value Report; %u %lf",value,((gauge_t)value)*1024.0);
- vl.values
=values
;
- vl.values_len
=
1;
+ 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));
strncpy (vl.host, hostname_g, sizeof (vl.host));
strncpy (vl.plugin, "mic", sizeof (vl.plugin));
@@
-190,15
+188,12
@@
static int mic_read_memory(int mic)
return (0);
}
return (0);
}
-static void mic_submit_temp(int micnumber, const char *type, gauge_t val)
+static void mic_submit_temp(int micnumber, const char *type, gauge_t val
ue
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = val;
-
- vl.values=values;
- vl.values_len=1;
+ vl.values = &(value_t) { .gauge = value };
+ vl.values_len = 1;
strncpy (vl.host, hostname_g, sizeof (vl.host));
strncpy (vl.plugin, "mic", sizeof (vl.plugin));
strncpy (vl.host, hostname_g, sizeof (vl.host));
strncpy (vl.plugin, "mic", sizeof (vl.plugin));
@@
-237,15
+232,12
@@
static int mic_read_temps(int mic)
}
static void mic_submit_cpu(int micnumber, const char *type_instance,
}
static void mic_submit_cpu(int micnumber, const char *type_instance,
- int core, derive_t val)
+ int core, derive_t val
ue
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = val;
-
- vl.values=values;
- vl.values_len=1;
+ vl.values = &(value_t) { .derive = value };
+ vl.values_len = 1;
strncpy (vl.host, hostname_g, sizeof (vl.host));
strncpy (vl.plugin, "mic", sizeof (vl.plugin));
strncpy (vl.host, hostname_g, sizeof (vl.host));
strncpy (vl.plugin, "mic", sizeof (vl.plugin));
@@
-296,15
+288,12
@@
static int mic_read_cpu(int mic)
return (0);
}
return (0);
}
-static void mic_submit_power(int micnumber, const char *type, const char *type_instance, gauge_t val)
+static void mic_submit_power(int micnumber, const char *type, const char *type_instance, gauge_t val
ue
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = val;
-
- vl.values=values;
- vl.values_len=1;
+ vl.values = &(value_t) { .gauge = value };
+ vl.values_len = 1;
strncpy (vl.host, hostname_g, sizeof (vl.host));
strncpy (vl.plugin, "mic", sizeof (vl.plugin));
strncpy (vl.host, hostname_g, sizeof (vl.host));
strncpy (vl.plugin, "mic", sizeof (vl.plugin));
@@
-358,13
+347,13
@@
static int mic_read (void)
U32 ret;
int error;
U32 ret;
int error;
- error
=
0;
- for (int i
=
0;i<num_mics;i++) {
+ error
=
0;
+ for (int i
=
0;i<num_mics;i++) {
ret = MicInitAdapter(&mic_handle,&mics[i]);
if (ret != MIC_ACCESS_API_SUCCESS) {
ERROR("mic plugin: Problem initializing MicAdapter: %s",
MicGetErrorString(ret));
ret = MicInitAdapter(&mic_handle,&mics[i]);
if (ret != MIC_ACCESS_API_SUCCESS) {
ERROR("mic plugin: Problem initializing MicAdapter: %s",
MicGetErrorString(ret));
- error
=
1;
+ error
=
1;
}
if (error == 0 && show_memory)
}
if (error == 0 && show_memory)
@@
-383,12
+372,12
@@
static int mic_read (void)
if (ret != MIC_ACCESS_API_SUCCESS) {
ERROR("mic plugin: Problem closing MicAdapter: %s",
MicGetErrorString(ret));
if (ret != MIC_ACCESS_API_SUCCESS) {
ERROR("mic plugin: Problem closing MicAdapter: %s",
MicGetErrorString(ret));
- error
=
2;
+ error
=
2;
break;
}
}
if (num_mics==0)
break;
}
}
if (num_mics==0)
- error
=
3;
+ error
=
3;
return error;
}
return error;
}
diff --git
a/src/multimeter.c
b/src/multimeter.c
index
02fe1ad
..
2ffcc8f
100644
(file)
--- a/
src/multimeter.c
+++ b/
src/multimeter.c
@@
-193,12
+193,9
@@
static int multimeter_init (void)
static void multimeter_submit (double value)
{
static void multimeter_submit (double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "multimeter", sizeof (vl.plugin));
diff --git
a/src/mysql.c
b/src/mysql.c
index
3bd8cb9
..
d9826d9
100644
(file)
--- a/
src/mysql.c
+++ b/
src/mysql.c
@@
-365,31
+365,16
@@
static void submit (const char *type, const char *type_instance,
plugin_dispatch_values (&vl);
} /* submit */
plugin_dispatch_values (&vl);
} /* submit */
-static void counter_submit (const char *type, const char *type_instance,
- derive_t value, mysql_database_t *db)
-{
- value_t values[1];
-
- values[0].derive = value;
- submit (type, type_instance, values, STATIC_ARRAY_SIZE (values), db);
-} /* void counter_submit */
-
static void gauge_submit (const char *type, const char *type_instance,
gauge_t value, mysql_database_t *db)
{
static void gauge_submit (const char *type, const char *type_instance,
gauge_t value, mysql_database_t *db)
{
- value_t values[1];
-
- values[0].gauge = value;
- submit (type, type_instance, values, STATIC_ARRAY_SIZE (values), db);
+ submit (type, type_instance, &(value_t) { .gauge = value }, 1, db);
} /* void gauge_submit */
static void derive_submit (const char *type, const char *type_instance,
derive_t value, mysql_database_t *db)
{
} /* void gauge_submit */
static void derive_submit (const char *type, const char *type_instance,
derive_t value, mysql_database_t *db)
{
- value_t values[1];
-
- values[0].derive = value;
- submit (type, type_instance, values, STATIC_ARRAY_SIZE (values), db);
+ submit (type, type_instance, &(value_t) { .derive = value }, 1, db);
} /* void derive_submit */
static void traffic_submit (derive_t rx, derive_t tx, mysql_database_t *db)
} /* void derive_submit */
static void traffic_submit (derive_t rx, derive_t tx, mysql_database_t *db)
@@
-462,7
+447,7
@@
static int mysql_read_master_stats (mysql_database_t *db, MYSQL *con)
}
position = atoll (row[1]);
}
position = atoll (row[1]);
-
counter
_submit ("mysql_log_position", "master-bin", position, db);
+
derive
_submit ("mysql_log_position", "master-bin", position, db);
row = mysql_fetch_row (res);
if (row != NULL)
row = mysql_fetch_row (res);
if (row != NULL)
@@
-520,10
+505,10
@@
static int mysql_read_slave_stats (mysql_database_t *db, MYSQL *con)
double gauge;
counter = atoll (row[READ_MASTER_LOG_POS_IDX]);
double gauge;
counter = atoll (row[READ_MASTER_LOG_POS_IDX]);
-
counter
_submit ("mysql_log_position", "slave-read", counter, db);
+
derive
_submit ("mysql_log_position", "slave-read", counter, db);
counter = atoll (row[EXEC_MASTER_LOG_POS_IDX]);
counter = atoll (row[EXEC_MASTER_LOG_POS_IDX]);
-
counter
_submit ("mysql_log_position", "slave-exec", counter, db);
+
derive
_submit ("mysql_log_position", "slave-exec", counter, db);
if (row[SECONDS_BEHIND_MASTER_IDX] != NULL)
{
if (row[SECONDS_BEHIND_MASTER_IDX] != NULL)
{
@@
-673,7
+658,7
@@
static int mysql_read_innodb_stats (mysql_database_t *db, MYSQL *con)
switch (metrics[i].ds_type) {
case DS_TYPE_COUNTER:
switch (metrics[i].ds_type) {
case DS_TYPE_COUNTER:
-
counter
_submit(metrics[i].type, key, (counter_t)val, db);
+
derive
_submit(metrics[i].type, key, (counter_t)val, db);
break;
case DS_TYPE_GAUGE:
gauge_submit(metrics[i].type, key, (gauge_t)val, db);
break;
case DS_TYPE_GAUGE:
gauge_submit(metrics[i].type, key, (gauge_t)val, db);
@@
-836,7
+821,7
@@
static int mysql_read (user_data_t *ud)
/* Ignore `prepared statements' */
if (strncmp (key, "Com_stmt_", strlen ("Com_stmt_")) != 0)
/* Ignore `prepared statements' */
if (strncmp (key, "Com_stmt_", strlen ("Com_stmt_")) != 0)
-
counter
_submit ("mysql_commands",
+
derive
_submit ("mysql_commands",
key + strlen ("Com_"),
val, db);
}
key + strlen ("Com_"),
val, db);
}
@@
-846,7
+831,7
@@
static int mysql_read (user_data_t *ud)
if (val == 0ULL)
continue;
if (val == 0ULL)
continue;
-
counter
_submit ("mysql_handler",
+
derive
_submit ("mysql_handler",
key + strlen ("Handler_"),
val, db);
}
key + strlen ("Handler_"),
val, db);
}
@@
-887,7
+872,7
@@
static int mysql_read (user_data_t *ud)
else if (strncmp (key, "Table_locks_",
strlen ("Table_locks_")) == 0)
{
else if (strncmp (key, "Table_locks_",
strlen ("Table_locks_")) == 0)
{
-
counter
_submit ("mysql_locks",
+
derive
_submit ("mysql_locks",
key + strlen ("Table_locks_"),
val, db);
}
key + strlen ("Table_locks_"),
val, db);
}
@@
-899,7
+884,7
@@
static int mysql_read (user_data_t *ud)
else if (strcmp (key, "Innodb_buffer_pool_pages_dirty") == 0)
gauge_submit ("mysql_bpool_pages", "dirty", val, db);
else if (strcmp (key, "Innodb_buffer_pool_pages_flushed") == 0)
else if (strcmp (key, "Innodb_buffer_pool_pages_dirty") == 0)
gauge_submit ("mysql_bpool_pages", "dirty", val, db);
else if (strcmp (key, "Innodb_buffer_pool_pages_flushed") == 0)
-
counter
_submit ("mysql_bpool_counters", "pages_flushed", val, db);
+
derive
_submit ("mysql_bpool_counters", "pages_flushed", val, db);
else if (strcmp (key, "Innodb_buffer_pool_pages_free") == 0)
gauge_submit ("mysql_bpool_pages", "free", val, db);
else if (strcmp (key, "Innodb_buffer_pool_pages_misc") == 0)
else if (strcmp (key, "Innodb_buffer_pool_pages_free") == 0)
gauge_submit ("mysql_bpool_pages", "free", val, db);
else if (strcmp (key, "Innodb_buffer_pool_pages_misc") == 0)
@@
-907,19
+892,19
@@
static int mysql_read (user_data_t *ud)
else if (strcmp (key, "Innodb_buffer_pool_pages_total") == 0)
gauge_submit ("mysql_bpool_pages", "total", val, db);
else if (strcmp (key, "Innodb_buffer_pool_read_ahead_rnd") == 0)
else if (strcmp (key, "Innodb_buffer_pool_pages_total") == 0)
gauge_submit ("mysql_bpool_pages", "total", val, db);
else if (strcmp (key, "Innodb_buffer_pool_read_ahead_rnd") == 0)
-
counter
_submit ("mysql_bpool_counters", "read_ahead_rnd", val, db);
+
derive
_submit ("mysql_bpool_counters", "read_ahead_rnd", val, db);
else if (strcmp (key, "Innodb_buffer_pool_read_ahead") == 0)
else if (strcmp (key, "Innodb_buffer_pool_read_ahead") == 0)
-
counter
_submit ("mysql_bpool_counters", "read_ahead", val, db);
+
derive
_submit ("mysql_bpool_counters", "read_ahead", val, db);
else if (strcmp (key, "Innodb_buffer_pool_read_ahead_evicted") == 0)
else if (strcmp (key, "Innodb_buffer_pool_read_ahead_evicted") == 0)
-
counter
_submit ("mysql_bpool_counters", "read_ahead_evicted", val, db);
+
derive
_submit ("mysql_bpool_counters", "read_ahead_evicted", val, db);
else if (strcmp (key, "Innodb_buffer_pool_read_requests") == 0)
else if (strcmp (key, "Innodb_buffer_pool_read_requests") == 0)
-
counter
_submit ("mysql_bpool_counters", "read_requests", val, db);
+
derive
_submit ("mysql_bpool_counters", "read_requests", val, db);
else if (strcmp (key, "Innodb_buffer_pool_reads") == 0)
else if (strcmp (key, "Innodb_buffer_pool_reads") == 0)
-
counter
_submit ("mysql_bpool_counters", "reads", val, db);
+
derive
_submit ("mysql_bpool_counters", "reads", val, db);
else if (strcmp (key, "Innodb_buffer_pool_wait_free") == 0)
else if (strcmp (key, "Innodb_buffer_pool_wait_free") == 0)
-
counter
_submit ("mysql_bpool_counters", "wait_free", val, db);
+
derive
_submit ("mysql_bpool_counters", "wait_free", val, db);
else if (strcmp (key, "Innodb_buffer_pool_write_requests") == 0)
else if (strcmp (key, "Innodb_buffer_pool_write_requests") == 0)
-
counter
_submit ("mysql_bpool_counters", "write_requests", val, db);
+
derive
_submit ("mysql_bpool_counters", "write_requests", val, db);
else if (strcmp (key, "Innodb_buffer_pool_bytes_data") == 0)
gauge_submit ("mysql_bpool_bytes", "data", val, db);
else if (strcmp (key, "Innodb_buffer_pool_bytes_dirty") == 0)
else if (strcmp (key, "Innodb_buffer_pool_bytes_data") == 0)
gauge_submit ("mysql_bpool_bytes", "data", val, db);
else if (strcmp (key, "Innodb_buffer_pool_bytes_dirty") == 0)
@@
-927,80
+912,80
@@
static int mysql_read (user_data_t *ud)
/* data */
if (strcmp (key, "Innodb_data_fsyncs") == 0)
/* data */
if (strcmp (key, "Innodb_data_fsyncs") == 0)
-
counter
_submit ("mysql_innodb_data", "fsyncs", val, db);
+
derive
_submit ("mysql_innodb_data", "fsyncs", val, db);
else if (strcmp (key, "Innodb_data_read") == 0)
else if (strcmp (key, "Innodb_data_read") == 0)
-
counter
_submit ("mysql_innodb_data", "read", val, db);
+
derive
_submit ("mysql_innodb_data", "read", val, db);
else if (strcmp (key, "Innodb_data_reads") == 0)
else if (strcmp (key, "Innodb_data_reads") == 0)
-
counter
_submit ("mysql_innodb_data", "reads", val, db);
+
derive
_submit ("mysql_innodb_data", "reads", val, db);
else if (strcmp (key, "Innodb_data_writes") == 0)
else if (strcmp (key, "Innodb_data_writes") == 0)
-
counter
_submit ("mysql_innodb_data", "writes", val, db);
+
derive
_submit ("mysql_innodb_data", "writes", val, db);
else if (strcmp (key, "Innodb_data_written") == 0)
else if (strcmp (key, "Innodb_data_written") == 0)
-
counter
_submit ("mysql_innodb_data", "written", val, db);
+
derive
_submit ("mysql_innodb_data", "written", val, db);
/* double write */
else if (strcmp (key, "Innodb_dblwr_writes") == 0)
/* double write */
else if (strcmp (key, "Innodb_dblwr_writes") == 0)
-
counter
_submit ("mysql_innodb_dblwr", "writes", val, db);
+
derive
_submit ("mysql_innodb_dblwr", "writes", val, db);
else if (strcmp (key, "Innodb_dblwr_pages_written") == 0)
else if (strcmp (key, "Innodb_dblwr_pages_written") == 0)
-
counter
_submit ("mysql_innodb_dblwr", "written", val, db);
+
derive
_submit ("mysql_innodb_dblwr", "written", val, db);
else if (strcmp (key, "Innodb_dblwr_page_size") == 0)
gauge_submit ("mysql_innodb_dblwr", "page_size", val, db);
/* log */
else if (strcmp (key, "Innodb_log_waits") == 0)
else if (strcmp (key, "Innodb_dblwr_page_size") == 0)
gauge_submit ("mysql_innodb_dblwr", "page_size", val, db);
/* log */
else if (strcmp (key, "Innodb_log_waits") == 0)
-
counter
_submit ("mysql_innodb_log", "waits", val, db);
+
derive
_submit ("mysql_innodb_log", "waits", val, db);
else if (strcmp (key, "Innodb_log_write_requests") == 0)
else if (strcmp (key, "Innodb_log_write_requests") == 0)
-
counter
_submit ("mysql_innodb_log", "write_requests", val, db);
+
derive
_submit ("mysql_innodb_log", "write_requests", val, db);
else if (strcmp (key, "Innodb_log_writes") == 0)
else if (strcmp (key, "Innodb_log_writes") == 0)
-
counter
_submit ("mysql_innodb_log", "writes", val, db);
+
derive
_submit ("mysql_innodb_log", "writes", val, db);
else if (strcmp (key, "Innodb_os_log_fsyncs") == 0)
else if (strcmp (key, "Innodb_os_log_fsyncs") == 0)
-
counter
_submit ("mysql_innodb_log", "fsyncs", val, db);
+
derive
_submit ("mysql_innodb_log", "fsyncs", val, db);
else if (strcmp (key, "Innodb_os_log_written") == 0)
else if (strcmp (key, "Innodb_os_log_written") == 0)
-
counter
_submit ("mysql_innodb_log", "written", val, db);
+
derive
_submit ("mysql_innodb_log", "written", val, db);
/* pages */
else if (strcmp (key, "Innodb_pages_created") == 0)
/* pages */
else if (strcmp (key, "Innodb_pages_created") == 0)
-
counter
_submit ("mysql_innodb_pages", "created", val, db);
+
derive
_submit ("mysql_innodb_pages", "created", val, db);
else if (strcmp (key, "Innodb_pages_read") == 0)
else if (strcmp (key, "Innodb_pages_read") == 0)
-
counter
_submit ("mysql_innodb_pages", "read", val, db);
+
derive
_submit ("mysql_innodb_pages", "read", val, db);
else if (strcmp (key, "Innodb_pages_written") == 0)
else if (strcmp (key, "Innodb_pages_written") == 0)
-
counter
_submit ("mysql_innodb_pages", "written", val, db);
+
derive
_submit ("mysql_innodb_pages", "written", val, db);
/* row lock */
else if (strcmp (key, "Innodb_row_lock_time") == 0)
/* row lock */
else if (strcmp (key, "Innodb_row_lock_time") == 0)
-
counter
_submit ("mysql_innodb_row_lock", "time", val, db);
+
derive
_submit ("mysql_innodb_row_lock", "time", val, db);
else if (strcmp (key, "Innodb_row_lock_waits") == 0)
else if (strcmp (key, "Innodb_row_lock_waits") == 0)
-
counter
_submit ("mysql_innodb_row_lock", "waits", val, db);
+
derive
_submit ("mysql_innodb_row_lock", "waits", val, db);
/* rows */
else if (strcmp (key, "Innodb_rows_deleted") == 0)
/* rows */
else if (strcmp (key, "Innodb_rows_deleted") == 0)
-
counter
_submit ("mysql_innodb_rows", "deleted", val, db);
+
derive
_submit ("mysql_innodb_rows", "deleted", val, db);
else if (strcmp (key, "Innodb_rows_inserted") == 0)
else if (strcmp (key, "Innodb_rows_inserted") == 0)
-
counter
_submit ("mysql_innodb_rows", "inserted", val, db);
+
derive
_submit ("mysql_innodb_rows", "inserted", val, db);
else if (strcmp (key, "Innodb_rows_read") == 0)
else if (strcmp (key, "Innodb_rows_read") == 0)
-
counter
_submit ("mysql_innodb_rows", "read", val, db);
+
derive
_submit ("mysql_innodb_rows", "read", val, db);
else if (strcmp (key, "Innodb_rows_updated") == 0)
else if (strcmp (key, "Innodb_rows_updated") == 0)
-
counter
_submit ("mysql_innodb_rows", "updated", val, db);
+
derive
_submit ("mysql_innodb_rows", "updated", val, db);
}
else if (strncmp (key, "Select_", strlen ("Select_")) == 0)
{
}
else if (strncmp (key, "Select_", strlen ("Select_")) == 0)
{
-
counter
_submit ("mysql_select", key + strlen ("Select_"),
+
derive
_submit ("mysql_select", key + strlen ("Select_"),
val, db);
}
else if (strncmp (key, "Sort_", strlen ("Sort_")) == 0)
{
if (strcmp (key, "Sort_merge_passes") == 0)
val, db);
}
else if (strncmp (key, "Sort_", strlen ("Sort_")) == 0)
{
if (strcmp (key, "Sort_merge_passes") == 0)
-
counter
_submit ("mysql_sort_merge_passes", NULL, val, db);
+
derive
_submit ("mysql_sort_merge_passes", NULL, val, db);
else if (strcmp (key, "Sort_rows") == 0)
else if (strcmp (key, "Sort_rows") == 0)
-
counter
_submit ("mysql_sort_rows", NULL, val, db);
+
derive
_submit ("mysql_sort_rows", NULL, val, db);
else if (strcmp (key, "Sort_range") == 0)
else if (strcmp (key, "Sort_range") == 0)
-
counter
_submit ("mysql_sort", "range", val, db);
+
derive
_submit ("mysql_sort", "range", val, db);
else if (strcmp (key, "Sort_scan") == 0)
else if (strcmp (key, "Sort_scan") == 0)
-
counter
_submit ("mysql_sort", "scan", val, db);
+
derive
_submit ("mysql_sort", "scan", val, db);
}
else if (strncmp (key, "Slow_queries", strlen ("Slow_queries")) == 0)
{
}
else if (strncmp (key, "Slow_queries", strlen ("Slow_queries")) == 0)
{
-
counter
_submit ("mysql_slow_queries", NULL , val, db);
+
derive
_submit ("mysql_slow_queries", NULL , val, db);
}
}
mysql_free_result (res); res = NULL;
}
}
mysql_free_result (res); res = NULL;
diff --git
a/src/netapp.c
b/src/netapp.c
index
bf4c286
..
f238a6d
100644
(file)
--- a/
src/netapp.c
+++ b/
src/netapp.c
@@
-617,7
+617,7
@@
static data_volume_perf_t *get_volume_perf (cfg_volume_perf_t *cvp, /* {{{ */
static int submit_values (const char *host, /* {{{ */
const char *plugin_inst,
const char *type, const char *type_inst,
static int submit_values (const char *host, /* {{{ */
const char *plugin_inst,
const char *type, const char *type_inst,
- value_t *values,
in
t values_len,
+ value_t *values,
size_
t values_len,
cdtime_t timestamp, cdtime_t interval)
{
value_list_t vl = VALUE_LIST_INIT;
cdtime_t timestamp, cdtime_t interval)
{
value_list_t vl = VALUE_LIST_INIT;
@@
-662,12
+662,8
@@
static int submit_derive (const char *host, const char *plugin_inst, /* {{{ */
const char *type, const char *type_inst, derive_t counter,
cdtime_t timestamp, cdtime_t interval)
{
const char *type, const char *type_inst, derive_t counter,
cdtime_t timestamp, cdtime_t interval)
{
- value_t v;
-
- v.derive = counter;
-
return (submit_values (host, plugin_inst, type, type_inst,
return (submit_values (host, plugin_inst, type, type_inst,
- &
v
, 1, timestamp, interval));
+ &
(value_t) { .derive = counter }
, 1, timestamp, interval));
} /* }}} int submit_derive */
static int submit_two_gauge (const char *host, const char *plugin_inst, /* {{{ */
} /* }}} int submit_derive */
static int submit_two_gauge (const char *host, const char *plugin_inst, /* {{{ */
@@
-687,12
+683,8
@@
static int submit_double (const char *host, const char *plugin_inst, /* {{{ */
const char *type, const char *type_inst, double d,
cdtime_t timestamp, cdtime_t interval)
{
const char *type, const char *type_inst, double d,
cdtime_t timestamp, cdtime_t interval)
{
- value_t v;
-
- v.gauge = (gauge_t) d;
-
return (submit_values (host, plugin_inst, type, type_inst,
return (submit_values (host, plugin_inst, type, type_inst,
- &
v
, 1, timestamp, interval));
+ &
(value_t) { .gauge = counter }
, 1, timestamp, interval));
} /* }}} int submit_uint64 */
/* Calculate hit ratio from old and new counters and submit the resulting
} /* }}} int submit_uint64 */
/* Calculate hit ratio from old and new counters and submit the resulting
@@
-707,7
+699,7
@@
static int submit_cache_ratio (const char *host, /* {{{ */
cdtime_t timestamp,
cdtime_t interval)
{
cdtime_t timestamp,
cdtime_t interval)
{
- value_t v;
+ value_t v
= { .gauge = NAN }
;
if ((new_hits >= old_hits) && (new_misses >= old_misses)) {
uint64_t hits;
if ((new_hits >= old_hits) && (new_misses >= old_misses)) {
uint64_t hits;
@@
-717,8
+709,6
@@
static int submit_cache_ratio (const char *host, /* {{{ */
misses = new_misses - old_misses;
v.gauge = 100.0 * ((gauge_t) hits) / ((gauge_t) (hits + misses));
misses = new_misses - old_misses;
v.gauge = 100.0 * ((gauge_t) hits) / ((gauge_t) (hits + misses));
- } else {
- v.gauge = NAN;
}
return (submit_values (host, plugin_inst, "cache_ratio", type_inst,
}
return (submit_values (host, plugin_inst, "cache_ratio", type_inst,
diff --git
a/src/netlink.c
b/src/netlink.c
index
cfca46f
..
dee6268
100644
(file)
--- a/
src/netlink.c
+++ b/
src/netlink.c
@@
-194,12
+194,9
@@
static int check_ignorelist (const char *dev,
static void submit_one (const char *dev, const char *type,
const char *type_instance, derive_t value)
{
static void submit_one (const char *dev, const char *type,
const char *type_instance, derive_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "netlink", sizeof (vl.plugin));
diff --git
a/src/nginx.c
b/src/nginx.c
index
16ce3d5
..
3850acc
100644
(file)
--- a/
src/nginx.c
+++ b/
src/nginx.c
@@
-210,7
+210,7
@@
static void submit (const char *type, const char *inst, long long value)
return;
vl.values = values;
return;
vl.values = values;
- vl.values_len =
1
;
+ 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.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "nginx", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
diff --git
a/src/ntpd.c
b/src/ntpd.c
index
30f29c9
..
ccdecd9
100644
(file)
--- a/
src/ntpd.c
+++ b/
src/ntpd.c
@@
-313,12
+313,9
@@
static int ntpd_config (const char *key, const char *value)
static void ntpd_submit (const char *type, const char *type_inst, gauge_t value)
{
static void ntpd_submit (const char *type, const char *type_inst, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ntpd", sizeof (vl.plugin));
diff --git
a/src/nut.c
b/src/nut.c
index
b5c6b41
..
29074c4
100644
(file)
--- a/
src/nut.c
+++ b/
src/nut.c
@@
-120,13
+120,10
@@
static int nut_config (const char *key, const char *value)
static void nut_submit (nut_ups_t *ups, const char *type,
const char *type_instance, gauge_t value)
{
static void nut_submit (nut_ups_t *ups, const char *type,
const char *type_instance, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
- vl.values_len = STATIC_ARRAY_SIZE (values);
+ vl.values = &(value_t) { .gauge = value };
+ vl.values_len = 1;
sstrncpy (vl.host,
(strcasecmp (ups->hostname, "localhost") == 0)
? hostname_g
sstrncpy (vl.host,
(strcasecmp (ups->hostname, "localhost") == 0)
? hostname_g
diff --git
a/src/olsrd.c
b/src/olsrd.c
index
899ad3e
..
3bf7128
100644
(file)
--- a/
src/olsrd.c
+++ b/
src/olsrd.c
@@
-216,12
+216,9
@@
__attribute__ ((nonnull(2)))
static void olsrd_submit (const char *plugin_instance, /* {{{ */
const char *type, const char *type_instance, gauge_t value)
{
static void olsrd_submit (const char *plugin_instance, /* {{{ */
const char *type, const char *type_instance, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
diff --git
a/src/onewire.c
b/src/onewire.c
index
8bb2d81
..
0b4b6f5
100644
(file)
--- a/
src/onewire.c
+++ b/
src/onewire.c
@@
-336,7
+336,6
@@
static int cow_load_config (const char *key, const char *value)
static int cow_read_values (const char *path, const char *name,
const ow_family_features_t *family_info)
{
static int cow_read_values (const char *path, const char *name,
const ow_family_features_t *family_info)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
int success = 0;
value_list_t vl = VALUE_LIST_INIT;
int success = 0;
@@
-347,9
+346,6
@@
static int cow_read_values (const char *path, const char *name,
return 0;
}
return 0;
}
- vl.values = values;
- vl.values_len = 1;
-
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "onewire", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, name, sizeof (vl.plugin_instance));
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "onewire", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, name, sizeof (vl.plugin_instance));
@@
-381,7
+377,7
@@
static int cow_read_values (const char *path, const char *name,
DEBUG ("Read onewire device %s as %s", file, buffer);
endptr = NULL;
DEBUG ("Read onewire device %s as %s", file, buffer);
endptr = NULL;
-
values[0].gauge
= strtod (buffer, &endptr);
+
gauge_t g
= strtod (buffer, &endptr);
if (endptr == NULL)
{
ERROR ("onewire plugin: Buffer is not a number: %s", buffer);
if (endptr == NULL)
{
ERROR ("onewire plugin: Buffer is not a number: %s", buffer);
@@
-392,6
+388,9
@@
static int cow_read_values (const char *path, const char *name,
sstrncpy (vl.type_instance, family_info->features[i].type_instance,
sizeof (vl.type_instance));
sstrncpy (vl.type_instance, family_info->features[i].type_instance,
sizeof (vl.type_instance));
+ vl.values = &(value_t) { .gauge = g };
+ vl.values_len = 1;
+
plugin_dispatch_values (&vl);
success++;
plugin_dispatch_values (&vl);
success++;
@@
-495,7
+494,6
@@
static int cow_read_bus (const char *path)
static int cow_simple_read (void)
{
static int cow_simple_read (void)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
char *buffer;
size_t buffer_size;
value_list_t vl = VALUE_LIST_INIT;
char *buffer;
size_t buffer_size;
@@
-507,9
+505,6
@@
static int cow_simple_read (void)
/* traverse list and check entries */
for (traverse = direct_list; traverse != NULL; traverse = traverse->next)
{
/* traverse list and check entries */
for (traverse = direct_list; traverse != NULL; traverse = traverse->next)
{
- vl.values = values;
- vl.values_len = 1;
-
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));
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));
@@
-524,9
+519,8
@@
static int cow_simple_read (void)
}
DEBUG ("onewire plugin: Read onewire device %s as %s", traverse->path, buffer);
}
DEBUG ("onewire plugin: Read onewire device %s as %s", traverse->path, buffer);
-
endptr = NULL;
endptr = NULL;
-
values[0].gauge
= strtod (buffer, &endptr);
+
gauge_t g
= strtod (buffer, &endptr);
if (endptr == NULL)
{
ERROR ("onewire plugin: Buffer is not a number: %s", buffer);
if (endptr == NULL)
{
ERROR ("onewire plugin: Buffer is not a number: %s", buffer);
@@
-536,6
+530,9
@@
static int cow_simple_read (void)
sstrncpy (vl.type, traverse->file, sizeof (vl.type));
sstrncpy (vl.type_instance, "", sizeof (""));
sstrncpy (vl.type, traverse->file, sizeof (vl.type));
sstrncpy (vl.type_instance, "", sizeof (""));
+ vl.values = &(value_t) { .gauge = g };
+ vl.values_len = 1;
+
plugin_dispatch_values (&vl);
free (buffer);
} /* for (traverse) */
plugin_dispatch_values (&vl);
free (buffer);
} /* for (traverse) */
diff --git
a/src/openldap.c
b/src/openldap.c
index
066dabc
..
dd3226d
100644
(file)
--- a/
src/openldap.c
+++ b/
src/openldap.c
@@
-192,17
+192,13
@@
static void cldap_submit_value (const char *type, const char *type_instance, /*
static void cldap_submit_derive (const char *type, const char *type_instance, /* {{{ */
derive_t d, cldap_t *st)
{
static void cldap_submit_derive (const char *type, const char *type_instance, /* {{{ */
derive_t d, cldap_t *st)
{
- value_t v;
- v.derive = d;
- cldap_submit_value (type, type_instance, v, st);
+ cldap_submit_value (type, type_instance, (value_t) { .derive = d }, st);
} /* }}} void cldap_submit_derive */
static void cldap_submit_gauge (const char *type, const char *type_instance, /* {{{ */
gauge_t g, cldap_t *st)
{
} /* }}} void cldap_submit_derive */
static void cldap_submit_gauge (const char *type, const char *type_instance, /* {{{ */
gauge_t g, cldap_t *st)
{
- value_t v;
- v.gauge = g;
- cldap_submit_value (type, type_instance, v, st);
+ cldap_submit_value (type, type_instance, (value_t) { .gauge = g }, st);
} /* }}} void cldap_submit_gauge */
static int cldap_read_host (user_data_t *ud) /* {{{ */
} /* }}} void cldap_submit_gauge */
static int cldap_read_host (user_data_t *ud) /* {{{ */
diff --git
a/src/openvpn.c
b/src/openvpn.c
index
00ae736
..
69ab9fb
100644
(file)
--- a/
src/openvpn.c
+++ b/
src/openvpn.c
@@
-99,13
+99,10
@@
static int openvpn_strsplit (char *string, char **fields, size_t size)
static void numusers_submit (const char *pinst, const char *tinst,
gauge_t value)
{
static void numusers_submit (const char *pinst, const char *tinst,
gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
- vl.values_len = STATIC_ARRAY_SIZE (values);
+ 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));
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "openvpn", sizeof (vl.plugin));
sstrncpy (vl.type, "users", sizeof (vl.type));
diff --git
a/src/pinba.c
b/src/pinba.c
index
8a0902a
..
76b765b
100644
(file)
--- a/
src/pinba.c
+++ b/
src/pinba.c
@@
-677,38
+677,36
@@
static int plugin_shutdown (void) /* {{{ */
static int plugin_submit (const pinba_statnode_t *res) /* {{{ */
{
static int plugin_submit (const pinba_statnode_t *res) /* {{{ */
{
- value_t value;
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- vl.values = &value;
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_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));
- v
alue.derive = res->req_count
;
+ v
l.values = &(value_t) { .derive = res->req_count }
;
sstrncpy (vl.type, "total_requests", sizeof (vl.type));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "total_requests", sizeof (vl.type));
plugin_dispatch_values (&vl);
- v
alue.derive = float_counter_get (&res->req_time, /* factor = */ 1000)
;
+ v
l.values = &(value_t) { .derive = float_counter_get (&res->req_time, /* factor = */ 1000) }
;
sstrncpy (vl.type, "total_time_in_ms", sizeof (vl.type));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "total_time_in_ms", sizeof (vl.type));
plugin_dispatch_values (&vl);
- v
alue.derive = res->doc_size
;
+ v
l.values = &(value_t) { .derive = res->doc_size }
;
sstrncpy (vl.type, "total_bytes", sizeof (vl.type));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "total_bytes", sizeof (vl.type));
plugin_dispatch_values (&vl);
- v
alue.derive = float_counter_get (&res->ru_utime, /* factor = */ 100)
;
+ v
l.values = &(value_t) { .derive = float_counter_get (&res->ru_utime, /* factor = */ 100) }
;
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "user", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "user", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
- v
alue.derive = float_counter_get (&res->ru_stime, /* factor = */ 100)
;
+ v
l.values = &(value_t) { .derive = float_counter_get (&res->ru_stime, /* factor = */ 100) }
;
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "system", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "system", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
- v
alue.gauge = res->mem_peak
;
+ v
l.values = &(value_t) { .gauge = res->mem_peak }
;
sstrncpy (vl.type, "memory", sizeof (vl.type));
sstrncpy (vl.type_instance, "peak", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "memory", sizeof (vl.type));
sstrncpy (vl.type_instance, "peak", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
diff --git
a/src/ping.c
b/src/ping.c
index
5f66aab
..
39e9de5
100644
(file)
--- a/
src/ping.c
+++ b/
src/ping.c
@@
-615,12
+615,9
@@
static int ping_config (const char *key, const char *value) /* {{{ */
static void submit (const char *host, const char *type, /* {{{ */
gauge_t value)
{
static void submit (const char *host, const char *type, /* {{{ */
gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ping", sizeof (vl.plugin));
diff --git
a/src/powerdns.c
b/src/powerdns.c
index
f907d00
..
eb54180
100644
(file)
--- a/
src/powerdns.c
+++ b/
src/powerdns.c
@@
-300,10
+300,10
@@
static char *local_sockpath = NULL;
/* <https://doc.powerdns.com/md/recursor/stats/> */
static void submit (const char *plugin_instance, /* {{{ */
/* <https://doc.powerdns.com/md/recursor/stats/> */
static void submit (const char *plugin_instance, /* {{{ */
- const char *pdns_type, const char *value)
+ const char *pdns_type, const char *value
_str
)
{
value_list_t vl = VALUE_LIST_INIT;
{
value_list_t vl = VALUE_LIST_INIT;
- value_t value
s[1]
;
+ value_t value;
const char *type = NULL;
const char *type_instance = NULL;
const char *type = NULL;
const char *type_instance = NULL;
@@
-318,7
+318,7
@@
static void submit (const char *plugin_instance, /* {{{ */
if (i >= lookup_table_length)
{
INFO ("powerdns plugin: submit: Not found in lookup table: %s = %s;",
if (i >= lookup_table_length)
{
INFO ("powerdns plugin: submit: Not found in lookup table: %s = %s;",
- pdns_type, value);
+ pdns_type, value
_str
);
return;
}
return;
}
@@
-345,14
+345,14
@@
static void submit (const char *plugin_instance, /* {{{ */
return;
}
return;
}
- if (0 != parse_value (value
, &values[0]
, ds->ds[0].type))
+ if (0 != parse_value (value
_str, &value
, ds->ds[0].type))
{
ERROR ("powerdns plugin: Cannot convert `%s' "
{
ERROR ("powerdns plugin: Cannot convert `%s' "
- "to a number.", value);
+ "to a number.", value
_str
);
return;
}
return;
}
- vl.values =
values
;
+ vl.values =
&value
;
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "powerdns", sizeof (vl.plugin));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "powerdns", sizeof (vl.plugin));
diff --git
a/src/processes.c
b/src/processes.c
index
0513a15
..
f07785a
100644
(file)
--- a/
src/processes.c
+++ b/
src/processes.c
@@
-660,12
+660,9
@@
static int ps_init (void)
/* submit global state (e.g.: qty of zombies, running, etc..) */
static void ps_submit_state (const char *state, double value)
{
/* submit global state (e.g.: qty of zombies, running, etc..) */
static void ps_submit_state (const char *state, double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "processes", sizeof (vl.plugin));
@@
-784,12
+781,9
@@
static void ps_submit_proc_list (procstat_t *ps)
#if KERNEL_LINUX || KERNEL_SOLARIS
static void ps_submit_fork_rate (derive_t value)
{
#if KERNEL_LINUX || KERNEL_SOLARIS
static void ps_submit_fork_rate (derive_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy(vl.host, hostname_g, sizeof (vl.host));
sstrncpy(vl.plugin, "processes", sizeof (vl.plugin));
diff --git
a/src/protocols.c
b/src/protocols.c
index
208da8b
..
ae35c42
100644
(file)
--- a/
src/protocols.c
+++ b/
src/protocols.c
@@
-55,11
+55,11
@@
static ignorelist_t *values_list = NULL;
static void submit (const char *protocol_name,
const char *str_key, const char *str_value)
{
static void submit (const char *protocol_name,
const char *str_key, const char *str_value)
{
- value_t value
s[1]
;
+ value_t value;
value_list_t vl = VALUE_LIST_INIT;
int status;
value_list_t vl = VALUE_LIST_INIT;
int status;
- status = parse_value (str_value,
values
, DS_TYPE_DERIVE);
+ status = parse_value (str_value,
&value
, DS_TYPE_DERIVE);
if (status != 0)
{
ERROR ("protocols plugin: Parsing string as integer failed: %s",
if (status != 0)
{
ERROR ("protocols plugin: Parsing string as integer failed: %s",
@@
-67,7
+67,7
@@
static void submit (const char *protocol_name,
return;
}
return;
}
- vl.values =
values
;
+ vl.values =
&value
;
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "protocols", sizeof (vl.plugin));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "protocols", sizeof (vl.plugin));
diff --git
a/src/redis.c
b/src/redis.c
index
5214ecc
..
7f57571
100644
(file)
--- a/
src/redis.c
+++ b/
src/redis.c
@@
-252,12
+252,9
@@
static void redis_submit (char *plugin_instance,
const char *type, const char *type_instance,
value_t value) /* {{{ */
{
const char *type, const char *type_instance,
value_t value) /* {{{ */
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0] = value;
-
- vl.values = values;
+ vl.values = &value;
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "redis", sizeof (vl.plugin));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "redis", sizeof (vl.plugin));
diff --git
a/src/rrdcached.c
b/src/rrdcached.c
index
0425419
..
07eac7b
100644
(file)
--- a/
src/rrdcached.c
+++ b/
src/rrdcached.c
@@
-292,8
+292,9
@@
static int rc_read (void)
int status;
rrdc_stats_t *head;
int status;
rrdc_stats_t *head;
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
+ vl.values = &(value_t) { .gauge = NAN };
+ vl.values_len = 1;
if (daemon_address == NULL)
return (-1);
if (daemon_address == NULL)
return (-1);
@@
-301,9
+302,6
@@
static int rc_read (void)
if (!config_collect_stats)
return (-1);
if (!config_collect_stats)
return (-1);
- vl.values = values;
- vl.values_len = 1;
-
if ((strncmp ("unix:", daemon_address, strlen ("unix:")) == 0)
|| (daemon_address[0] == '/'))
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
if ((strncmp ("unix:", daemon_address, strlen ("unix:")) == 0)
|| (daemon_address[0] == '/'))
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
@@
-330,9
+328,9
@@
static int rc_read (void)
for (rrdc_stats_t *ptr = head; ptr != NULL; ptr = ptr->next)
{
if (ptr->type == RRDC_STATS_TYPE_GAUGE)
for (rrdc_stats_t *ptr = head; ptr != NULL; ptr = ptr->next)
{
if (ptr->type == RRDC_STATS_TYPE_GAUGE)
- values[0].gauge = (gauge_t) ptr->value.gauge;
+ v
l.v
alues[0].gauge = (gauge_t) ptr->value.gauge;
else if (ptr->type == RRDC_STATS_TYPE_COUNTER)
else if (ptr->type == RRDC_STATS_TYPE_COUNTER)
- values[0].counter = (counter_t) ptr->value.counter;
+ v
l.v
alues[0].counter = (counter_t) ptr->value.counter;
else
continue;
else
continue;
diff --git
a/src/sensors.c
b/src/sensors.c
index
4f3d0d6
..
f13b3ea
100644
(file)
--- a/
src/sensors.c
+++ b/
src/sensors.c
@@
-481,12
+481,11
@@
static int sensors_shutdown (void)
static void sensors_submit (const char *plugin_instance,
const char *type, const char *type_instance,
static void sensors_submit (const char *plugin_instance,
const char *type, const char *type_instance,
- double val)
+ double val
ue
)
{
char match_key[1024];
int status;
{
char match_key[1024];
int status;
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
status = ssnprintf (match_key, sizeof (match_key), "%s/%s-%s",
value_list_t vl = VALUE_LIST_INIT;
status = ssnprintf (match_key, sizeof (match_key), "%s/%s-%s",
@@
-501,9
+500,7
@@
static void sensors_submit (const char *plugin_instance,
return;
}
return;
}
- values[0].gauge = val;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
diff --git
a/src/sigrok.c
b/src/sigrok.c
index
4006455
..
5b85004
100644
(file)
--- a/
src/sigrok.c
+++ b/
src/sigrok.c
@@
-161,7
+161,6
@@
static void sigrok_feed_callback(const struct sr_dev_inst *sdi,
{
const struct sr_datafeed_analog *analog;
struct config_device *cfdev;
{
const struct sr_datafeed_analog *analog;
struct config_device *cfdev;
- value_t value;
value_list_t vl = VALUE_LIST_INIT;
/* Find this device's configuration. */
value_list_t vl = VALUE_LIST_INIT;
/* Find this device's configuration. */
@@
-199,8
+198,7
@@
static void sigrok_feed_callback(const struct sr_dev_inst *sdi,
/* Ignore all but the first sample on the first probe. */
analog = packet->payload;
/* Ignore all but the first sample on the first probe. */
analog = packet->payload;
- value.gauge = analog->data[0];
- vl.values = &value;
+ 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));
vl.values_len = 1;
sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "sigrok", sizeof(vl.plugin));
diff --git
a/src/smart.c
b/src/smart.c
index
752cb74
..
5b7a34b
100644
(file)
--- a/
src/smart.c
+++ b/
src/smart.c
@@
-86,12
+86,9
@@
static int smart_config (const char *key, const char *value)
static void smart_submit (const char *dev, const char *type,
const char *type_inst, double value)
{
static void smart_submit (const char *dev, const char *type,
const char *type_inst, double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "smart", sizeof (vl.plugin));
diff --git
a/src/statsd.c
b/src/statsd.c
index
9c138f9
..
82ae387
100644
(file)
--- a/
src/statsd.c
+++ b/
src/statsd.c
@@
-752,10
+752,9
@@
static int statsd_metric_clear_set_unsafe (statsd_metric_t *metric) /* {{{ */
/* Must hold metrics_lock when calling this function. */
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metric) /* {{{ */
{
/* Must hold metrics_lock when calling this function. */
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metric) /* {{{ */
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- vl.values =
values
;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "statsd", sizeof (vl.plugin));
@@
-772,7
+771,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
sstrncpy (vl.type_instance, name, sizeof (vl.type_instance));
if (metric->type == STATSD_GAUGE)
sstrncpy (vl.type_instance, name, sizeof (vl.type_instance));
if (metric->type == STATSD_GAUGE)
- values[0].gauge = (gauge_t) metric->value;
+ v
l.v
alues[0].gauge = (gauge_t) metric->value;
else if (metric->type == STATSD_TIMER)
{
_Bool have_events = (metric->updates_num > 0);
else if (metric->type == STATSD_TIMER)
{
_Bool have_events = (metric->updates_num > 0);
@@
-782,7
+781,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-average", name);
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-average", name);
- values[0].gauge = have_events
+ v
l.v
alues[0].gauge = have_events
? CDTIME_T_TO_DOUBLE (latency_counter_get_average (metric->latency))
: NAN;
plugin_dispatch_values (&vl);
? CDTIME_T_TO_DOUBLE (latency_counter_get_average (metric->latency))
: NAN;
plugin_dispatch_values (&vl);
@@
-790,7
+789,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
if (conf_timer_lower) {
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-lower", name);
if (conf_timer_lower) {
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-lower", name);
- values[0].gauge = have_events
+ v
l.v
alues[0].gauge = have_events
? CDTIME_T_TO_DOUBLE (latency_counter_get_min (metric->latency))
: NAN;
plugin_dispatch_values (&vl);
? CDTIME_T_TO_DOUBLE (latency_counter_get_min (metric->latency))
: NAN;
plugin_dispatch_values (&vl);
@@
-799,7
+798,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
if (conf_timer_upper) {
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-upper", name);
if (conf_timer_upper) {
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-upper", name);
- values[0].gauge = have_events
+ v
l.v
alues[0].gauge = have_events
? CDTIME_T_TO_DOUBLE (latency_counter_get_max (metric->latency))
: NAN;
plugin_dispatch_values (&vl);
? CDTIME_T_TO_DOUBLE (latency_counter_get_max (metric->latency))
: NAN;
plugin_dispatch_values (&vl);
@@
-808,7
+807,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
if (conf_timer_sum) {
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-sum", name);
if (conf_timer_sum) {
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-sum", name);
- values[0].gauge = have_events
+ v
l.v
alues[0].gauge = have_events
? CDTIME_T_TO_DOUBLE (latency_counter_get_sum (metric->latency))
: NAN;
plugin_dispatch_values (&vl);
? CDTIME_T_TO_DOUBLE (latency_counter_get_sum (metric->latency))
: NAN;
plugin_dispatch_values (&vl);
@@
-818,7
+817,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
{
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-percentile-%.0f", name, conf_timer_percentile[i]);
{
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-percentile-%.0f", name, conf_timer_percentile[i]);
- values[0].gauge = have_events
+ v
l.v
alues[0].gauge = have_events
? CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (metric->latency, conf_timer_percentile[i]))
: NAN;
plugin_dispatch_values (&vl);
? CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (metric->latency, conf_timer_percentile[i]))
: NAN;
plugin_dispatch_values (&vl);
@@
-830,7
+829,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
sstrncpy (vl.type, "gauge", sizeof (vl.type));
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-count", name);
sstrncpy (vl.type, "gauge", sizeof (vl.type));
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-count", name);
- values[0].gauge = latency_counter_get_num (metric->latency);
+ v
l.v
alues[0].gauge = latency_counter_get_num (metric->latency);
plugin_dispatch_values (&vl);
}
plugin_dispatch_values (&vl);
}
@@
-840,9
+839,9
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
else if (metric->type == STATSD_SET)
{
if (metric->set == NULL)
else if (metric->type == STATSD_SET)
{
if (metric->set == NULL)
- values[0].gauge = 0.0;
+ v
l.v
alues[0].gauge = 0.0;
else
else
- values[0].gauge = (gauge_t) c_avl_size (metric->set);
+ v
l.v
alues[0].gauge = (gauge_t) c_avl_size (metric->set);
}
else { /* STATSD_COUNTER */
gauge_t delta = nearbyint (metric->value);
}
else { /* STATSD_COUNTER */
gauge_t delta = nearbyint (metric->value);
@@
-854,7
+853,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
if (conf_counter_sum)
{
sstrncpy (vl.type, "count", sizeof (vl.type));
if (conf_counter_sum)
{
sstrncpy (vl.type, "count", sizeof (vl.type));
- values[0].gauge = delta;
+ v
l.v
alues[0].gauge = delta;
plugin_dispatch_values (&vl);
/* restore vl.type */
plugin_dispatch_values (&vl);
/* restore vl.type */
@@
-866,7
+865,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
metric->value -= delta;
metric->counter += (derive_t) delta;
metric->value -= delta;
metric->counter += (derive_t) delta;
- values[0].derive = metric->counter;
+ v
l.v
alues[0].derive = metric->counter;
}
return (plugin_dispatch_values (&vl));
}
return (plugin_dispatch_values (&vl));
diff --git
a/src/swap.c
b/src/swap.c
index
9c63e9b
..
3cc9516
100644
(file)
--- a/
src/swap.c
+++ b/
src/swap.c
@@
-194,11
+194,10
@@
static void swap_submit_usage (char const *plugin_instance, /* {{{ */
gauge_t used, gauge_t free,
char const *other_name, gauge_t other_value)
{
gauge_t used, gauge_t free,
char const *other_name, gauge_t other_value)
{
- value_t v[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- vl.values =
v
;
- vl.values_len =
STATIC_ARRAY_SIZE (v)
;
+ 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.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "swap", sizeof (vl.plugin));
if (plugin_instance != NULL)
@@
-222,12
+221,9
@@
static void swap_submit_derive (char const *type_instance, /* {{{ */
derive_t value)
{
value_list_t vl = VALUE_LIST_INIT;
derive_t value)
{
value_list_t vl = VALUE_LIST_INIT;
- value_t v[1];
- v[0].derive = value;
-
- vl.values = v;
- vl.values_len = STATIC_ARRAY_SIZE (v);
+ 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.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "swap", sizeof (vl.plugin));
sstrncpy (vl.type, "swap_io", sizeof (vl.type));
diff --git
a/src/target_v5upgrade.c
b/src/target_v5upgrade.c
index
f7baa3a
..
345ca73
100644
(file)
--- a/
src/target_v5upgrade.c
+++ b/
src/target_v5upgrade.c
@@
-53,7
+53,6
@@
static void v5_swap_instances (value_list_t *vl) /* {{{ */
static int v5_df (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
static int v5_df (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- value_t new_value;
/* Can't upgrade if both instances have been set. */
if ((vl->plugin_instance[0] != 0)
/* Can't upgrade if both instances have been set. */
if ((vl->plugin_instance[0] != 0)
@@
-64,7
+63,7
@@
static int v5_df (const data_set_t *ds, value_list_t *vl) /* {{{ */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
- new_vl.values = &
new_value
;
+ new_vl.values = &
(value_t) { .gauge = NAN }
;
new_vl.values_len = 1;
new_vl.meta = NULL;
new_vl.values_len = 1;
new_vl.meta = NULL;
@@
-113,7
+112,6
@@
static int v5_interface (const data_set_t *ds, value_list_t *vl) /* {{{ */
static int v5_mysql_qcache (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
static int v5_mysql_qcache (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- value_t new_value;
if (vl->values_len != 5)
return (FC_TARGET_STOP);
if (vl->values_len != 5)
return (FC_TARGET_STOP);
@@
-122,7
+120,7
@@
static int v5_mysql_qcache (const data_set_t *ds, value_list_t *vl) /* {{{ */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
- new_vl.values = &
new_value
;
+ new_vl.values = &
(value_t) { .gauge = NAN }
;
new_vl.values_len = 1;
new_vl.meta = NULL;
new_vl.values_len = 1;
new_vl.meta = NULL;
@@
-171,7
+169,6
@@
static int v5_mysql_qcache (const data_set_t *ds, value_list_t *vl) /* {{{ */
static int v5_mysql_threads (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
static int v5_mysql_threads (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- value_t new_value;
if (vl->values_len != 4)
return (FC_TARGET_STOP);
if (vl->values_len != 4)
return (FC_TARGET_STOP);
@@
-180,7
+177,7
@@
static int v5_mysql_threads (const data_set_t *ds, value_list_t *vl) /* {{{ */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
- new_vl.values = &
new_value
;
+ new_vl.values = &
(value_t) { .gauge = NAN }
;
new_vl.values_len = 1;
new_vl.meta = NULL;
new_vl.values_len = 1;
new_vl.meta = NULL;
@@
-224,7
+221,6
@@
static int v5_mysql_threads (const data_set_t *ds, value_list_t *vl) /* {{{ */
static int v5_zfs_arc_counts (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
static int v5_zfs_arc_counts (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- value_t new_value;
_Bool is_hits;
if (vl->values_len != 4)
_Bool is_hits;
if (vl->values_len != 4)
@@
-241,7
+237,7
@@
static int v5_zfs_arc_counts (const data_set_t *ds, value_list_t *vl) /* {{{ */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
- new_vl.values = &
new_value
;
+ new_vl.values = &
(value_t) { .gauge = NAN }
;
new_vl.values_len = 1;
new_vl.meta = NULL;
new_vl.values_len = 1;
new_vl.meta = NULL;
@@
-322,7
+318,6
@@
static int v5_zfs_arc_l2_bytes (const data_set_t *ds, value_list_t *vl) /* {{{ *
static int v5_zfs_arc_l2_size (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
static int v5_zfs_arc_l2_size (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- value_t new_value;
if (vl->values_len != 1)
return (FC_TARGET_STOP);
if (vl->values_len != 1)
return (FC_TARGET_STOP);
@@
-331,7
+326,7
@@
static int v5_zfs_arc_l2_size (const data_set_t *ds, value_list_t *vl) /* {{{ */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
- new_vl.values = &
new_value
;
+ new_vl.values = &
(value_t) { .gauge = NAN }
;
new_vl.values_len = 1;
new_vl.meta = NULL;
new_vl.values_len = 1;
new_vl.meta = NULL;
@@
-359,7
+354,6
@@
static int v5_zfs_arc_l2_size (const data_set_t *ds, value_list_t *vl) /* {{{ */
static int v5_zfs_arc_ratio (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
static int v5_zfs_arc_ratio (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- value_t new_value;
if (vl->values_len != 1)
return (FC_TARGET_STOP);
if (vl->values_len != 1)
return (FC_TARGET_STOP);
@@
-368,7
+362,7
@@
static int v5_zfs_arc_ratio (const data_set_t *ds, value_list_t *vl) /* {{{ */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
- new_vl.values = &
new_value
;
+ new_vl.values = &
(value_t) { .gauge = NAN }
;
new_vl.values_len = 1;
new_vl.meta = NULL;
new_vl.values_len = 1;
new_vl.meta = NULL;
@@
-397,7
+391,6
@@
static int v5_zfs_arc_ratio (const data_set_t *ds, value_list_t *vl) /* {{{ */
static int v5_zfs_arc_size (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
static int v5_zfs_arc_size (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- value_t new_value;
if (vl->values_len != 4)
return (FC_TARGET_STOP);
if (vl->values_len != 4)
return (FC_TARGET_STOP);
@@
-406,7
+399,7
@@
static int v5_zfs_arc_size (const data_set_t *ds, value_list_t *vl) /* {{{ */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
- new_vl.values = &
new_value
;
+ new_vl.values = &
(value_t) { .gauge = NAN }
;
new_vl.values_len = 1;
new_vl.meta = NULL;
new_vl.values_len = 1;
new_vl.meta = NULL;
diff --git
a/src/teamspeak2.c
b/src/teamspeak2.c
index
a1cde32
..
f5eb268
100644
(file)
--- a/
src/teamspeak2.c
+++ b/
src/teamspeak2.c
@@
-121,12
+121,9
@@
static void tss2_submit_gauge (const char *plugin_instance,
/*
* Submits a gauge value to the collectd daemon
*/
/*
* Submits a gauge value to the collectd daemon
*/
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "teamspeak2", sizeof (vl.plugin));
diff --git
a/src/ted.c
b/src/ted.c
index
5ed6c27
..
f167546
100644
(file)
--- a/
src/ted.c
+++ b/
src/ted.c
@@
-263,12
+263,9
@@
static int ted_open_device (void)
static void ted_submit (const char *type, double value)
{
static void ted_submit (const char *type, double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ted", sizeof (vl.plugin));
diff --git
a/src/tokyotyrant.c
b/src/tokyotyrant.c
index
7c6d912
..
154215f
100644
(file)
--- a/
src/tokyotyrant.c
+++ b/
src/tokyotyrant.c
@@
-86,15
+86,12
@@
static void printerr (void)
ecode, tcrdberrmsg(ecode));
}
ecode, tcrdberrmsg(ecode));
}
-static void tt_submit (gauge_t val, const char* type)
+static void tt_submit (gauge_t val
ue
, const char* type)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = val;
-
- vl.values = values;
- vl.values_len = STATIC_ARRAY_SIZE (values);
+ vl.values = &(value_t) { .gauge = value };
+ vl.values_len = 1;
sstrncpy (vl.host, config_host, sizeof (vl.host));
sstrncpy (vl.plugin, "tokyotyrant", sizeof (vl.plugin));
sstrncpy (vl.host, config_host, sizeof (vl.host));
sstrncpy (vl.plugin, "tokyotyrant", sizeof (vl.plugin));
diff --git
a/src/turbostat.c
b/src/turbostat.c
index
7b813c9
..
e74cba2
100644
(file)
--- a/
src/turbostat.c
+++ b/
src/turbostat.c
@@
-524,10
+524,8
@@
turbostat_submit (const char *plugin_instance,
gauge_t value)
{
value_list_t vl = VALUE_LIST_INIT;
gauge_t value)
{
value_list_t vl = VALUE_LIST_INIT;
- value_t v;
- v.gauge = value;
- vl.values = &v;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, PLUGIN_NAME, sizeof (vl.plugin));
diff --git
a/src/uptime.c
b/src/uptime.c
index
cbe2f8c
..
34c3e85
100644
(file)
--- a/
src/uptime.c
+++ b/
src/uptime.c
@@
-58,14
+58,11
@@
static time_t boottime;
extern kstat_ctl_t *kc;
#endif /* #endif HAVE_LIBKSTAT */
extern kstat_ctl_t *kc;
#endif /* #endif HAVE_LIBKSTAT */
-static void uptime_submit (gauge_t
uptim
e)
+static void uptime_submit (gauge_t
valu
e)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = uptime;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
diff --git
a/src/users.c
b/src/users.c
index
30e0dbe
..
ce626ae
100644
(file)
--- a/
src/users.c
+++ b/
src/users.c
@@
-45,12
+45,9
@@
static void users_submit (gauge_t value)
{
static void users_submit (gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "users", sizeof (vl.plugin));
diff --git
a/src/varnish.c
b/src/varnish.c
index
c214912
..
18f5902
100644
(file)
--- a/
src/varnish.c
+++ b/
src/varnish.c
@@
-117,22
+117,16
@@
static int varnish_submit_gauge (const char *plugin_instance, /* {{{ */
const char *category, const char *type, const char *type_instance,
uint64_t gauge_value)
{
const char *category, const char *type, const char *type_instance,
uint64_t gauge_value)
{
- value_t value;
-
- value.gauge = (gauge_t) gauge_value;
-
- return (varnish_submit (plugin_instance, category, type, type_instance, value));
+ return (varnish_submit (plugin_instance, category, type, type_instance,
+ (value_t) { .gauge = (gauge_t) gauge_value }));
} /* }}} int varnish_submit_gauge */
static int varnish_submit_derive (const char *plugin_instance, /* {{{ */
const char *category, const char *type, const char *type_instance,
uint64_t derive_value)
{
} /* }}} int varnish_submit_gauge */
static int varnish_submit_derive (const char *plugin_instance, /* {{{ */
const char *category, const char *type, const char *type_instance,
uint64_t derive_value)
{
- value_t value;
-
- value.derive = (derive_t) derive_value;
-
- return (varnish_submit (plugin_instance, category, type, type_instance, value));
+ return (varnish_submit (plugin_instance, category, type, type_instance,
+ (value_t) { .derive = (derive_t) derive_value }));
} /* }}} int varnish_submit_derive */
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
} /* }}} int varnish_submit_derive */
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
diff --git
a/src/virt.c
b/src/virt.c
index
c1c77bc
..
431ac41
100644
(file)
--- a/
src/virt.c
+++ b/
src/virt.c
@@
-223,83
+223,59
@@
init_value_list (value_list_t *vl, virDomainPtr dom)
} /* void init_value_list */
} /* void init_value_list */
-static void
-memory_submit (gauge_t memory, virDomainPtr dom)
+static void submit (virDomainPtr dom,
+ char const *type, char const *type_instance,
+ value_t *values, size_t values_len)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
-
init_value_list (&vl, dom);
init_value_list (&vl, dom);
- values[0].gauge = memory;
-
vl.values = values;
vl.values = values;
- vl.values_len =
1
;
+ vl.values_len =
values_len
;
- sstrncpy (vl.type, "memory", sizeof (vl.type));
- sstrncpy (vl.type_instance, "total", sizeof (vl.type_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
+ if (type_instance != NULL)
+ sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
}
static void
plugin_dispatch_values (&vl);
}
static void
-memory_stats_submit (gauge_t memory, virDomainPtr dom, int tag_index)
+memory_submit (gauge_t value, virDomainPtr dom)
+{
+ submit (dom, "memory", "total", &(value_t) { .gauge = value }, 1);
+}
+
+static void
+memory_stats_submit (gauge_t value, virDomainPtr dom, int tag_index)
{
static const char *tags[] = { "swap_in", "swap_out", "major_fault", "minor_fault",
"unused", "available", "actual_balloon", "rss"};
{
static const char *tags[] = { "swap_in", "swap_out", "major_fault", "minor_fault",
"unused", "available", "actual_balloon", "rss"};
- value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
-
- init_value_list (&vl, dom);
-
- values[0].gauge = memory;
-
- vl.values = values;
- vl.values_len = 1;
-
- sstrncpy (vl.type, "memory", sizeof (vl.type));
- sstrncpy (vl.type_instance, tags[tag_index], sizeof (vl.type_instance));
+ if ((tag_index < 0) || (tag_index >= STATIC_ARRAY_SIZE (tags))) {
+ ERROR ("virt plugin: Array index out of bounds: tag_index = %d", tag_index);
+ return;
+ }
-
plugin_dispatch_values (&vl
);
+
submit (dom, "memory", tags[tag_index], &(value_t) { .gauge = value }, 1
);
}
static void
}
static void
-cpu_submit (unsigned long long
cpu_tim
e,
+cpu_submit (unsigned long long
valu
e,
virDomainPtr dom, const char *type)
{
virDomainPtr dom, const char *type)
{
- value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
-
- init_value_list (&vl, dom);
-
- values[0].derive = cpu_time;
-
- vl.values = values;
- vl.values_len = 1;
-
- sstrncpy (vl.type, type, sizeof (vl.type));
-
- plugin_dispatch_values (&vl);
+ submit (dom, type, NULL, &(value_t) { .derive = (derive_t) value }, 1);
}
static void
}
static void
-vcpu_submit (derive_t
cpu_tim
e,
+vcpu_submit (derive_t
valu
e,
virDomainPtr dom, int vcpu_nr, const char *type)
{
virDomainPtr dom, int vcpu_nr, const char *type)
{
- value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
-
- init_value_list (&vl, dom);
+ char type_instance[DATA_MAX_NAME_LEN];
- values[0].derive = cpu_time;
- vl.values = values;
- vl.values_len = 1;
-
- sstrncpy (vl.type, type, sizeof (vl.type));
- ssnprintf (vl.type_instance, sizeof (vl.type_instance), "%d", vcpu_nr);
+ ssnprintf (type_instance, sizeof (type_instance), "%d", vcpu_nr);
-
plugin_dispatch_values (&vl
);
+
submit (dom, type, type_instance, &(value_t) { .derive = value }, 1
);
}
static void
}
static void
diff --git
a/src/vserver.c
b/src/vserver.c
index
a730593
..
c7adc5c
100644
(file)
--- a/
src/vserver.c
+++ b/
src/vserver.c
@@
-97,13
+97,10
@@
static void submit_gauge (const char *plugin_instance, const char *type,
const char *type_instance, gauge_t value)
{
const char *type_instance, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
- vl.values_len = STATIC_ARRAY_SIZE (values);
+ 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.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
diff --git
a/src/wireless.c
b/src/wireless.c
index
b998462
..
7d57fea
100644
(file)
--- a/
src/wireless.c
+++ b/
src/wireless.c
@@
-54,12
+54,9
@@
static double wireless_dbm_to_watt (double dbm)
static void wireless_submit (const char *plugin_instance, const char *type,
double value)
{
static void wireless_submit (const char *plugin_instance, const char *type,
double value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "wireless", sizeof (vl.plugin));
diff --git
a/src/xencpu.c
b/src/xencpu.c
index
f1cd938
..
93575df
100644
(file)
--- a/
src/xencpu.c
+++ b/
src/xencpu.c
@@
-108,14
+108,11
@@
static int xencpu_shutdown (void)
return 0;
} /* static int xencpu_shutdown */
return 0;
} /* static int xencpu_shutdown */
-static void submit_value (int cpu_num, gauge_t
percent
)
+static void submit_value (int cpu_num, gauge_t
value
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = percent;
-
- vl.values = values;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
@@
-145,9
+142,10
@@
static int xencpu_read (void)
int status;
for (int cpu = 0; cpu < nr_cpus; cpu++) {
gauge_t rate = NAN;
int status;
for (int cpu = 0; cpu < nr_cpus; cpu++) {
gauge_t rate = NAN;
- value_t value = {.derive = cpu_info[cpu].idletime};
- status = value_to_rate (&rate, value, DS_TYPE_DERIVE, now, &cpu_states[cpu]);
+ status = value_to_rate (&rate,
+ (value_t) { .derive = cpu_info[cpu].idletime }, DS_TYPE_DERIVE,
+ now, &cpu_states[cpu]);
if (status == 0) {
submit_value(cpu, 100 - rate/10000000);
}
if (status == 0) {
submit_value(cpu, 100 - rate/10000000);
}
diff --git
a/src/xmms.c
b/src/xmms.c
index
3535995
..
2ba3082
100644
(file)
--- a/
src/xmms.c
+++ b/
src/xmms.c
@@
-35,12
+35,9
@@
static gint xmms_session;
static void cxmms_submit (const char *type, gauge_t value)
{
static void cxmms_submit (const char *type, gauge_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "xmms", sizeof (vl.plugin));
diff --git
a/src/zfs_arc.c
b/src/zfs_arc.c
index
8261282
..
e2d2da4
100644
(file)
--- a/
src/zfs_arc.c
+++ b/
src/zfs_arc.c
@@
-138,7
+138,7
@@
static long long get_zfs_value(kstat_t *dummy __attribute__((unused)),
}
#endif
}
#endif
-static void za_submit (const char* type, const char* type_instance, value_t* values,
in
t values_len)
+static void za_submit (const char* type, const char* type_instance, value_t* values,
size_
t values_len)
{
value_list_t vl = VALUE_LIST_INIT;
{
value_list_t vl = VALUE_LIST_INIT;
@@
-155,45
+155,34
@@
static void za_submit (const char* type, const char* type_instance, value_t* val
static void za_submit_gauge (const char* type, const char* type_instance, gauge_t value)
{
static void za_submit_gauge (const char* type, const char* type_instance, gauge_t value)
{
- value_t vv;
-
- vv.gauge = value;
- za_submit (type, type_instance, &vv, 1);
+ za_submit (type, type_instance, &(value_t) { .gauge = value }, 1);
}
static int za_read_derive (kstat_t *ksp, const char *kstat_value,
const char *type, const char *type_instance)
{
}
static int za_read_derive (kstat_t *ksp, const char *kstat_value,
const char *type, const char *type_instance)
{
- long long tmp;
- value_t v;
-
- tmp = get_zfs_value (ksp, (char *)kstat_value);
+ long long tmp = get_zfs_value (ksp, (char *)kstat_value);
if (tmp == -1LL)
{
WARNING ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
return (-1);
}
if (tmp == -1LL)
{
WARNING ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
return (-1);
}
- v.derive = (derive_t) tmp;
- za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
+ za_submit (type, type_instance, &(value_t) { .derive = (derive_t) tmp }, /* values_num = */ 1);
return (0);
}
static int za_read_gauge (kstat_t *ksp, const char *kstat_value,
const char *type, const char *type_instance)
{
return (0);
}
static int za_read_gauge (kstat_t *ksp, const char *kstat_value,
const char *type, const char *type_instance)
{
- long long tmp;
- value_t v;
-
- tmp = get_zfs_value (ksp, (char *)kstat_value);
+ long long tmp = get_zfs_value (ksp, (char *)kstat_value);
if (tmp == -1LL)
{
WARNING ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
return (-1);
}
if (tmp == -1LL)
{
WARNING ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
return (-1);
}
- v.gauge = (gauge_t) tmp;
- za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
+ za_submit (type, type_instance, &(value_t) { .gauge = (gauge_t) tmp }, /* values_num = */ 1);
return (0);
}
return (0);
}
diff --git
a/src/zookeeper.c
b/src/zookeeper.c
index
8417485
..
7e55191
100644
(file)
--- a/
src/zookeeper.c
+++ b/
src/zookeeper.c
@@
-66,14
+66,11
@@
static int zookeeper_config(const char *key, const char *value)
return 0;
}
return 0;
}
-static void zookeeper_submit_gauge (const char * type, const char * type_inst, gauge_t val)
+static void zookeeper_submit_gauge (const char * type, const char * type_inst, gauge_t val
ue
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = val;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "zookeeper", sizeof (vl.plugin));
@@
-84,14
+81,11
@@
static void zookeeper_submit_gauge (const char * type, const char * type_inst, g
plugin_dispatch_values (&vl);
} /* zookeeper_submit_gauge */
plugin_dispatch_values (&vl);
} /* zookeeper_submit_gauge */
-static void zookeeper_submit_derive (const char * type, const char * type_inst, derive_t val)
+static void zookeeper_submit_derive (const char * type, const char * type_inst, derive_t val
ue
)
{
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = val;
-
- vl.values = values;
+ 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));
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "zookeeper", sizeof (vl.plugin));