From: Sebastian Harl Date: Tue, 3 Feb 2009 13:08:32 +0000 (+0100) Subject: Let plugin_dispatch_values() set value_list.time in case of 'now'. X-Git-Tag: collectd-4.6.0~57 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=bc7992ed0693313a2b1fe282a5bf23f1cc9f8e42 Let plugin_dispatch_values() set value_list.time in case of 'now'. Basically any (read) plugin was calling time(NULL) to set the time of a values list. This is now done by plugin_dispatch_values() in case the time is zero (which is the case when using VALUE_LIST_INIT or VALUE_LIST_STATIC). This change slightly simplifies the code and makes future changes to the time management (like the possibly upcoming subsecond resolution support) less intrusive in respect to the amount of required code changes. --- diff --git a/src/apache.c b/src/apache.c index c6bf8add..7dc34f5b 100644 --- a/src/apache.c +++ b/src/apache.c @@ -197,7 +197,6 @@ static void submit_counter (const char *type, const char *type_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "apache", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); @@ -220,7 +219,6 @@ static void submit_gauge (const char *type, const char *type_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "apache", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); diff --git a/src/apcups.c b/src/apcups.c index ca026b96..45649175 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -364,7 +364,6 @@ static void apc_submit_generic (char *type, char *type_inst, double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "apcups", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); diff --git a/src/apple_sensors.c b/src/apple_sensors.c index d3120276..bdba0ff8 100644 --- a/src/apple_sensors.c +++ b/src/apple_sensors.c @@ -87,7 +87,6 @@ static void as_submit (const char *type, const char *type_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "apple_sensors", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); diff --git a/src/ascent.c b/src/ascent.c index 6285176a..bf1e9f4a 100644 --- a/src/ascent.c +++ b/src/ascent.c @@ -126,7 +126,6 @@ static int ascent_submit_gauge (const char *plugin_instance, /* {{{ */ vl.values = values; vl.values_len = 1; - vl.time = time (NULL); 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 416f3397..d142982d 100644 --- a/src/battery.c +++ b/src/battery.c @@ -98,7 +98,6 @@ static void battery_submit (const char *plugin_instance, const char *type, doubl vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "battery", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); diff --git a/src/bind.c b/src/bind.c index e09da192..f9de8e6a 100644 --- a/src/bind.c +++ b/src/bind.c @@ -263,7 +263,7 @@ static void submit_counter(time_t ts, const char *plugin_instance, const char *t vl.values = values; vl.values_len = 1; - vl.time = (ts == 0) ? time (NULL) : ts; + vl.time = ts; sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "bind", sizeof(vl.plugin)); if (plugin_instance) { diff --git a/src/cpu.c b/src/cpu.c index e9ab7832..9a565c57 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -179,7 +179,6 @@ static void submit (int cpu_num, const char *type_instance, counter_t value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "cpu", sizeof (vl.plugin)); ssnprintf (vl.plugin_instance, sizeof (vl.type_instance), diff --git a/src/cpufreq.c b/src/cpufreq.c index 3738b54c..b92b1d09 100644 --- a/src/cpufreq.c +++ b/src/cpufreq.c @@ -67,7 +67,6 @@ static void cpufreq_submit (int cpu_num, double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "cpufreq", sizeof (vl.plugin)); sstrncpy (vl.type, "cpufreq", sizeof (vl.type)); diff --git a/src/df.c b/src/df.c index 26d23826..38079d87 100644 --- a/src/df.c +++ b/src/df.c @@ -124,7 +124,6 @@ static void df_submit (char *df_name, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "df", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); diff --git a/src/disk.c b/src/disk.c index 29aa9790..489770c7 100644 --- a/src/disk.c +++ b/src/disk.c @@ -212,7 +212,6 @@ static void disk_submit (const char *plugin_instance, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "disk", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, diff --git a/src/dns.c b/src/dns.c index c04169fe..d82cbd86 100644 --- a/src/dns.c +++ b/src/dns.c @@ -298,7 +298,6 @@ static void submit_counter (const char *type, const char *type_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "dns", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); @@ -317,7 +316,6 @@ static void submit_octets (counter_t queries, counter_t responses) vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "dns", sizeof (vl.plugin)); sstrncpy (vl.type, "dns_octets", sizeof (vl.type)); diff --git a/src/email.c b/src/email.c index 5e103ed7..ff9d4394 100644 --- a/src/email.c +++ b/src/email.c @@ -656,7 +656,6 @@ static void email_submit (const char *type, const char *type_instance, gauge_t v vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "email", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); diff --git a/src/entropy.c b/src/entropy.c index 2e20a67c..d56be6dc 100644 --- a/src/entropy.c +++ b/src/entropy.c @@ -38,7 +38,6 @@ static void entropy_submit (double entropy) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "entropy", sizeof (vl.plugin)); sstrncpy (vl.type, "entropy", sizeof (vl.type)); diff --git a/src/filecount.c b/src/filecount.c index e2b00207..05bb4b37 100644 --- a/src/filecount.c +++ b/src/filecount.c @@ -66,7 +66,6 @@ static void fc_submit_dir (const fc_directory_conf_t *dir) vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); 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)); diff --git a/src/hddtemp.c b/src/hddtemp.c index 9f4a7254..cc67c639 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -447,7 +447,6 @@ static void hddtemp_submit (char *type_instance, double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "hddtemp", sizeof (vl.plugin)); sstrncpy (vl.type, "temperature", sizeof (vl.type)); diff --git a/src/interface.c b/src/interface.c index 7512c4ee..520f4c8d 100644 --- a/src/interface.c +++ b/src/interface.c @@ -158,7 +158,6 @@ static void if_submit (const char *dev, const char *type, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "interface", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); diff --git a/src/ipmi.c b/src/ipmi.c index b5e27448..10590705 100644 --- a/src/ipmi.c +++ b/src/ipmi.c @@ -219,7 +219,6 @@ static void sensor_read_handler (ipmi_sensor_t *sensor, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "ipmi", sizeof (vl.plugin)); diff --git a/src/iptables.c b/src/iptables.c index e1694af3..9abee364 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -218,7 +218,6 @@ static int submit_match (const struct ipt_entry_match *match, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "iptables", sizeof (vl.plugin)); diff --git a/src/ipvs.c b/src/ipvs.c index 85e65d27..87eee108 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -235,7 +235,6 @@ static void cipvs_submit_connections (char *pi, char *ti, counter_t value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); vl.interval = interval_g; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); @@ -261,7 +260,6 @@ static void cipvs_submit_if (char *pi, char *t, char *ti, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); vl.interval = interval_g; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); diff --git a/src/irq.c b/src/irq.c index 9b7e6187..986efafb 100644 --- a/src/irq.c +++ b/src/irq.c @@ -131,7 +131,6 @@ static void irq_submit (unsigned int irq, counter_t value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "irq", sizeof (vl.plugin)); sstrncpy (vl.type, "irq", sizeof (vl.type)); diff --git a/src/load.c b/src/load.c index 72c7756a..9c75ae11 100644 --- a/src/load.c +++ b/src/load.c @@ -50,7 +50,6 @@ static void load_submit (gauge_t snum, gauge_t mnum, gauge_t lnum) vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "load", sizeof (vl.plugin)); sstrncpy (vl.type, "load", sizeof (vl.type)); diff --git a/src/mbmon.c b/src/mbmon.c index 344caddf..859714c2 100644 --- a/src/mbmon.c +++ b/src/mbmon.c @@ -227,7 +227,6 @@ static void mbmon_submit (const char *type, const char *type_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "mbmon", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); diff --git a/src/memcached.c b/src/memcached.c index f139b719..b5a4b208 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -234,7 +234,6 @@ static void submit_counter (const char *type, const char *type_inst, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "memcached", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); diff --git a/src/memory.c b/src/memory.c index c31b30ef..ebaa8f29 100644 --- a/src/memory.c +++ b/src/memory.c @@ -108,7 +108,6 @@ static void memory_submit (const char *type_instance, gauge_t value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "memory", sizeof (vl.plugin)); sstrncpy (vl.type, "memory", sizeof (vl.type)); diff --git a/src/multimeter.c b/src/multimeter.c index e3da00a1..775eb57e 100644 --- a/src/multimeter.c +++ b/src/multimeter.c @@ -200,7 +200,6 @@ static void multimeter_submit (double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "multimeter", sizeof (vl.plugin)); sstrncpy (vl.type, "multimeter", sizeof (vl.type)); diff --git a/src/mysql.c b/src/mysql.c index 57ad2397..1c009a07 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -158,7 +158,6 @@ static void counter_submit (const char *type, const char *type_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); @@ -182,7 +181,6 @@ static void qcache_submit (counter_t hits, counter_t inserts, vl.values = values; vl.values_len = 5; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin)); sstrncpy (vl.type, "mysql_qcache", sizeof (vl.type)); @@ -203,7 +201,6 @@ static void threads_submit (gauge_t running, gauge_t connected, gauge_t cached, vl.values = values; vl.values_len = 4; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin)); sstrncpy (vl.type, "mysql_threads", sizeof (vl.type)); @@ -221,7 +218,6 @@ static void traffic_submit (counter_t rx, counter_t tx) vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "mysql", sizeof (vl.plugin)); sstrncpy (vl.type, "mysql_octets", sizeof (vl.type)); diff --git a/src/netlink.c b/src/netlink.c index d14e5101..d7d1a269 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -170,7 +170,6 @@ static void submit_one (const char *dev, const char *type, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "netlink", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance)); @@ -194,7 +193,6 @@ static void submit_two (const char *dev, const char *type, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "netlink", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance)); diff --git a/src/nfs.c b/src/nfs.c index f2db895a..e4d12e34 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -187,7 +187,6 @@ static void nfs_procedures_submit (const char *plugin_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "nfs", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, diff --git a/src/nginx.c b/src/nginx.c index 91bcf754..8cb76285 100644 --- a/src/nginx.c +++ b/src/nginx.c @@ -177,7 +177,6 @@ static void submit (char *type, char *inst, long long value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); 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 14f06ebc..64e1bce5 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -300,7 +300,6 @@ static void ntpd_submit (char *type, char *type_inst, double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "ntpd", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); diff --git a/src/nut.c b/src/nut.c index 8796d587..edc48c61 100644 --- a/src/nut.c +++ b/src/nut.c @@ -123,7 +123,6 @@ static void nut_submit (nut_ups_t *ups, const char *type, vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); sstrncpy (vl.host, (strcasecmp (ups->hostname, "localhost") == 0) ? hostname_g diff --git a/src/onewire.c b/src/onewire.c index dd7f527d..c40d5ad7 100644 --- a/src/onewire.c +++ b/src/onewire.c @@ -149,7 +149,6 @@ static int cow_read_values (const char *path, const char *name, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "onewire", sizeof (vl.plugin)); diff --git a/src/openvpn.c b/src/openvpn.c index a2f48236..083e2e31 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -75,7 +75,6 @@ static void openvpn_submit (char *name, counter_t rx, counter_t tx) vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "openvpn", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, name, sizeof (vl.plugin_instance)); @@ -93,7 +92,6 @@ static void compression_submit (char *type_instance, gauge_t ratio) vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "openvpn", sizeof (vl.plugin)); sstrncpy (vl.type, "compression_ratio", sizeof (vl.type)); diff --git a/src/perl.c b/src/perl.c index 4a76c0aa..b5965d67 100644 --- a/src/perl.c +++ b/src/perl.c @@ -640,9 +640,6 @@ static int pplugin_dispatch_values (pTHX_ HV *values) if (NULL != (tmp = hv_fetch (values, "time", 4, 0))) { list.time = (time_t)SvIV (*tmp); } - else { - list.time = time (NULL); - } if (NULL != (tmp = hv_fetch (values, "host", 4, 0))) { sstrncpy (list.host, SvPV_nolen (*tmp), sizeof (list.host)); diff --git a/src/ping.c b/src/ping.c index ac5b0f85..7ffbfaff 100644 --- a/src/ping.c +++ b/src/ping.c @@ -185,7 +185,6 @@ static void ping_submit (char *host, double latency) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "ping", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); diff --git a/src/plugin.c b/src/plugin.c index 95b9fa37..cd7b1083 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -874,6 +874,9 @@ int plugin_dispatch_values (value_list_t *vl) return (-1); } + if (vl->time == 0) + vl->time = time (NULL); + DEBUG ("plugin_dispatch_values: time = %u; interval = %i; " "host = %s; " "plugin = %s; plugin_instance = %s; " diff --git a/src/postgresql.c b/src/postgresql.c index 2814cc4a..c5b52d0b 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -392,7 +392,6 @@ static void submit (const c_psql_database_t *db, const c_psql_result_t *res, vl.values = values; vl.values_len = res->values_num; - vl.time = time (NULL); if (C_PSQL_IS_UNIX_DOMAIN_SOCKET (db->host) || (0 == strcmp (db->host, "localhost"))) diff --git a/src/powerdns.c b/src/powerdns.c index 189c46fe..164137ba 100644 --- a/src/powerdns.c +++ b/src/powerdns.c @@ -317,7 +317,6 @@ static void submit (const char *plugin_instance, /* {{{ */ vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "powerdns", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type)); diff --git a/src/processes.c b/src/processes.c index 0b824821..553b1955 100644 --- a/src/processes.c +++ b/src/processes.c @@ -553,7 +553,6 @@ static void ps_submit_state (const char *state, double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "processes", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); @@ -571,7 +570,6 @@ static void ps_submit_proc_list (procstat_t *ps) vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "processes", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, ps->name, sizeof (vl.plugin_instance)); diff --git a/src/rrdcached.c b/src/rrdcached.c index f9d65ca5..31c63524 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -221,7 +221,6 @@ static int rc_read (void) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); if ((strncmp ("unix:", daemon_address, strlen ("unix:")) == 0) || (daemon_address[0] == '/')) diff --git a/src/sensors.c b/src/sensors.c index 5ed82a8c..b600d4cf 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -496,7 +496,6 @@ static void sensors_submit (const char *plugin_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "sensors", sizeof (vl.plugin)); diff --git a/src/serial.c b/src/serial.c index 1c874e52..cfa26bbd 100644 --- a/src/serial.c +++ b/src/serial.c @@ -40,7 +40,6 @@ static void serial_submit (const char *type_instance, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "serial", sizeof (vl.plugin)); sstrncpy (vl.type, "serial_octets", sizeof (vl.type)); diff --git a/src/snmp.c b/src/snmp.c index 3ba93fe8..44fce620 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -963,7 +963,6 @@ static int csnmp_dispatch_table (host_definition_t *host, data_definition_t *dat sstrncpy (vl.plugin, "snmp", sizeof (vl.plugin)); vl.interval = host->interval; - vl.time = time (NULL); subid = 0; have_more = 1; @@ -1385,7 +1384,6 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data) return (-1); } - vl.time = time (NULL); for (vb = res->variables; vb != NULL; vb = vb->next_variable) { diff --git a/src/swap.c b/src/swap.c index 8c09e35f..b8b5f098 100644 --- a/src/swap.c +++ b/src/swap.c @@ -123,7 +123,6 @@ static void swap_submit (const char *type_instance, double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "swap", sizeof (vl.plugin)); sstrncpy (vl.type, "swap", sizeof (vl.type)); diff --git a/src/tape.c b/src/tape.c index caca537b..32b42965 100644 --- a/src/tape.c +++ b/src/tape.c @@ -68,7 +68,6 @@ static void tape_submit (const char *plugin_instance, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "tape", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, diff --git a/src/tcpconns.c b/src/tcpconns.c index aa1fa38b..f576b68f 100644 --- a/src/tcpconns.c +++ b/src/tcpconns.c @@ -213,7 +213,6 @@ static void conn_submit_port_entry (port_entry_t *pe) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "tcpconns", sizeof (vl.plugin)); sstrncpy (vl.type, "tcp_connections", sizeof (vl.type)); diff --git a/src/teamspeak2.c b/src/teamspeak2.c index 5cd427af..e81dbe30 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -129,7 +129,6 @@ static void tss2_submit_gauge (const char *plugin_instance, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "teamspeak2", sizeof (vl.plugin)); @@ -160,7 +159,6 @@ static void tss2_submit_io (const char *plugin_instance, const char *type, vl.values = values; vl.values_len = 2; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "teamspeak2", sizeof (vl.plugin)); diff --git a/src/thermal.c b/src/thermal.c index b6136480..79033b17 100644 --- a/src/thermal.c +++ b/src/thermal.c @@ -51,7 +51,6 @@ static void thermal_submit (const char *plugin_instance, enum dev_type dt, vt.gauge = value; vl.values = &vt; - vl.time = time (NULL); sstrncpy (vl.plugin, "thermal", sizeof(vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance)); diff --git a/src/users.c b/src/users.c index 1231075a..b605ff84 100644 --- a/src/users.c +++ b/src/users.c @@ -48,7 +48,6 @@ static void users_submit (gauge_t value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "users", sizeof (vl.plugin)); sstrncpy (vl.type, "users", sizeof (vl.plugin)); diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c index 91b70160..5bd6ec73 100644 --- a/src/utils_cmd_putval.c +++ b/src/utils_cmd_putval.c @@ -51,8 +51,6 @@ static int parse_value (const data_set_t *ds, value_list_t *vl, *value_str = '\0'; value_str++; vl->time = (time_t) atoi (time_str); - if (vl->time == 0) - vl->time = time (NULL); i = 0; dummy = value_str; diff --git a/src/utils_db_query.c b/src/utils_db_query.c index 868b53bf..b4ce09ab 100644 --- a/src/utils_db_query.c +++ b/src/utils_db_query.c @@ -217,7 +217,6 @@ static void udb_result_submit (udb_result_t *r, udb_query_t *q) /* {{{ */ } } - vl.time = time (NULL); sstrncpy (vl.host, q->host, sizeof (vl.host)); sstrncpy (vl.plugin, q->plugin, sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, q->db_name, sizeof (vl.type_instance)); diff --git a/src/utils_tail_match.c b/src/utils_tail_match.c index f518b1cd..26e95311 100644 --- a/src/utils_tail_match.c +++ b/src/utils_tail_match.c @@ -80,7 +80,6 @@ static int simple_submit_match (cu_match_t *match, void *user_data) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, data->plugin, sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, data->plugin_instance, diff --git a/src/vmem.c b/src/vmem.c index 25f7c70c..6775d20d 100644 --- a/src/vmem.c +++ b/src/vmem.c @@ -45,7 +45,6 @@ static void submit (const char *plugin_instance, const char *type, vl.values = values; vl.values_len = values_len; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "vmem", sizeof (vl.plugin)); if (plugin_instance != NULL) diff --git a/src/vserver.c b/src/vserver.c index dac43926..8747d9ba 100644 --- a/src/vserver.c +++ b/src/vserver.c @@ -56,7 +56,6 @@ static void traffic_submit (const char *plugin_instance, vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); 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)); @@ -78,7 +77,6 @@ static void load_submit (const char *plugin_instance, vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); 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)); @@ -98,7 +96,6 @@ static void submit_gauge (const char *plugin_instance, const char *type, vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); 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 21bbcb40..f7ba735d 100644 --- a/src/wireless.c +++ b/src/wireless.c @@ -55,7 +55,6 @@ static void wireless_submit (const char *plugin_instance, const char *type, vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "wireless", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, plugin_instance, diff --git a/src/xmms.c b/src/xmms.c index 09786fc9..52beb65f 100644 --- a/src/xmms.c +++ b/src/xmms.c @@ -36,7 +36,6 @@ static void cxmms_submit (const char *type, gauge_t value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "xmms", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof (vl.type));