Code

collectd.git
15 years agosrc/utils_db_query.c: Implement the (deprecated) `{Min,Max}PGVersion' options.
Florian Forster [Wed, 4 Feb 2009 08:32:34 +0000 (09:32 +0100)]
src/utils_db_query.c: Implement the (deprecated) `{Min,Max}PGVersion' options.

This is for compatibility with old configuration of the postgresql plugin.

15 years agodbi plugin: Use the server version to only use appropriate queries.
Florian Forster [Tue, 3 Feb 2009 20:35:01 +0000 (21:35 +0100)]
dbi plugin: Use the server version to only use appropriate queries.

15 years agosrc/utils_db_query.[ch]: Add support for min-/max-version.
Florian Forster [Tue, 3 Feb 2009 20:34:36 +0000 (21:34 +0100)]
src/utils_db_query.[ch]: Add support for min-/max-version.

These settings can be used to check if a particular query is suited to the
database server version we're currently connected to.

15 years agooracle plugin: Use the DB query module.
Florian Forster [Mon, 2 Feb 2009 21:26:41 +0000 (22:26 +0100)]
oracle plugin: Use the DB query module.

This simplifies the oracle plugin considerably.

15 years agosrc/utils_db_query.c: When asked for the user data, return the user data.
Florian Forster [Mon, 2 Feb 2009 20:57:08 +0000 (21:57 +0100)]
src/utils_db_query.c: When asked for the user data, return the user data.

Appreciate this patch, it cost me one fucking hour of my live!

15 years agodbi plugin: Put the row handling logic in an extra module.
Florian Forster [Mon, 2 Feb 2009 17:40:11 +0000 (18:40 +0100)]
dbi plugin: Put the row handling logic in an extra module.

The `utils_db_query' module now handles config parsing and row handling.
This unifies basically all of the <Query> blocks, so that the `dbi' and
`oracle' plugins behave exactly alike. Porting the `postgresql' plugin
should be possible, too, so that all three database plugins are in line.

15 years agocollectd.conf: Updated the example postgresql plugin configuration.
Sebastian Harl [Sun, 1 Feb 2009 22:42:45 +0000 (23:42 +0100)]
collectd.conf: Updated the example postgresql plugin configuration.

15 years agodbi plugin: Fixed error handling in an inner loop.
Sebastian Harl [Sun, 1 Feb 2009 22:24:54 +0000 (23:24 +0100)]
dbi plugin: Fixed error handling in an inner loop.

The macro BAIL_OUT_CONTINUE() is used inside the loop iterating over the
result sets to clean up and continue with the next loop iteration. In two
cases this was used in a loop iterating over the instances and values lists
contained within that loop as well though. This would cause the memory that
was currently written to (the two target lists) to be freed and thus cause a
possible segfault. In any case it would leave behind inconsistent and most
probably uninitialized data. The usage of that macro has now been pulled out
of the inner loops.

15 years agopostgresql plugin: Added support for the "interval" parameter.
Sebastian Harl [Sun, 1 Feb 2009 22:09:08 +0000 (23:09 +0100)]
postgresql plugin: Added support for the "interval" parameter.

This query parameter expands to the interval collectd is using.

15 years agopostgresql plugin: Added support for <Result> blocks.
Sebastian Harl [Sun, 1 Feb 2009 21:48:01 +0000 (22:48 +0100)]
postgresql plugin: Added support for <Result> blocks.

This is a replacement for the "Column" config option (which has been
deprecated). <Result> blocks allow for much more flexible handling of the
data. Besides being able to use data types with multiple data sources, the
plugin now supports to generate the type instance using information from the
database.

An example <Result> block might look like this (taken from the manpage):

  <Result>
    Type counter
    InstancePrefix "rt36_tickets"
    InstancesFrom "type"
    ValuesFrom "count"
  </Result>

15 years agopostgresql plugin: Reinitialize a database after reconnecting.
Sebastian Harl [Sun, 1 Feb 2009 16:37:52 +0000 (17:37 +0100)]
postgresql plugin: Reinitialize a database after reconnecting.

During initialization we get the right version of each query definition. After
reconnecting, the PostgreSQL server version might have changed, so we might
need to update some of the query definitions.

15 years agoutils_complain: Added macro c_would_release().
Sebastian Harl [Sun, 1 Feb 2009 16:36:25 +0000 (17:36 +0100)]
utils_complain: Added macro c_would_release().

