+2016-10-07, Version 5.6.1
+ * Build system: Unnecessary linking of the Write Graphite plugin with
+ libyajl has been removed. Thanks to Marc Fournier.
+ Debian#839771, #1976
+ * collectd: A bug in the "FlushInterval" option that caused a
+ segmentation fault in the Write HTTP plugin has been fixed. Thanks to
+ Florian Forster. #1954
+ * Apache plugin: A syntax error has been fixed. Thanks to Florian
+ Forster.
+ * cURL-JSON plugin: A segmentation fault that occurred when handling
+ JSON with unexpected structure has been fixed. Thanks to Florian
+ Forster. #1896
+ * PostgreSQL plugin: Handling of "NULL" values in the "query_plans" and
+ "query_plans_by_table" queries has been fixed. Thanks to Bernd
+ Zeimetz. #1905
+ * RRDCacheD plugin: Reconnection behavior has been added. Thanks to
+ Sebastian Harl. Debian#657877
+ * VServer plugin: Use of a deprecated API ("readdir_r()") has been
+ fixed. Thanks to Sebastian Harl.
+ * Write Graphite plugin: Make default values configurable at compile
+ time again. Thanks to Florian Forster. #1953
+ * Write HTTP plugin: A bug has been fixed that lead to flush callbacks
+ being registered twice. Thanks to Florian Forster. #1955
+
2016-09-11, Version 5.6.0
* Build system: An option to to avoid building the DF plugin against XFS
has been added. Thanks to Ruben Kerkhof. #1878
%define with_dpdkstat 0%{!?_without_dpdkstat:0}
# plugin lpar disabled, requires AIX
%define with_lpar 0%{!?_without_lpar:0}
+# plugin intel_rdt disabled, requires intel-cmt-cat
+%define with_intel_rdt 0%{!?_without_intel_rdt:0}
# plugin mic disabled, requires Mic
%define with_mic 0%{!?_without_mic:0}
# plugin netapp disabled, requires libnetapp
Summary: Statistics collection and monitoring daemon
Name: collectd
Version: 5.7.0
-Release: 2%{?dist}
+Release: 1%{?dist}
URL: https://collectd.org
Source: https://collectd.org/files/%{name}-%{version}.tar.bz2
License: GPLv2
provided via SMART and queried by the external hddtemp daemon.
%endif
+%if %{with_intel_rdt}
+%package intel_rdt
+Summary: Intel RDT plugin for collectd
+Group: System Environment/Daemons
+Requires: %{name}%{?_isa} = %{version}-%{release}
+BuildRequires: intel-cmt-cat
+%description intel_rdt
+The intel_rdt plugin collects information provided by monitoring features of
+Intel Resource Director Technology (Intel(R) RDT).
+%endif
+
%if %{with_ipmi}
%package ipmi
Summary: IPMI plugin for collectd
%define _with_hugepages --disable-hugepages
%endif
+%if %{with_intel_rdt}
+%define _with_intel_rdt --enable-intel_rdt
+%else
+%define _with_intel_rdt --disable-intel_rdt
+%endif
+
%if %{with_interface}
%define _with_interface --enable-interface
%else
%{?_with_grpc} \
%{?_with_hddtemp} \
%{?_with_hugepages} \
+ %{?_with_intel_rdt} \
%{?_with_interface} \
%{?_with_ipc} \
%{?_with_ipmi} \
%{_libdir}/%{name}/hddtemp.so
%endif
+%if %{with_intel_rdt}
+%files intel_rdt
+%{_libdir}/%{name}/intel_rdt.so
+%endif
+
%if %{with_ipmi}
%files ipmi
%{_libdir}/%{name}/ipmi.so
%doc contrib/
%changelog
-* Tue Aug 23 2016 Marc Fournier <marc.fournier@camptocamp.com> - 5.7.0-1
+* Mon Oct 10 2016 Marc Fournier <marc.fournier@camptocamp.com> - 5.7.0-1
- New PRE-RELEASE version
- New plugins enabled by default: hugepages
-- New plugins disabled by default: dpdkstat
+- New plugins disabled by default: dpdkstat, intel_rdt
+
+* Mon Oct 10 2016 Victor Demonchy <v.demonchy@criteo.com> - 5.6.1-1
+- New upstream version
* Sun Aug 14 2016 Ruben Kerkhof <ruben@rubenkerkhof.com> - 5.6.0-1
-- New PRE-RELEASE version
+- New upstream version
- New plugins enabled by default: chrony, cpusleep, gps, lua, mqtt, notify_nagios
- New plugins disabled by default: grpc, xencpu, zone
write_graphite_la_SOURCES = write_graphite.c \
utils_format_graphite.c utils_format_graphite.h
write_graphite_la_LDFLAGS = $(PLUGIN_LDFLAGS)
-write_graphite_la_LIBADD = libformat_json.la
endif
if BUILD_PLUGIN_WRITE_HTTP
static const translation_info_t nsstats_translation_table[] = /* {{{ */
{
/* Requests */
- { "Requestv4", "dns_request", "IPv4" },
- { "Requestv6", "dns_request", "IPv6" },
- { "ReqEdns0", "dns_request", "EDNS0" },
- { "ReqBadEDNSVer", "dns_request", "BadEDNSVer" },
- { "ReqTSIG", "dns_request", "TSIG" },
- { "ReqSIG0", "dns_request", "SIG0" },
- { "ReqBadSIG", "dns_request", "BadSIG" },
- { "ReqTCP", "dns_request", "TCP" },
+ { "Requestv4", "dns_request", "IPv4" },
+ { "Requestv6", "dns_request", "IPv6" },
+ { "ReqEdns0", "dns_request", "EDNS0" },
+ { "ReqBadEDNSVer", "dns_request", "BadEDNSVer" },
+ { "ReqTSIG", "dns_request", "TSIG" },
+ { "ReqSIG0", "dns_request", "SIG0" },
+ { "ReqBadSIG", "dns_request", "BadSIG" },
+ { "ReqTCP", "dns_request", "TCP" },
/* Rejects */
- { "AuthQryRej", "dns_reject", "authorative" },
- { "RecQryRej", "dns_reject", "recursive" },
- { "XfrRej", "dns_reject", "transfer" },
- { "UpdateRej", "dns_reject", "update" },
+ { "AuthQryRej", "dns_reject", "authoritative" },
+ { "RecQryRej", "dns_reject", "recursive" },
+ { "XfrRej", "dns_reject", "transfer" },
+ { "UpdateRej", "dns_reject", "update" },
/* Responses */
- { "Response", "dns_response", "normal" },
- { "TruncatedResp", "dns_response", "truncated" },
- { "RespEDNS0", "dns_response", "EDNS0" },
- { "RespTSIG", "dns_response", "TSIG" },
- { "RespSIG0", "dns_response", "SIG0" },
+ { "Response", "dns_response", "normal" },
+ { "TruncatedResp", "dns_response", "truncated" },
+ { "RespEDNS0", "dns_response", "EDNS0" },
+ { "RespTSIG", "dns_response", "TSIG" },
+ { "RespSIG0", "dns_response", "SIG0" },
/* Queries */
- { "QryAuthAns", "dns_query", "authorative" },
- { "QryNoauthAns", "dns_query", "nonauth" },
- { "QryReferral", "dns_query", "referral" },
- { "QryRecursion", "dns_query", "recursion" },
- { "QryDuplicate", "dns_query", "dupliate" },
- { "QryDropped", "dns_query", "dropped" },
- { "QryFailure", "dns_query", "failure" },
+ { "QryAuthAns", "dns_query", "authoritative" },
+ { "QryNoauthAns", "dns_query", "nonauth" },
+ { "QryReferral", "dns_query", "referral" },
+ { "QryRecursion", "dns_query", "recursion" },
+ { "QryDuplicate", "dns_query", "duplicate" },
+ { "QryDropped", "dns_query", "dropped" },
+ { "QryFailure", "dns_query", "failure" },
/* Response codes */
- { "QrySuccess", "dns_rcode", "tx-NOERROR" },
- { "QryNxrrset", "dns_rcode", "tx-NXRRSET" },
- { "QrySERVFAIL", "dns_rcode", "tx-SERVFAIL" },
- { "QryFORMERR", "dns_rcode", "tx-FORMERR" },
- { "QryNXDOMAIN", "dns_rcode", "tx-NXDOMAIN" }
+ { "QrySuccess", "dns_rcode", "tx-NOERROR" },
+ { "QryNxrrset", "dns_rcode", "tx-NXRRSET" },
+ { "QrySERVFAIL", "dns_rcode", "tx-SERVFAIL" },
+ { "QryFORMERR", "dns_rcode", "tx-FORMERR" },
+ { "QryNXDOMAIN", "dns_rcode", "tx-NXDOMAIN" }
#if 0
- { "XfrReqDone", "type", "type_instance" },
- { "UpdateReqFwd", "type", "type_instance" },
- { "UpdateRespFwd", "type", "type_instance" },
- { "UpdateFwdFail", "type", "type_instance" },
- { "UpdateDone", "type", "type_instance" },
- { "UpdateFail", "type", "type_instance" },
- { "UpdateBadPrereq", "type", "type_instance" },
+ { "XfrReqDone", "type", "type_instance" },
+ { "UpdateReqFwd", "type", "type_instance" },
+ { "UpdateRespFwd", "type", "type_instance" },
+ { "UpdateFwdFail", "type", "type_instance" },
+ { "UpdateDone", "type", "type_instance" },
+ { "UpdateFail", "type", "type_instance" },
+ { "UpdateBadPrereq", "type", "type_instance" },
#endif
};
static int nsstats_translation_table_length =
=item B<Ignore> I<Value> [, I<Value> ...]
-The ignore values allows to ignore Instances based on their name and the patterns
-specified by the various values you've entered. The match is a glob-type shell
-matching.
+The ignore values allows one to ignore Instances based on their name and the
+patterns specified by the various values you've entered. The match is a
+glob-type shell matching.
=item B<InvertMatch> I<true|false(default)>
The reduction or normalization to mean sea level pressure requires (depending
on selected method/approximation) also altitude and reference to temperature
-sensor(s). When multiple temperature sensors are configured the minumum of
+sensor(s). When multiple temperature sensors are configured the minimum of
their values is always used (expecting that the warmer ones are affected by
e.g. direct sun light at that moment).
Temperature sensor(s) which should be used as a reference when normalizing the
pressure using C<Normalization> method 2.
-When specified more sensors a minumum is found and used each time. The
+When specified more sensors a minimum is found and used each time. The
temperature reading directly from this pressure sensor/plugin is typically not
suitable as the pressure sensor will be probably inside while we want outside
temperature. The collectd reference name is something like
plugin's fault, it will report errors if it gets them from the libraryE<nbsp>/
the driver. If a driver complains about an option, the plugin will dump a
complete list of all options understood by that driver to the log. There is no
-way to programatically find out if an option expects a string or a numeric
+way to programmatically find out if an option expects a string or a numeric
argument, so you will have to refer to the appropriate DBD's documentation to
find this out. Sorry.
Specify the plugin instance name that should be used instead of the database
name (which is the default, if this option has not been specified). This
-allows to query multiple databases of the same name on the same host (e.g.
+allows one to query multiple databases of the same name on the same host (e.g.
when running multiple database server versions in parallel).
The plugin instance name can also be set from the query result using
the B<PluginInstanceFrom> option in B<Query> block.
Specify the plugin instance name that should be used instead of the database
name (which is the default, if this option has not been specified). This
-allows to query multiple databases of the same name on the same host (e.g.
+allows one to query multiple databases of the same name on the same host (e.g.
when running multiple database server versions in parallel).
=item B<KRBSrvName> I<kerberos_service_name>
=item B<ProcessMatch> I<name> I<regex>
-Similar to the B<Process> option this allows to select more detailed
+Similar to the B<Process> option this allows one to select more detailed
statistics of processes matching the specified I<regex> (see L<regex(7)> for
details). The statistics of all matching processes are summed up and
dispatched to the daemon using the specified I<name> as an identifier. This
-allows to "group" several processes together. I<name> must not contain
+allows one to "group" several processes together. I<name> must not contain
slashes.
=item B<CollectContextSwitch> I<Boolean>
restarted. This results in much shorter (if any) gaps in graphs, especially
under heavy load. Also, the C<rrdtool> command line utility is aware of the
daemon so that it can flush values to disk automatically when needed. This
-allows to integrate automated flushing of values into graphing solutions much
-more easily.
+allows one to integrate automated flushing of values into graphing solutions
+much more easily.
There are disadvantages, though: The daemon may reside on a different host, so
it may not be possible for C<collectd> to create the appropriate RRD files
=item B<Key> I<String>
-Use the specified string as a partioning key for the topic. Kafka breaks
+Use the specified string as a partitioning key for the topic. Kafka breaks
topic into partitions and guarantees that for a given topology, the same
consumer will be used for a specific key. The special (case insensitive)
string B<Random> can be used to specify that an arbitrary partition should
extern kstat_ctl_t *kc;
#endif
+/* AIX doesn't have MSG_DONTWAIT */
+#ifndef MSG_DONTWAIT
+# define MSG_DONTWAIT MSG_NONBLOCK
+#endif
+
#if !HAVE_GETPWNAM_R
static pthread_mutex_t getpwnam_r_lock = PTHREAD_MUTEX_INITIALIZER;
#endif
}
if (value == endptr) {
- ERROR ("parse_value: Failed to parse string as %s: %s.",
+ ERROR ("parse_value: Failed to parse string as %s: \"%s\".",
DS_TYPE_TO_STRING (ds_type), value);
sfree (value);
return -1;
if (status != 0)
return (status);
- INFO("Lua plugin: File \"%s\" loaded succesfully", abs_path);
+ INFO("Lua plugin: File \"%s\" loaded successfully", abs_path);
return 0;
} /* }}} int lua_config_script */
</Query>
<Query query_plans>
- Statement "SELECT sum(seq_scan) AS seq, \
- sum(seq_tup_read) AS seq_tup_read, \
- sum(idx_scan) AS idx, \
- sum(idx_tup_fetch) AS idx_tup_fetch \
+ Statement "SELECT coalesce(sum(seq_scan), 0) AS seq, \
+ coalesce(sum(seq_tup_read), 0) AS seq_tup_read, \
+ coalesce(sum(idx_scan), 0) AS idx, \
+ coalesce(sum(idx_tup_fetch), 0) AS idx_tup_fetch \
FROM pg_stat_user_tables;"
<Result>
<Query query_plans_by_table>
Statement "SELECT schemaname, relname, \
- seq_scan AS seq, \
- seq_tup_read AS seq_tup_read, \
- idx_scan AS idx, \
- idx_tup_fetch AS idx_tup_fetch \
+ coalesce(seq_scan, 0) AS seq, \
+ coalesce(seq_tup_read, 0) AS seq_tup_read, \
+ coalesce(idx_scan, 0) AS idx, \
+ coalesce(idx_tup_fetch, 0) AS idx_tup_fetch \
FROM pg_stat_user_tables;"
<Result>
unsigned long vmem_code;
unsigned long stack_size;
- unsigned long vmem_minflt;
- unsigned long vmem_majflt;
derive_t vmem_minflt_counter;
derive_t vmem_majflt_counter;
- unsigned long cpu_user;
- unsigned long cpu_system;
derive_t cpu_user_counter;
derive_t cpu_system_counter;
derive_t io_wchar;
derive_t io_syscr;
derive_t io_syscw;
+ _Bool has_io;
derive_t cswitch_vol;
derive_t cswitch_invol;
+ _Bool has_cswitch;
struct procstat_entry_s *next;
} procstat_entry_t;
static procstat_t *list_head_g = NULL;
+static _Bool want_init = 1;
static _Bool report_ctx_switch = 0;
#if HAVE_THREAD_INFO
#elif KERNEL_LINUX
static long pagesize_g;
+static void ps_fill_details (const procstat_t *ps, procstat_entry_t *entry);
/* #endif KERNEL_LINUX */
#elif HAVE_LIBKVM_GETPROCS && (HAVE_STRUCT_KINFO_PROC_FREEBSD || HAVE_STRUCT_KINFO_PROC_OPENBSD)
return (0);
} /* int ps_list_match */
-static void ps_update_counter (_Bool init, derive_t *group_counter,
- derive_t *curr_counter, unsigned long *curr_value,
- derive_t new_counter, unsigned long new_value)
+static void ps_update_counter (derive_t *group_counter,
+ derive_t *curr_counter, derive_t new_counter)
{
- if (init)
+ unsigned long curr_value;
+
+ if (want_init)
{
- *curr_value = new_value;
- *curr_counter += new_value;
- *group_counter += new_value;
+ *curr_counter = new_counter;
return;
}
if (new_counter < *curr_counter)
- *curr_value = new_counter + (ULONG_MAX - *curr_counter);
+ curr_value = new_counter + (ULONG_MAX - *curr_counter);
else
- *curr_value = new_counter - *curr_counter;
+ curr_value = new_counter - *curr_counter;
*curr_counter = new_counter;
- *group_counter += *curr_value;
+ *group_counter += curr_value;
}
/* add process entry to 'instances' of process 'name' (or refresh it) */
for (procstat_t *ps = list_head_g; ps != NULL; ps = ps->next)
{
- _Bool want_init;
-
if ((ps_list_match (name, cmdline, ps)) == 0)
continue;
+#if KERNEL_LINUX
+ ps_fill_details(ps, entry);
+#endif
+
for (pse = ps->instances; pse != NULL; pse = pse->next)
if ((pse->id == entry->id) || (pse->next == NULL))
break;
ps->cswitch_vol += ((pse->cswitch_vol == -1)?0:pse->cswitch_vol);
ps->cswitch_invol += ((pse->cswitch_invol == -1)?0:pse->cswitch_invol);
- want_init = (entry->vmem_minflt_counter == 0)
- && (entry->vmem_majflt_counter == 0);
- ps_update_counter (want_init,
+ ps_update_counter (
&ps->vmem_minflt_counter,
- &pse->vmem_minflt_counter, &pse->vmem_minflt,
- entry->vmem_minflt_counter, entry->vmem_minflt);
- ps_update_counter (want_init,
+ &pse->vmem_minflt_counter,
+ entry->vmem_minflt_counter);
+ ps_update_counter (
&ps->vmem_majflt_counter,
- &pse->vmem_majflt_counter, &pse->vmem_majflt,
- entry->vmem_majflt_counter, entry->vmem_majflt);
+ &pse->vmem_majflt_counter,
+ entry->vmem_majflt_counter);
- want_init = (entry->cpu_user_counter == 0)
- && (entry->cpu_system_counter == 0);
- ps_update_counter (want_init,
+ ps_update_counter (
&ps->cpu_user_counter,
- &pse->cpu_user_counter, &pse->cpu_user,
- entry->cpu_user_counter, entry->cpu_user);
- ps_update_counter (want_init,
+ &pse->cpu_user_counter,
+ entry->cpu_user_counter);
+ ps_update_counter (
&ps->cpu_system_counter,
- &pse->cpu_system_counter, &pse->cpu_system,
- entry->cpu_system_counter, entry->cpu_system);
+ &pse->cpu_system_counter,
+ entry->cpu_system_counter);
}
}
/* ------- additional functions for KERNEL_LINUX/HAVE_THREAD_INFO ------- */
#if KERNEL_LINUX
-static procstat_t *ps_read_tasks_status (long pid, procstat_t *ps)
+static int ps_read_tasks_status (procstat_entry_t *ps)
{
char dirname[64];
DIR *dh;
char *fields[8];
int numfields;
- ssnprintf (dirname, sizeof (dirname), "/proc/%li/task", pid);
+ ssnprintf (dirname, sizeof (dirname), "/proc/%li/task", ps->id);
if ((dh = opendir (dirname)) == NULL)
{
DEBUG ("Failed to open directory `%s'", dirname);
- return (NULL);
+ return (-1);
}
while ((ent = readdir (dh)) != NULL)
tpid = ent->d_name;
- ssnprintf (filename, sizeof (filename), "/proc/%li/task/%s/status", pid, tpid);
+ ssnprintf (filename, sizeof (filename), "/proc/%li/task/%s/status", ps->id, tpid);
if ((fh = fopen (filename, "r")) == NULL)
{
DEBUG ("Failed to open file `%s'", filename);
ps->cswitch_vol = cswitch_vol;
ps->cswitch_invol = cswitch_invol;
- return (ps);
+ return (0);
} /* int *ps_read_tasks_status */
/* Read data from /proc/pid/status */
return (ps);
} /* procstat_t *ps_read_vmem */
-static procstat_t *ps_read_io (long pid, procstat_t *ps)
+static int ps_read_io (procstat_entry_t *ps)
{
FILE *fh;
char buffer[1024];
char *fields[8];
int numfields;
- ssnprintf (filename, sizeof (filename), "/proc/%li/io", pid);
+ ssnprintf (filename, sizeof (filename), "/proc/%li/io", ps->id);
if ((fh = fopen (filename, "r")) == NULL)
- return (NULL);
+ return (-1);
while (fgets (buffer, sizeof (buffer), fh) != NULL)
{
WARNING ("processes: fclose: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
}
+ return (0);
+} /* int ps_read_io (...) */
- return (ps);
-} /* procstat_t *ps_read_io */
+static void ps_fill_details (const procstat_t *ps, procstat_entry_t *entry)
+{
+ if ( entry->has_io == 0 && ps_read_io (entry) != 0 )
+ {
+ /* no io data */
+ entry->io_rchar = -1;
+ entry->io_wchar = -1;
+ entry->io_syscr = -1;
+ entry->io_syscw = -1;
+
+ DEBUG("ps_read_process: not get io data for pid %li", entry->id);
+ }
+ entry->has_io = 1;
+
+ if ( report_ctx_switch )
+ {
+ if ( entry->has_cswitch == 0 && ps_read_tasks_status(entry) != 0 )
+ {
+ entry->cswitch_vol = -1;
+ entry->cswitch_invol = -1;
+
+ DEBUG("ps_read_tasks_status: not get context "
+ "switch data for pid %li", entry->id);
+ }
+ entry->has_cswitch = 1;
+ }
+} /* void ps_fill_details (...) */
static int ps_read_process (long pid, procstat_t *ps, char *state)
{
ps->vmem_rss = (unsigned long) vmem_rss;
ps->stack_size = (unsigned long) stack_size;
- if ( (ps_read_io (pid, ps)) == NULL)
- {
- /* no io data */
- ps->io_rchar = -1;
- ps->io_wchar = -1;
- ps->io_syscr = -1;
- ps->io_syscw = -1;
-
- DEBUG("ps_read_process: not get io data for pid %li", pid);
- }
-
- if ( report_ctx_switch )
- {
- if ( (ps_read_tasks_status(pid, ps)) == NULL)
- {
- ps->cswitch_vol = -1;
- ps->cswitch_invol = -1;
-
- DEBUG("ps_read_tasks_status: not get context "
- "switch data for pid %li", pid);
- }
- }
-
/* success */
return (0);
} /* int ps_read_process (...) */
pse.vmem_code = ps.vmem_code;
pse.stack_size = ps.stack_size;
- pse.vmem_minflt = 0;
pse.vmem_minflt_counter = ps.vmem_minflt_counter;
- pse.vmem_majflt = 0;
pse.vmem_majflt_counter = ps.vmem_majflt_counter;
- pse.cpu_user = 0;
pse.cpu_user_counter = ps.cpu_user_counter;
- pse.cpu_system = 0;
pse.cpu_system_counter = ps.cpu_system_counter;
pse.io_rchar = ps.io_rchar;
pse.vmem_data = procs[i].ki_dsize * pagesize;
pse.vmem_code = procs[i].ki_tsize * pagesize;
pse.stack_size = procs[i].ki_ssize * pagesize;
- pse.vmem_minflt = 0;
pse.vmem_minflt_counter = procs[i].ki_rusage.ru_minflt;
- pse.vmem_majflt = 0;
pse.vmem_majflt_counter = procs[i].ki_rusage.ru_majflt;
- pse.cpu_user = 0;
- pse.cpu_system = 0;
pse.cpu_user_counter = 0;
pse.cpu_system_counter = 0;
/*
pse.vmem_code = procs[i].p_vm_tsize * pagesize;
pse.stack_size = procs[i].p_vm_ssize * pagesize;
pse.vmem_size = pse.stack_size + pse.vmem_code + pse.vmem_data;
- pse.vmem_minflt = 0;
pse.vmem_minflt_counter = procs[i].p_uru_minflt;
- pse.vmem_majflt = 0;
pse.vmem_majflt_counter = procs[i].p_uru_majflt;
- pse.cpu_user = 0;
- pse.cpu_system = 0;
pse.cpu_user_counter = procs[i].p_uutime_usec +
(1000000lu * procs[i].p_uutime_sec);
pse.cpu_system_counter = procs[i].p_ustime_usec +
break;
}
- pse.cpu_user = 0;
/* tv_usec is nanosec ??? */
pse.cpu_user_counter = procentry[i].pi_ru.ru_utime.tv_sec * 1000000 +
procentry[i].pi_ru.ru_utime.tv_usec / 1000;
pse.cpu_system_counter = procentry[i].pi_ru.ru_stime.tv_sec * 1000000 +
procentry[i].pi_ru.ru_stime.tv_usec / 1000;
- pse.vmem_minflt = 0;
pse.vmem_minflt_counter = procentry[i].pi_minflt;
- pse.vmem_majflt = 0;
pse.vmem_majflt_counter = procentry[i].pi_majflt;
pse.vmem_size = procentry[i].pi_tsize + procentry[i].pi_dvm * pagesize;
pse.vmem_code = ps.vmem_code;
pse.stack_size = ps.stack_size;
- pse.vmem_minflt = 0;
pse.vmem_minflt_counter = ps.vmem_minflt_counter;
- pse.vmem_majflt = 0;
pse.vmem_majflt_counter = ps.vmem_majflt_counter;
- pse.cpu_user = 0;
pse.cpu_user_counter = ps.cpu_user_counter;
- pse.cpu_system = 0;
pse.cpu_system_counter = ps.cpu_system_counter;
pse.io_rchar = ps.io_rchar;
read_fork_rate();
#endif /* KERNEL_SOLARIS */
+ want_init = 0;
+
return (0);
} /* int ps_read */
return (0);
} /* int rc_config */
+static int try_reconnect (void)
+{
+ int status;
+
+ rrdc_disconnect ();
+
+ rrd_clear_error ();
+ status = rrdc_connect (daemon_address);
+ if (status != 0)
+ {
+ ERROR ("rrdcached plugin: Failed to reconnect to RRDCacheD "
+ "at %s: %s (status=%d)", daemon_address, rrd_get_error (), status);
+ return (-1);
+ }
+
+ INFO ("rrdcached plugin: Successfully reconnected to RRDCacheD "
+ "at %s", daemon_address);
+ return (0);
+} /* int try_reconnect */
+
static int rc_read (void)
{
int status;
rrdc_stats_t *head;
+ _Bool retried = 0;
value_list_t vl = VALUE_LIST_INIT;
vl.values = &(value_t) { .gauge = NAN };
sstrncpy (vl.host, daemon_address, sizeof (vl.host));
sstrncpy (vl.plugin, "rrdcached", sizeof (vl.plugin));
+ rrd_clear_error ();
status = rrdc_connect (daemon_address);
if (status != 0)
{
- ERROR ("rrdcached plugin: rrdc_connect (%s) failed with status %i.",
- daemon_address, status);
+ ERROR ("rrdcached plugin: Failed to connect to RRDCacheD "
+ "at %s: %s (status=%d)", daemon_address, rrd_get_error (), status);
return (-1);
}
- head = NULL;
- status = rrdc_stats_get (&head);
- if (status != 0)
+ while (42)
{
- ERROR ("rrdcached plugin: rrdc_stats_get failed with status %i.", status);
+ /* The RRD client lib does not provide any means for checking a
+ * connection, hence we'll have to retry upon failed operations. */
+ head = NULL;
+ rrd_clear_error ();
+ status = rrdc_stats_get (&head);
+ if (status == 0)
+ break;
+
+ if (!retried)
+ {
+ retried = 1;
+ if (try_reconnect () == 0)
+ continue;
+ /* else: report the error and fail */
+ }
+
+ ERROR ("rrdcached plugin: rrdc_stats_get failed: %s (status=%i).",
+ rrd_get_error (), status);
return (-1);
}
char values[512];
char *values_array[2];
int status;
+ _Bool retried = 0;
if (daemon_address == NULL)
{
}
}
+ rrd_clear_error ();
status = rrdc_connect (daemon_address);
if (status != 0)
{
- ERROR ("rrdcached plugin: rrdc_connect (%s) failed with status %i.",
- daemon_address, status);
+ ERROR ("rrdcached plugin: Failed to connect to RRDCacheD "
+ "at %s: %s (status=%d)", daemon_address, rrd_get_error (), status);
return (-1);
}
- status = rrdc_update (filename, /* values_num = */ 1, (void *) values_array);
- if (status != 0)
+ while (42)
{
- ERROR ("rrdcached plugin: rrdc_update (%s, [%s], 1) failed with "
- "status %i.",
- filename, values_array[0], status);
+ /* The RRD client lib does not provide any means for checking a
+ * connection, hence we'll have to retry upon failed operations. */
+ rrd_clear_error ();
+ status = rrdc_update (filename, /* values_num = */ 1, (void *) values_array);
+ if (status == 0)
+ break;
+
+ if (!retried)
+ {
+ retried = 1;
+ if (try_reconnect () == 0)
+ continue;
+ /* else: report the error and fail */
+ }
+
+ ERROR ("rrdcached plugin: rrdc_update (%s, [%s], 1) failed: %s (status=%i)",
+ filename, values_array[0], rrd_get_error (), status);
return (-1);
}
{
char filename[PATH_MAX + 1];
int status;
+ _Bool retried = 0;
if (identifier == NULL)
return (EINVAL);
else
ssnprintf (filename, sizeof (filename), "%s.rrd", identifier);
+ rrd_clear_error ();
status = rrdc_connect (daemon_address);
if (status != 0)
{
- ERROR ("rrdcached plugin: rrdc_connect (%s) failed with status %i.",
- daemon_address, status);
+ ERROR ("rrdcached plugin: Failed to connect to RRDCacheD "
+ "at %s: %s (status=%d)", daemon_address, rrd_get_error (), status);
return (-1);
}
- status = rrdc_flush (filename);
- if (status != 0)
+ while (42)
{
- ERROR ("rrdcached plugin: rrdc_flush (%s) failed with status %i.",
- filename, status);
+ /* The RRD client lib does not provide any means for checking a
+ * connection, hence we'll have to retry upon failed operations. */
+ rrd_clear_error ();
+ status = rrdc_flush (filename);
+ if (status == 0)
+ break;
+
+ if (!retried)
+ {
+ retried = 1;
+ if (try_reconnect () == 0)
+ continue;
+ /* else: report the error and fail */
+ }
+
+ ERROR ("rrdcached plugin: rrdc_flush (%s) failed: %s (status=%i).",
+ filename, rrd_get_error (), status);
return (-1);
}
DEBUG ("rrdcached plugin: rrdc_flush (%s): Success.", filename);
else if (ds->ds_num != 1)
{
ERROR ("tail_csv plugin: The type \"%s\" has %zu data sources. "
- "Only types with a single data soure are supported.",
+ "Only types with a single data source are supported.",
ds->type, ds->ds_num);
continue;
}
static int vserver_read (void)
{
-#if NAME_MAX < 1024
-# define DIRENT_BUFFER_SIZE (sizeof (struct dirent) + 1024 + 1)
-#else
-# define DIRENT_BUFFER_SIZE (sizeof (struct dirent) + NAME_MAX + 1)
-#endif
-
- DIR *proc;
- struct dirent *dent; /* 42 */
- char dirent_buffer[DIRENT_BUFFER_SIZE];
+ DIR *proc;
errno = 0;
proc = opendir (PROCDIR);
while (42)
{
+ struct dirent *dent;
int len;
char file[BUFSIZE];
int status;
- status = readdir_r (proc, (struct dirent *) dirent_buffer, &dent);
- if (status != 0)
+ errno = 0;
+ dent = readdir (proc);
+ if (dent == NULL)
{
char errbuf[4096];
- ERROR ("vserver plugin: readdir_r failed: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
+
+ if (errno == 0) /* end of directory */
+ break;
+
+ ERROR ("vserver plugin: failed to read directory %s: %s",
+ PROCDIR, sstrerror (errno, errbuf, sizeof (errbuf)));
closedir (proc);
return (-1);
}
- else if (dent == NULL)
- {
- /* end of directory */
- break;
- }
if (dent->d_name[0] == '.')
continue;
node->conn = redisConnectWithTimeout ((char *)node->host, node->port, node->timeout);
if (node->conn == NULL)
{
- ERROR ("write_redis plugin: Connecting to host \"%s\" (port %i) failed: Unkown reason",
+ ERROR ("write_redis plugin: Connecting to host \"%s\" (port %i) failed: Unknown reason",
(node->host != NULL) ? node->host : "localhost",
(node->port != 0) ? node->port : 6379);
pthread_mutex_unlock (&node->lock);
#!/bin/sh
-DEFAULT_VERSION="5.6.0.git"
+DEFAULT_VERSION="5.6.1.git"
if [ -d .git ]; then
VERSION="`git describe --dirty=+ --abbrev=7 2> /dev/null | grep collectd | sed -e 's/^collectd-//' -e 's/-/./g'`"