Sebastian Harl [Sun, 20 Jan 2008 21:14:23 +0000 (22:14 +0100)]
Added support for more than one TypesDB file.
The "TypesDB" config option now accepts more than one filename. Each file will
be read in the specified order. If no filename has been given, the default
file will _not_ be read (I doubt this is a useful feature but it's imho the
most reasonable behavior).
This may, for example, be used to specify an additional file containing custom
data-set definitions. See the thread "Thought about exec and types.db" on the
mailing-list ([1]).
Richard Jones [Thu, 10 Jan 2008 08:43:32 +0000 (09:43 +0100)]
libvirt plugin: Fix the HostnameFormat option.
The attached patch fixes HostnameFormat in libvirt driver.
The intended use for this was:
HostnameFormat "name"
generating hostnames like "<guestname>" (the default case), and:
HostnameFormat "hostname name"
generating hostnames like "<hostname>:<guestname>".
Somewhere along the way, however, that code got broken so it always adds a ":"
before the name, and doesn't concatenate any more, so you'd get weird hostnames
appearing like ":guest" which was supposed to be "hostname:guest".
Sebastian Harl [Thu, 27 Dec 2007 15:40:30 +0000 (16:40 +0100)]
configure.in: Copy sources of the Perl bindings to the build directory.
As the Perl build system around ExtUtils::MakeMaker doesn't know how to
separate source and build directories, all relevant source files have to be
available in the build directory.
This is an alternative patch for the problem reported by Michael Tiernan.
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Wed, 19 Dec 2007 19:37:30 +0000 (20:37 +0100)]
utils_mount.c: Fixed an unused variable warning on some systems.
This warning appeared on systems using listmntent() or getv?fsstat() when
compiling with debugging disabled only. It was caused by the declaration of a
character array for use with sstrerror() inside a call to DEBUG().
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Florian Forster [Wed, 26 Dec 2007 14:34:18 +0000 (15:34 +0100)]
sensors plugin: While I was at it I reorganized the code a little so it's easier to read.
For instance I moved the name to type conversion out of the main loop and into
a separate function, likewise the chip to string representation conversion. The
`submit' function is now very careful that all strings are null terminated and
that no buffer overflow may occur.
Florian Forster [Thu, 20 Dec 2007 21:37:39 +0000 (22:37 +0100)]
src/utils_cache.[ch]: Implemented uc_[gs]et_state to receive and set the state of a value.
This is most likely very buggy. The intention is that this is used in the
threshold module to decide wether or not so send a notification, i. e. if the
problem existed before or not.
Florian Forster [Wed, 19 Dec 2007 14:07:10 +0000 (15:07 +0100)]
src/utils_threshold.c: Implemented the new `Persist' option.
The idea is that, if the option is set to `true', many notifications will be
sent, until the problem vanishes again. If set to `false' only one notification
will be sent upon a state change.
This, however, is not implemented yet.
Florian Forster [Mon, 17 Dec 2007 14:37:01 +0000 (15:37 +0100)]
utils_{cache,threshold}.[ch]: Implemented the ``check interesting'' function.
The cache now checks if a missing value would be ``interesting'', i. e. if a
threshold is configured for it. If so, a notification is send and the entry is
_not_ removed from the cache. Otherwise, no notification is sent and the entry
is removed.
The changes have been tested a little and should basically work.
Florian Forster [Sat, 15 Dec 2007 11:11:06 +0000 (12:11 +0100)]
src/utils_cache.[ch]: Added the `uc_check_timeout' function.
This function is called before the read plugins. It checks if values are
missing, i. e. have not been reported for longer than twice their ``interval''.
In this case a notification is created, though this is probably not the final
behavior.
This code is highly experimental.
Luke Heberling [Thu, 13 Dec 2007 07:09:16 +0000 (08:09 +0100)]
src/utils_avltree.c: Fix avl_get to work as documented.
The documentation in the header file for avl_get states that value may be null,
but the code in the source file asserts otherwise. This patch changes the code
to reflect the documentation.
nginx plugin: Use strcmp rather than strcpy to compare strings.
I believe I found a typo in nginx.c which prevents collectd with nginx plugin
from working. Collectd segfaults at startup. Here is a tiny patch to correct
the issue. When applied, everything works as expected.
Luke Heberling [Wed, 12 Dec 2007 07:43:34 +0000 (08:43 +0100)]
src/utils_llist.[ch]: Changed the semantic so module doesn't copy the `key'.
Whilst looking at my implementation of the plugins we've discussed which are
now using dual avl trees, I saw that the utils_llist module would be a more
efficient substitute for the second avl tree. However, it would need to know
its size and would preferably not duplicate and own the key for each item.
Here's a patch which does this. These changes might make it easier for future
plugins to use the linked list for similar purposes, similar to the way the avl
tree does not impose any lifetime on its keys.
Sebastian Harl [Mon, 26 Nov 2007 11:17:26 +0000 (12:17 +0100)]
perl plugin: Fixed a memory leak in pplugin_register_data_set().
The data set definition is copied by plugin_register_data_set() (in plugin.c)
and thus should be freed after it has been passed on to the plugin module.
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Sun, 25 Nov 2007 13:54:05 +0000 (14:54 +0100)]
collectdmon: Added a small daemon monitoring collectd.
This is a small "wrapper" daemon which starts and monitors the collectd
daemon. If collectd terminates it will automatically be restarted, unless
collectdmon was told to shut it down.
Current features:
* restarting the daemon
* logging to syslog
* detection of quickly, repeatedly respawning processes
(similar to SysV init)
collectdmon is similar to mysqld_safe.
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Sat, 17 Nov 2007 19:50:00 +0000 (20:50 +0100)]
logfile plugin: Default to $localstatedir/log/collectd.log instead of STDOUT.
Imho STDOUT is only a useful default during debugging (which should be by far
the less common case ;-). In any other case it might just "pollute" the
messages printed by e.g. the init script.
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Wed, 21 Nov 2007 21:00:42 +0000 (22:00 +0100)]
perl plugin: Made global variables available to Perl plugins.
The "let's become magical" commit.
Each global variable (currently hostname_g and interval_g) will be exported by
introducing an equally named Perl variable. Perl's concept of "magic" is used
to create a read/write interface to the C variables (think of the variables as
being tied). This way any changes to the C variables will be immediately
accessible from the Perl plugin and vice versa.
Sebastian Harl [Mon, 19 Nov 2007 23:20:25 +0000 (00:20 +0100)]
perl plugin: Shut down an ithread if the embedding pthread terminates.
Each ithread object is registered as thread specific data along with a
destructor function. If the embedding pthread terminates the destructor is
called which takes care of cleanly shutting down the appropriate Perl
interpreter and freeing any related resources.
Sebastian Harl [Sun, 18 Nov 2007 19:37:36 +0000 (20:37 +0100)]
perl plugin: Fixed error in ithread shutdown loop.
Using the sfree() macro, the loop variable was accidentally set to NULL at the
end of the loop, causing the loop to terminate after the first iteration.
Sebastian Harl [Tue, 20 Nov 2007 07:45:22 +0000 (08:45 +0100)]
perl plugin: Execute END blocks in main thread only.
Each END block is executed during perl_destruct() which happens once for each
ithread. As the number of ithreads are in no way related to any Perl plugins
this is not what we want. Now, each END block is only executed when the main
threads terminates (which happens after any other Perl thread has been shut
down).
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Sat, 17 Nov 2007 19:49:19 +0000 (20:49 +0100)]
src/Makefile.am: Add installation directory defines to AM_CPPFLAGS.
Those definitions used to be available when compiling collectd itself only.
However, they should be available to the plugins as well - else, different
paths would be used within different parts of collectd.
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Sat, 17 Nov 2007 17:45:58 +0000 (18:45 +0100)]
Collectd.pm: Improved error handling of failed callbacks.
If call_by_name() failed, it will be handled the same way as if the callback
returned "false". The $@ variable may now be used by plugins as well to
describe errors in greater detail.
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Sat, 17 Nov 2007 17:43:19 +0000 (18:43 +0100)]
Collectd.pm: Use threads::shared to share @plugins between threads.
The list of plugins has to be common to all threads to be able to (un)register
callbacks after initialization. As threads::shared is not able to share
references to subroutines the callbacks now have to be identified by their
name. Collectd::call_by_name() is used to execute the callbacks.
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Sat, 17 Nov 2007 17:38:45 +0000 (18:38 +0100)]
perl plugin: Added Collectd::call_by_name().
This XSUB passes on a function call to a subroutine identified by its name
passed through $Collectd::cb_name. Collectd::call_by_name does not touch the
stack (unless in case of an error), thus any arguments and return values are
kept in place.
This function is meant to be used inside Collectd.pm only.
Signed-off-by: Sebastian Harl <sh@tokkee.org> Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Sebastian Harl [Tue, 13 Nov 2007 23:00:05 +0000 (00:00 +0100)]
bindings/Makefile.am: perl/Makefile depends on config.status.
Any configuration changes should be forwarded to the perl bindings. This patch
will cause perl/Makefile to be recreated after a rerun of the configure
script.