This macro returns true if the specified complaint would be released, false
else. This is useful e.g. to do further actions when releasing a complaint.

15 years agosrc/collectd.conf.in: Add default stuff for the oracle and openvpn plugins.
Florian Forster [Sun, 1 Feb 2009 17:26:34 +0000 (18:26 +0100)]
src/collectd.conf.in: Add default stuff for the oracle and openvpn plugins.

15 years agooracle plugin: Add <Result> blocks.
Florian Forster [Sun, 1 Feb 2009 17:26:05 +0000 (18:26 +0100)]
oracle plugin: Add <Result> blocks.

With these blocks it's possible to receive more than one value (per row)
from one SQL statement.

15 years agocsv plugin: Make the output to STDOUT compatible to the exec plugin.
Florian Forster [Sun, 1 Feb 2009 14:46:27 +0000 (15:46 +0100)]
csv plugin: Make the output to STDOUT compatible to the exec plugin.

Probably not that useful, but the output written to STDOUT by the csv
plugin is not in the form accepted by the exec plugin. This makes some
potentially interesting hacks possible ;)

15 years agodbi plugin: Add <Result> blocks.
Florian Forster [Sun, 1 Feb 2009 14:43:53 +0000 (15:43 +0100)]
dbi plugin: Add <Result> blocks.

With these blocks it's possible to receive more than one value (per row)
from one SQL statement.

15 years agolibcollectdclient: Add a .pc file for pkg-config.
Florian Forster [Sun, 1 Feb 2009 10:46:03 +0000 (11:46 +0100)]
libcollectdclient: Add a .pc file for pkg-config.

15 years agoprocesses plugin: Fix the ARG_MAX stuff yet again.
Florian Forster [Sat, 31 Jan 2009 23:32:12 +0000 (00:32 +0100)]
processes plugin: Fix the ARG_MAX stuff yet again.

The `sysconf' approach does not work when doing something like
  char cmdline[ARG_MAX];
which is exactly what was done in the processes plugin.

Just use 4k whenever the define is not available - ought to be enough
for anybody! ;)

15 years agoprocesses plugin: Make sure ARG_MAX is defined.
Florian Forster [Sat, 31 Jan 2009 22:55:30 +0000 (23:55 +0100)]
processes plugin: Make sure ARG_MAX is defined.

Apparently the GNU libc 2.8 removed the macro for some unholy reason. We
either use `sysconf(3)' transparently (if available) or 4kByte (the
POSIX minimum).

Thanks to dD0T for reporting the problem :)

15 years agolibcollectdclient: Fix the SSTRCAT macro.
Florian Forster [Sat, 31 Jan 2009 22:28:21 +0000 (23:28 +0100)]
libcollectdclient: Fix the SSTRCAT macro.

The size passed to `strncat' is not the total size of the buffer, so GCC
with _FORTIFY_SOURCE rightfully complained about this macro.

Thanks to dD0T for reporting this :)

15 years agopostgresql plugin: Renamed the "Query" config option to "Statement".
Sebastian Harl [Thu, 29 Jan 2009 16:17:55 +0000 (17:17 +0100)]
postgresql plugin: Renamed the "Query" config option to "Statement".

This makes slightly more sense and is more consistent with the dbi and oracle
plugins.

15 years agoCollectd::Graph::Common.pm: Include Collectd::Unixsock.
Sebastian Harl [Wed, 21 Jan 2009 14:43:45 +0000 (15:43 +0100)]
Collectd::Graph::Common.pm: Include Collectd::Unixsock.

This module is required to send the "FLUSH" command to collectd using the UNIX
domain socket provided by the "unixsock" plugin.

15 years agoMerge branch 'collectd-4.5'
Florian Forster [Sat, 24 Jan 2009 10:04:31 +0000 (11:04 +0100)]
Merge branch 'collectd-4.5'

15 years agoMerge branch 'collectd-4.4' into collectd-4.5
Florian Forster [Sat, 24 Jan 2009 10:04:22 +0000 (11:04 +0100)]
Merge branch 'collectd-4.4' into collectd-4.5

15 years agotcpconns plugin: Fix an endianness problem under *BSD.
Florian Forster [Sat, 24 Jan 2009 10:00:30 +0000 (11:00 +0100)]
tcpconns plugin: Fix an endianness problem under *BSD.

The port numbers were assumed to be in the host's byte order, when in
fact they are in network byte order (big endian). The patch adds `ntohs'
where necessary to fix this problem.

Resolves: #35

15 years agosrc/utils_rrdcreate.c: Fix support for non-threadsafe libraries.
Florian Forster [Thu, 22 Jan 2009 09:08:48 +0000 (10:08 +0100)]
src/utils_rrdcreate.c: Fix support for non-threadsafe libraries.

15 years agocollectd.conf(5): Add some preliminary documentation for the bind plugin.
Florian Forster [Thu, 22 Jan 2009 09:07:49 +0000 (10:07 +0100)]
collectd.conf(5): Add some preliminary documentation for the bind plugin.

15 years agoMerge branch 'bp/bind'
Florian Forster [Thu, 22 Jan 2009 08:09:18 +0000 (09:09 +0100)]
Merge branch 'bp/bind'

15 years agoutils_cache: Free then unused memory before returning in an error condition.
Sebastian Harl [Tue, 20 Jan 2009 12:24:54 +0000 (13:24 +0100)]
utils_cache: Free then unused memory before returning in an error condition.

15 years agoutils_cache: Unlock the cache mutex before returning in an error condition.
Sebastian Harl [Tue, 20 Jan 2009 12:20:00 +0000 (13:20 +0100)]
utils_cache: Unlock the cache mutex before returning in an error condition.

15 years agomemcached plugin: Make absolutely sure, we don't divide by zero.
Florian Forster [Tue, 20 Jan 2009 09:34:51 +0000 (10:34 +0100)]
memcached plugin: Make absolutely sure, we don't divide by zero.

It's a well-known fact only Chuck Norris can do that!

15 years agomemcached plugin: Add hitratio metric.
Doug MacEachern [Thu, 8 Jan 2009 01:58:49 +0000 (17:58 -0800)]
memcached plugin: Add hitratio metric.

Signed-off-by: Doug MacEachern <dougm@hyperic.com>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
15 years agocontrib/cussh.pl: Add the PUTNOTIF command.
Doug MacEachern [Tue, 20 Jan 2009 09:27:10 +0000 (10:27 +0100)]
contrib/cussh.pl: Add the PUTNOTIF command.

I was using this to test notifications for jcollectd like so:
echo "PUTNOTIF host=foo severity=warning message=my perl is rusty" |
perl -Mblib=bindings/perl contrib/cussh.pl

Signed-off-by: Doug MacEachern <dougm@hyperic.com>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
15 years agobind plugin: Don't use LLONG_{MIN,MAX} to increase portability.
Florian Forster [Mon, 19 Jan 2009 12:05:23 +0000 (13:05 +0100)]
bind plugin: Don't use LLONG_{MIN,MAX} to increase portability.

Sagly, there's a bug in some versions of GCC/GNU libc which leads to LLONG_*
not being defined. We'll check the return value of strtoll for `>0' and `<0',
which should do the trick, too.

15 years agoMerge branch 'master' into bp/bind
Florian Forster [Sun, 18 Jan 2009 22:14:31 +0000 (23:14 +0100)]
Merge branch 'master' into bp/bind

15 years agosrc/common.h: Add the IS_TRUE and IS_FALSE macros.
Florian Forster [Sun, 18 Jan 2009 20:07:36 +0000 (21:07 +0100)]
src/common.h: Add the IS_TRUE and IS_FALSE macros.

They should be used to check if a string is "true|yes|on" or
"false|no|off" from now on.

15 years agobind plugin: Reworked Bruno's patch to remove repeating code.
Florian Forster [Sun, 18 Jan 2009 20:07:17 +0000 (21:07 +0100)]
bind plugin: Reworked Bruno's patch to remove repeating code.

15 years agobind plugin: Eliminate the `goto' in `bind_xml'.
Florian Forster [Sat, 17 Jan 2009 11:16:18 +0000 (12:16 +0100)]
bind plugin: Eliminate the `goto' in `bind_xml'.

15 years agobind plugin: Put removal of special characters in separate function.
Florian Forster [Sat, 17 Jan 2009 11:15:49 +0000 (12:15 +0100)]
bind plugin: Put removal of special characters in separate function.

15 years agobind plugin: Be more specific about the features we need.
Florian Forster [Sat, 17 Jan 2009 11:01:04 +0000 (12:01 +0100)]
bind plugin: Be more specific about the features we need.

15 years agobind plugin: Fix a misplaced comma.
Florian Forster [Sat, 17 Jan 2009 10:58:30 +0000 (11:58 +0100)]
bind plugin: Fix a misplaced comma.

15 years agobind plugin: Add a new plugin for BIND 9.5 and 9.6 statistics.
Bruno Prémont [Sat, 17 Jan 2009 10:56:30 +0000 (11:56 +0100)]
bind plugin: Add a new plugin for BIND 9.5 and 9.6 statistics.

Attached are patches for collectd-4.5.x and collectd-4.4.x series for a
plugin to collect statistics from a ISC Bind server.

ISC Bind introduces XML-based statistics which can be fetched via HTTP
starting with bind-9.5.0 and updated the XML structure with bind-9.6.0.
Both XML formats are supported by this plugin.

To enable access to these statistics, use the following configuration
block:

statistics-channels {
        inet localhost port 8053 allow { localhost; };
};

Suggestions on improving the grouping of statistics values are welcome,
currently the following groups are implemented:
  RRQueriesIn      type=dns_qtype
  Requests         type=dns_request
  QueryResults     type=dns_rcode
  Updates          type=dns_update
  ZoneMaintenance  type=dns_zops
  Resolver         type=dns_resolver

Bruno

15 years agoascent plugin: Fix a memory leak.
Bruno Prémont [Sat, 17 Jan 2009 10:40:53 +0000 (11:40 +0100)]
ascent plugin: Fix a memory leak.

According to libxml2 API doc, the string returned by
   xmlNodeListGetString()
must be freed by the user with
   xmlFree()

The attached patch adds the missing calls to xmlFree() for the ascent plugin.

15 years agonetwork plugin: Make the receive thread even faster.
Florian Forster [Sat, 17 Jan 2009 10:19:08 +0000 (11:19 +0100)]
network plugin: Make the receive thread even faster.

On very busy systems, the thread apparently may not be scheduled often enough.
So the receive buffer fills up quickly and data may be lost.

This patch changes the `mutex_lock' to a `mutex_trylock' and data is only
appended to the global receive-queue if the lock can be obtained without
blocking.

If the lock cannot be obtained without blocking, the data is instead appended
to a private queue and that queue is appended to the global queue when the lock
can next be taken.

15 years agoMerge branch 'dm/t_option'
Florian Forster [Sat, 17 Jan 2009 10:04:24 +0000 (11:04 +0100)]
Merge branch 'dm/t_option'

15 years agocollectd: Don't *abort* on the first read-error with the `-T' option.
Florian Forster [Sat, 17 Jan 2009 10:01:10 +0000 (11:01 +0100)]
collectd: Don't *abort* on the first read-error with the `-T' option.

The `-T' option used to basically quit the daemon right away when the
first read function of a plugin failed. This patch changes the behavior,
so that:

 - All read-functions are tried. If one or more fail, the daemon will
   exit with a non-zero exit status, but all read-functions will be
   tried.
 - Don't quit if one read-function failed without calling all the
   shutdown-functions first. This will clean up the UNIX socket of the
   unixsock plugin and stuff like that.

15 years agocollectd: Add the -T option.
Doug MacEachern [Fri, 2 Jan 2009 21:52:35 +0000 (13:52 -0800)]
collectd: Add the -T option.

The -T switch:

 - implies -f
 - does not start any read threads
 - invokes callback() foreach list_read and will exit 1 on failure, 0
   otherwise

Makes for a nicer dryrun than -f + ^C, also makes it possible to wrap
with a test harness such as Test.pm

Signed-off-by: Doug MacEachern <dougm@hyperic.com>
Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
15 years agosrc/collectd.h: #undef macros before poisoning them.
Doug MacEachern [Fri, 2 Jan 2009 21:46:34 +0000 (13:46 -0800)]
src/collectd.h: #undef macros before poisoning them.

Signed-off-by: Doug MacEachern <dougm@hyperic.com>
Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
15 years agocsv plugin: Make it possible to write values to STDOUT.
Doug MacEachern [Fri, 2 Jan 2009 21:26:01 +0000 (13:26 -0800)]
csv plugin: Make it possible to write values to STDOUT.

Signed-off-by: Doug MacEachern <dougm@hyperic.com>
Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
15 years agoopenvpn plugin: Added support for LZO compression.
Florian Forster [Sat, 17 Jan 2009 09:39:53 +0000 (10:39 +0100)]
openvpn plugin: Added support for LZO compression.

There are four counters for pre/post (de)compression. The code compares
the pre/post counters and submits the current compression ratio based on
the counter change rate.

The type `compression_ratio' (gauge) is used to store the data.

15 years agosrc/common.[ch]: Add `counter_diff', a function to calculate the difference of two...
Florian Forster [Sat, 17 Jan 2009 09:37:50 +0000 (10:37 +0100)]
src/common.[ch]: Add `counter_diff', a function to calculate the difference of two counters.

It's not just a simple (old - new), because wrap-around is handled, too.

15 years agoprocesses plugin: Collect VM and stack size stats on Linux.
Sebastian Harl [Tue, 13 Jan 2009 11:36:01 +0000 (12:36 +0100)]
processes plugin: Collect VM and stack size stats on Linux.

On other operating systems those values will currently always be zero since I
do not have appropriate test systems available.

The new types "ps_stacksize" and "ps_vm" have been added to types.db.

15 years ago.gitignore: Added libcollectclient stuff.
Sebastian Harl [Sun, 11 Jan 2009 14:31:43 +0000 (15:31 +0100)]
.gitignore: Added libcollectclient stuff.

15 years agolibcollectdclient: Added LCC_{BEGIN,END}_DECLS macros.
Sebastian Harl [Sun, 11 Jan 2009 14:23:28 +0000 (15:23 +0100)]
libcollectdclient: Added LCC_{BEGIN,END}_DECLS macros.

These macros define an extern "C" block when using C++. This allows to use the
headers from C++ as well.

15 years agolibcollectdclient: Added header lcc_features.h.
Sebastian Harl [Sun, 11 Jan 2009 14:10:54 +0000 (15:10 +0100)]
libcollectdclient: Added header lcc_features.h.

This header provides various macros and functions that may be used to
determine the version of libcollectdclient (i.e. collectd). The file will be
auto-created from lcc_features.h.in by configure.

The macro LCC_VERSION (previously defined in client.h) has been moved to this
header as well and has been renamed to LCC_API_VERSION.

This allows for fine grained version checks at compile- and runtime.

15 years agoopenvpn plugin: Some small cleanups.
Florian Forster [Sat, 10 Jan 2009 14:30:54 +0000 (15:30 +0100)]
openvpn plugin: Some small cleanups.

15 years agovalue match: Add the `DataSource' and `Satisfy' configuration options.
Florian Forster [Sat, 3 Jan 2009 14:16:02 +0000 (15:16 +0100)]
value match: Add the `DataSource' and `Satisfy' configuration options.

This adds quite some flexibility to the match. collectd.conf(5) is kept
up to date, too.

15 years agoMerge branch 'collectd-4.5'
Florian Forster [Sat, 3 Jan 2009 00:36:04 +0000 (01:36 +0100)]
Merge branch 'collectd-4.5'

Conflicts:

src/types.db.pod

15 years agoBumped version to 4.5.2; Updated ChangeLog. collectd-4.5.2
Florian Forster [Fri, 2 Jan 2009 22:18:15 +0000 (23:18 +0100)]
Bumped version to 4.5.2; Updated ChangeLog.

15 years agoMerge branch 'collectd-4.4' into collectd-4.5
Florian Forster [Fri, 2 Jan 2009 21:40:44 +0000 (22:40 +0100)]
Merge branch 'collectd-4.4' into collectd-4.5

Conflicts:

ChangeLog
version-gen.sh

15 years agoBumped version to 4.4.5; Updated ChangeLog. collectd-4.4.5
Florian Forster [Fri, 2 Jan 2009 17:31:11 +0000 (18:31 +0100)]
Bumped version to 4.4.5; Updated ChangeLog.

15 years agocontrib/README: Add the solaris-smf subdirectory.
Florian Forster [Thu, 1 Jan 2009 13:05:07 +0000 (14:05 +0100)]
contrib/README: Add the solaris-smf subdirectory.

15 years agocontrib/solaris-smf: Add Solaris SMF information to contrib/.
Piotr Hosowicz [Thu, 1 Jan 2009 13:01:01 +0000 (14:01 +0100)]
contrib/solaris-smf: Add Solaris SMF information to contrib/.

See README or <http://phosowicz.jogger.pl/2008/12/21/smf-izing-collectd/> for
details.

Signed-off-by: Florian Forster <octo@huhu.verplant.org>
15 years agoMerge branch 'dm/openvpn'
Florian Forster [Thu, 1 Jan 2009 11:36:40 +0000 (12:36 +0100)]
Merge branch 'dm/openvpn'

15 years agocollectd.conf(5): Fix two typos.
Florian Forster [Thu, 1 Jan 2009 11:36:25 +0000 (12:36 +0100)]
collectd.conf(5): Fix two typos.

15 years agocollectd.conf(5): Added information about the openvpn plugin.
Florian Forster [Thu, 1 Jan 2009 11:35:34 +0000 (12:35 +0100)]
collectd.conf(5): Added information about the openvpn plugin.

15 years agoopenvpn plugin: Add a plugin to read OpenVPN statistics.
Doug MacEachern [Sun, 21 Dec 2008 01:08:39 +0000 (17:08 -0800)]
openvpn plugin: Add a plugin to read OpenVPN statistics.

Simple but useful module for monitoring per-client openvpn traffic..

The plugin reads a statistics file maintained by OpenVPN. The location of the
statistics file is configurable.

Signed-off-by: Doug MacEachern <dougm@hyperic.com>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
15 years agoMerge branch 'collectd-4.4' into collectd-4.5
Florian Forster [Tue, 30 Dec 2008 16:24:06 +0000 (17:24 +0100)]
Merge branch 'collectd-4.4' into collectd-4.5

Conflicts:

src/network.c

15 years agonetwork plugin: Fix an invalid size of buffer being used.
Florian Forster [Tue, 30 Dec 2008 13:44:39 +0000 (14:44 +0100)]
network plugin: Fix an invalid size of buffer being used.

When specifying the amount of data to copy, we used `sizeof (buffer)' where
`buffer' is a pointer, giving 4 or 8 bytes, depending on the architecture (and
not depending on the actual buffer size). This results in the `type' being sent
much more often than necessary and sometimes not sending a new type when is was
actually necessary. The only prominent case in the default configuration(s) was
`cpufreq' being used instead of `cpu', though.

While in the process, the global `type' buffer was replaced, because an
appropriate buffer is in `value_list_t' now.

Much thanks to Bruno Prémont for reporting and debugging this issue :)

References: #37

15 years agonetwork plugin: A fix for the buffer problem for version 4.4.
Florian Forster [Tue, 30 Dec 2008 16:13:31 +0000 (17:13 +0100)]
network plugin: A fix for the buffer problem for version 4.4.

This patch fixes the same problem as 6605ff1a, the insufficient copying of
values to the `type' buffer.

Thanks again to Bruno Prémont for reporting and debugging this :)

Resolves: #37

15 years agolibcollectdclient: Don't use `PF_UNIX', it's broken on Mac OS X.
Florian Forster [Tue, 30 Dec 2008 15:46:38 +0000 (16:46 +0100)]
libcollectdclient: Don't use `PF_UNIX', it's broken on Mac OS X.

Under Mac OS X (10.4, possibly others), PF_UNIX is defined as PF_LOCAL, which
in turn is defined as AF_LOCAL. AF_LOCAL, however, is only defined if
POSIX_C_SOURCE is not.

15 years agonetwork plugin: Fix an invalid size of buffer being used.
Florian Forster [Tue, 30 Dec 2008 13:44:39 +0000 (14:44 +0100)]
network plugin: Fix an invalid size of buffer being used.

When specifying the amount of data to copy, we used `sizeof (buffer)' where
`buffer' is a pointer, giving 4 or 8 bytes, depending on the architecture (and
not depending on the actual buffer size). This results in the `type' being sent
much more often than necessary and sometimes not sending a new type when is was
actually necessary. The only prominent case in the default configuration(s) was
`cpufreq' being used instead of `cpu', though.

While in the process, the global `type' buffer was replaced, because an
appropriate buffer is in `value_list_t' now.

Much thanks to Bruno Prémont for reporting and debugging this issue :)

References: #37

15 years agosrc/utils_subst.c: Print the warning of the subst_string function when appropriate.
Florian Forster [Sun, 21 Dec 2008 02:00:51 +0000 (03:00 +0100)]
src/utils_subst.c: Print the warning of the subst_string function when appropriate.

A leftover from the previous setting, a hard-coded maximum, was forgotten.

15 years agonotification target: Add a target that dispatches notifications.
Florian Forster [Sat, 20 Dec 2008 16:07:59 +0000 (17:07 +0100)]
notification target: Add a target that dispatches notifications.

Not tested very well yet, but it works essentially.

15 years agosrc/common.c: Change `sstrdup' to not call `strdup' anymore.
Florian Forster [Sat, 20 Dec 2008 15:55:10 +0000 (16:55 +0100)]
src/common.c: Change `sstrdup' to not call `strdup' anymore.

15 years agosrc/utils_subst.[ch]: Implement `subst_string'.
Florian Forster [Sat, 20 Dec 2008 15:54:32 +0000 (16:54 +0100)]
src/utils_subst.[ch]: Implement `subst_string'.

Works like `subst', but instead of specifying start and end offsets you
specify `needle', the string that is to be replaced. If `needle' is found
in `string' (using strstr(3)), the offset is calculated and `subst' is
called with the determined parameters.

15 years agotypes.db(5): Fix a typo.
Florian Forster [Sat, 20 Dec 2008 12:34:43 +0000 (13:34 +0100)]
types.db(5): Fix a typo.

15 years agoreplace target: Add a target to replace part of an identifier..
Florian Forster [Sat, 20 Dec 2008 12:26:24 +0000 (13:26 +0100)]
replace target: Add a target to replace part of an identifier..

..using regular expressions.

Possible future improvements: Use submatches in the replacement string,
similar to sed's \1, \2, ... back-references.

15 years agotypes.db(5): Explain in more detail how custom types should be added.
Florian Forster [Sat, 20 Dec 2008 10:20:31 +0000 (11:20 +0100)]
types.db(5): Explain in more detail how custom types should be added.

Apparently there was quite some confusion over this.

15 years agoMerge branch 'collectd-4.5'
Florian Forster [Sat, 20 Dec 2008 09:18:21 +0000 (10:18 +0100)]
Merge branch 'collectd-4.5'

15 years agoMerge branch 'collectd-4.4' into collectd-4.5
Florian Forster [Sat, 20 Dec 2008 09:17:26 +0000 (10:17 +0100)]
Merge branch 'collectd-4.4' into collectd-4.5

Conflicts:

src/utils_dns.c

15 years agoDo not use *printf() to report errors / debugging messages.
Sebastian Harl [Fri, 19 Dec 2008 17:20:41 +0000 (18:20 +0100)]
Do not use *printf() to report errors / debugging messages.

The only exception to that is during configuration (which is done before
daemonization) to let the user know about problems immediately.

15 years agosrc/Makefile: Do not print the command when checking for POD ERRORS.
Sebastian Harl [Fri, 19 Dec 2008 16:16:35 +0000 (17:16 +0100)]
src/Makefile: Do not print the command when checking for POD ERRORS.

Else, the build output would include the word "error" in a cryptically looking
paragraph which might confuse users.

15 years agocollectd.conf(5): Updated the section about the "mysql" plugin.
Sebastian Harl [Fri, 19 Dec 2008 16:00:56 +0000 (17:00 +0100)]
collectd.conf(5): Updated the section about the "mysql" plugin.

 * Do not talk about what RRD files things end up in - there is more than
   "rrdtool" by now.
 * Updated the section number of the "Server Status Variables" in the MySQL
   reference manual.
 * Mention that the MySQL user does not need any special privileges.

15 years agocollectd: Abort with an appropriate status in exit_usage().
Sebastian Harl [Wed, 10 Dec 2008 21:12:24 +0000 (22:12 +0100)]
collectd: Abort with an appropriate status in exit_usage().

In case of an error, the exit status code now equals 1.

15 years agocollectd: Abort if any non-options are left over after command-line parsing.
Sebastian Harl [Wed, 10 Dec 2008 21:08:26 +0000 (22:08 +0100)]
collectd: Abort if any non-options are left over after command-line parsing.

This happens if any arguments not starting with a dash are passed to collectd.
Any of those are invalid, so let the user know about that.

Thanks to Kris (gruntruk) for (unknowingly) pointing that out ;-)

15 years agocollectd-nagios: Be more verbose before bailing out with usage().
Sebastian Harl [Tue, 9 Dec 2008 11:49:36 +0000 (12:49 +0100)]
collectd-nagios: Be more verbose before bailing out with usage().

15 years agocollectd-nagios: Added "percentage" to the help output.
Sebastian Harl [Mon, 8 Dec 2008 23:47:30 +0000 (00:47 +0100)]
collectd-nagios: Added "percentage" to the help output.

15 years agocollectd-nagios: Generalized the "percentage" consolidation function.
Sebastian Harl [Mon, 8 Dec 2008 23:33:55 +0000 (00:33 +0100)]
collectd-nagios: Generalized the "percentage" consolidation function.

Calculation of the percentage is not limited to two values any more but an
arbitrary number may be used now. This allows a more flexible usage.

Also, the documentation has been updated.

15 years agocollectd-nagios: add new "percentage" aggregate function.
Fabian Linzberger [Mon, 3 Nov 2008 19:06:46 +0000 (20:06 +0100)]
collectd-nagios: add new "percentage" aggregate function.

the percentage aggregate function takes exactly two values. it
computes the percentage of the first value versus the sum of the first
and the second value. very useful for checking df values like:

sudo collectd-nagios -s /var/run/collectd-unixsock -H localhost -n df/df-root -d used -d free -g percentage -w 20: -c 10:

which will warn if there is less than 20% free space.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
15 years agocollectd-nagios: If DSs are specified, sort the values accordingly.
Sebastian Harl [Tue, 9 Dec 2008 11:27:47 +0000 (12:27 +0100)]
collectd-nagios: If DSs are specified, sort the values accordingly.

If a user specifies DSs on the command line, the order or the values might
matter (e.g. when using the upcoming "percentage" consolidation function). So,
in this case we now order the values according to the order of the specified
DSs.

This patch replaces the function ignore_ds() with filter_ds() which is called
once in do_check(). This removes the need to check for ignored values in all
consolidation function implementations.

15 years agolibcollectdclient: Build the library using -Wall -Werror.
Sebastian Harl [Tue, 9 Dec 2008 09:57:10 +0000 (10:57 +0100)]
libcollectdclient: Build the library using -Wall -Werror.

Fixed two minor issues detected by those flags.

15 years agolibcollectdclient/client.c: Let COLLECT_DEBUG decide about debugging.
Sebastian Harl [Tue, 9 Dec 2008 09:51:30 +0000 (10:51 +0100)]
libcollectdclient/client.c: Let COLLECT_DEBUG decide about debugging.

The file now includes config.h and enables debugging based on COLLECT_DEBUG
instead of some hard-coded value.

15 years agoperl plugin, utils_complain: Fixed errors identified by -Wformat-security.
Sebastian Harl [Sat, 6 Dec 2008 16:29:42 +0000 (17:29 +0100)]
perl plugin, utils_complain: Fixed errors identified by -Wformat-security.

A few "format not a string literal and no format arguments" errors have been
fixed by using "%s" as the format argument.

Thanks to Kevin (onebinary) for reporting this.

15 years agocollectd.conf.in: Fixed a wrong type used in the "tail" example.
Sebastian Harl [Sat, 6 Dec 2008 15:41:04 +0000 (16:41 +0100)]
collectd.conf.in: Fixed a wrong type used in the "tail" example.

15 years agocollectd.conf.pod: Consistently use spaces instead of tabs in examples.
Sebastian Harl [Sat, 6 Dec 2008 15:32:27 +0000 (16:32 +0100)]
collectd.conf.pod: Consistently use spaces instead of tabs in examples.

15 years agoprocesses plugin: Get complete command line for processes on Linux as well.
Sebastian Harl [Tue, 25 Nov 2008 16:53:53 +0000 (17:53 +0100)]
processes plugin: Get complete command line for processes on Linux as well.

On Linux, /proc/<pid>/cmdline is now used to determine the complete command
line of a process which may then be used with the "ProcessMatch" configuration
option.

15 years agoprocesses plugin: Do not silently ignore configuration errors.
Sebastian Harl [Sat, 22 Nov 2008 17:39:00 +0000 (18:39 +0100)]
processes plugin: Do not silently ignore configuration errors.

15 years agocollectd.conf(5): Documented the "ProcessMatch" option.
Sebastian Harl [Fri, 21 Nov 2008 18:11:00 +0000 (19:11 +0100)]
collectd.conf(5): Documented the "ProcessMatch" option.

15 years agoconfigfile.c: Ignore registered undefined config keys.
Sebastian Harl [Fri, 5 Dec 2008 16:22:53 +0000 (17:22 +0100)]
configfile.c: Ignore registered undefined config keys.

If a registered config key equals NULL, it is now ignored. Before, this would
cause a segfault. As this has happened a few times in the past, we not handle
it sanely.