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
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
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.
A leftover from the previous setting, a hard-coded maximum, was forgotten.
notification target: Add a target that dispatches notifications.
Not tested very well yet, but it works essentially.
Not tested very well yet, but it works essentially.
src/common.c: Change `sstrdup' to not call `strdup' anymore.
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.
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.
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.
..using regular expressions.
Possible future improvements: Use submatches in the replacement string,
similar to sed's \1, \2, ... back-references.
Merge branch 'collectd-4.5'
Merge branch 'collectd-4.4' into collectd-4.5
Conflicts:
src/utils_dns.c
Conflicts:
src/utils_dns.c
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.
The only exception to that is during configuration (which is done before
daemonization) to let the user know about problems immediately.
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.
Else, the build output would include the word "error" in a cryptically looking
paragraph which might confuse users.
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.
* 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.
collectd: Abort with an appropriate status in exit_usage().
In case of an error, the exit status code now equals 1.
In case of an error, the exit status code now equals 1.
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 ;-)
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 ;-)
collectd-nagios: Be more verbose before bailing out with usage().
collectd-nagios: Added "percentage" to the help output.
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.
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.
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>
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>
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.
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.
libcollectdclient: Build the library using -Wall -Werror.
Fixed two minor issues detected by those flags.
Fixed two minor issues detected by those flags.
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.
The file now includes config.h and enables debugging based on COLLECT_DEBUG
instead of some hard-coded value.
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.
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.
collectd.conf.in: Fixed a wrong type used in the "tail" example.
collectd.conf.pod: Consistently use spaces instead of tabs in examples.
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.
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.
processes plugin: Do not silently ignore configuration errors.
collectd.conf(5): Documented the "ProcessMatch" option.
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.
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.
processes plugin: Fixed a segfault when handling unknown config options.
When using STATIC_ARRAY_SIZE() to determine the number of config keys, the
list must not include NULL. Else, the configfile module will handle that as
another config key and dereference it in case no previous key matched, i.e.
when handling unknown config options.
When using STATIC_ARRAY_SIZE() to determine the number of config keys, the
list must not include NULL. Else, the configfile module will handle that as
another config key and dereference it in case no previous key matched, i.e.
when handling unknown config options.
unixsock plugin: Make sure the initialization function is run only once.
If called multiple times, the global `sock_fd' variable will be re-set,
breaking the plugin.
If called multiple times, the global `sock_fd' variable will be re-set,
breaking the plugin.
Merge branch 'collectd-4.5'
configure.in: Check for `kvm_openfiles'.
Check for both, `kvm_nlist' and `kvm_openfiles' before enabling the
tcpconns plugin with libkvm: Solaris has a libkvm, too, but doesn't
provide the necessary functions to read the connections with it. At
least not in the same way.
Check for both, `kvm_nlist' and `kvm_openfiles' before enabling the
tcpconns plugin with libkvm: Solaris has a libkvm, too, but doesn't
provide the necessary functions to read the connections with it. At
least not in the same way.
Merge branch 'collectd-4.4' into collectd-4.5
configure.in: Some improvements for Solaris, expecially the swap plugin.
If Solaris is detected, "-D_POSIX_PTHREAD_SEMANTICS" will be added to
CPPFLAGS automatically now.
If sys/swap.h is not found, print a message suggesting to build a 64bit
binary. (sys/swap.h cannot be included when a 32bit binary is being built,
but it's most likely present under Solaris.)
Enable the swap plugin only if sys/swap.h has been found (when under
Solaris).
If Solaris is detected, "-D_POSIX_PTHREAD_SEMANTICS" will be added to
CPPFLAGS automatically now.
If sys/swap.h is not found, print a message suggesting to build a 64bit
binary. (sys/swap.h cannot be included when a 32bit binary is being built,
but it's most likely present under Solaris.)
Enable the swap plugin only if sys/swap.h has been found (when under
Solaris).
src/collectd-nagios.c: Include "config.h" before <stdlib.h>.
Otherwise _FILE_OFFSET_BITS may be redefined.
Otherwise _FILE_OFFSET_BITS may be redefined.
Merge branch 'collectd-4.5'
src/plugin.[ch]: Don't use unnamed unions.
They're non-standard and cause a lot of trouble.
They're non-standard and cause a lot of trouble.
libcollectdclient/client.c: Define NI_MAXHOST to 1025.
Apparently this define has been obsoleted by RFC 3493, so SunOS 5.11 no
longer defines it. This probably is a problem somewhere else, too.
Apparently this define has been obsoleted by RFC 3493, so SunOS 5.11 no
longer defines it. This probably is a problem somewhere else, too.
Merge branch 'collectd-4.5'
Merge branch 'collectd-4.4' into collectd-4.5
multimeter plugin: Check the return value of `write'.
This resolves warnings when compiling on GNU with:
CPPFLAGS="-D_FORTIFY_SOURCE"
This resolves warnings when compiling on GNU with:
CPPFLAGS="-D_FORTIFY_SOURCE"
collectd.conf(5): Fix a POD error.
value match: Add a match to check the actual value(s) of data-sources.
src/filter_chain.[ch]: Implement the built-in `return' target.
The `stop' target now aborts all processing of the value completely, `return'
only stops the current chain and continues processing the parent chain.
The collectd.conf(5) manual page has been updated and the `FC_ACTION_*' defines
have been renamed to `FC_TARGET_*'.
The `stop' target now aborts all processing of the value completely, `return'
only stops the current chain and continues processing the parent chain.
The collectd.conf(5) manual page has been updated and the `FC_ACTION_*' defines
have been renamed to `FC_TARGET_*'.
collectd.conf(5): Document the regex match and the set target.
regex match: Require *all* regular expressions to match.
Before, when there were multiple regular expressions for the same field,
for example the host, only of of those regular expressions needed to
match for a successful overall match.
The new behavior is not that *all* regular expressions need to match for
a successful overall match. This makes the behavior much easier to
understand.
Before, when there were multiple regular expressions for the same field,
for example the host, only of of those regular expressions needed to
match for a successful overall match.
The new behavior is not that *all* regular expressions need to match for
a successful overall match. This makes the behavior much easier to
understand.
set target: Don't allow setting of the `type' field.
set target: Implement a target to set fields in a value list.
It's currently possible to re-set the `type'. This is most likely not
good and will result in unpredictable behavior. I'll remove that,
probably.
It's currently possible to re-set the `type'. This is most likely not
good and will result in unpredictable behavior. I'll remove that,
probably.
regex match: Add myself to the list of copyright holders.
Sebastian insisted on it ;)
Sebastian insisted on it ;)
src/filter_chain.c: Beatify debug and warning messages.
src/filter_chain.c: Actually abort default targets when one signals `stop'.
It should not behave as documented.
It should not behave as documented.
src/filter_chain.c: Fix a rather unimportant typo.
collectd.conf.in: Add something for the filtering stuff.
Mostly a pointer to the manual page for now.
Mostly a pointer to the manual page for now.
collectd.conf(5): Add an example to the filter documentation.
src/filter_chain.c: Implement the default behavior.
If no <Chain> is defined, send all values to all write plugins.
If no <Chain> is defined, send all values to all write plugins.
src/meta_data.[ch]: Added a framework for meta data.
This framework is planned to be used in at least three places:
- Extend the global cache to allow attaching a meta-data object to each
entry. The meta-data can then be used by other plugins to attach
miscellaneous information to an entry. Possibly uses include
calculation of floating averages or storing the state for a hysteresis
threshold.
- Add a meta-data object to every `value_list_t' in
`plugin_dispatch_values'. The meta-data object can then be used by
matches and targets to pass information about a value-list to one
another.
- Replace the notification meta-data stuff in src/plugin.[ch] with such
an object.
This framework is planned to be used in at least three places:
- Extend the global cache to allow attaching a meta-data object to each
entry. The meta-data can then be used by other plugins to attach
miscellaneous information to an entry. Possibly uses include
calculation of floating averages or storing the state for a hysteresis
threshold.
- Add a meta-data object to every `value_list_t' in
`plugin_dispatch_values'. The meta-data object can then be used by
matches and targets to pass information about a value-list to one
another.
- Replace the notification meta-data stuff in src/plugin.[ch] with such
an object.
Merge branch 'ff/libcollectdclient'
Merge branch 'ff/filter'
src/filter_chain.c, src/match_regex.c: Add some debugging messages.
src/plubin.c: Call `fc_process' instead of calling the write plugins directly.
src/filter_chain.c: Allow the create-function of mathces to be NULL.
Not all targets actually need to be created, for example
the `stop' target.
Not all targets actually need to be created, for example
the `stop' target.
src/filter_chain.c: Add `Target' blocks to `Chain' blocks.
I simply forgot them :/
I simply forgot them :/
match_regex plugin: Fix a typo.
src/configfile.c: Dispatch the `Chain' blocks to fc_configure.
src/plugin.c: Use the write-list in plugin_write.
Not the flush-list, doh!
Not the flush-list, doh!
match_regex plugin: Renamed `filter_pcre' to `match_regex'.
In order to fit into the new match/target schema, the substitute part of the
plugin has been removed for now and will be put in a target plugin in the
future.
The match_regex now registeres a match with the new infrastructure and uses
regular expressions to match certain values based on their identifier.
In order to fit into the new match/target schema, the substitute part of the
plugin has been removed for now and will be put in a target plugin in the
future.
The match_regex now registeres a match with the new infrastructure and uses
regular expressions to match certain values based on their identifier.
src/filter_chain.[ch]: Implement an advanced filtering framework.
The concept separates `filter' plugins into `match' and `target' plugins. Those
two parts can be combined in wild variation, allowing *very* flexible
mechanisms.
The concept is explained in more detail in the `FILTER CONFIGURATION' section
of collectd.conf(5), also added with this commit.
The concept separates `filter' plugins into `match' and `target' plugins. Those
two parts can be combined in wild variation, allowing *very* flexible
mechanisms.
The concept is explained in more detail in the `FILTER CONFIGURATION' section
of collectd.conf(5), also added with this commit.
src/plugin.[ch]: Implement `plugin_write', a function to pass values to specific write plugins.
This function does none of the magic `plugin_dispatch_value' does. It simiply
takes a value and passes it to the requested plugin.
This function is intended to be used with the upcoming `filter chain' code,
which will allow to pass values to specific plugins only.
This function does none of the magic `plugin_dispatch_value' does. It simiply
takes a value and passes it to the requested plugin.
This function is intended to be used with the upcoming `filter chain' code,
which will allow to pass values to specific plugins only.
configure.in: Include <stdint.h> and <inttypes.h> when checking for double storage layout.
Some systems, for example Solaris 9, don't have <stdint.h> and define
`uint32_t' via <inttypes.h> instead. Be more permissive by including
both header files when checking how doubles are stored in memory.
Some systems, for example Solaris 9, don't have <stdint.h> and define
`uint32_t' via <inttypes.h> instead. Be more permissive by including
both header files when checking how doubles are stored in memory.
contrib/collection.cgi: Add meta-graph definitions for the vmem plugin.
contrib/collection.cgi: Add graph definitions for the vmem plugin.
dbi plugin: Replace `dbi_conn_error_flag' with `dbi_conn_error'
Version 0.8 of the libdbi deprecates `dbi_conn_error_flag', so use the other
function.
Version 0.8 of the libdbi deprecates `dbi_conn_error_flag', so use the other
function.
mysql plugin: Fix a typo: `$endptr' -> `&endptr'.
Yes, I've done a little Perl lately ;)
Also fix a non-void function without return value..
Yes, I've done a little Perl lately ;)
Also fix a non-void function without return value..
libcollectdclient: Use the `SSTRCATF' macro some more.
This really does make stuff shorter. Hopefully it
makes it easier to read, too.
This really does make stuff shorter. Hopefully it
makes it easier to read, too.
libcollectdclient: Document the used macros.
They're probably not obvious unless you've doe quite
some C coding.
They're probably not obvious unless you've doe quite
some C coding.
libcollectdclient: Implemented `lcc_flush'.
libcollectdclient: Implemented `lcc_putval'.
collectd-nagios: Use `libcollectdclient' and various improvements.
The improvements include:
- Copyright and license header.
- More consistent output.
- Frees some more memory that was allocated..
- Better standards compliance.
- Make all functions `static' (except `main', of course).
- Use `%g' instead of `%lf' to print floating point values.
The improvements include:
- Copyright and license header.
- More consistent output.
- Frees some more memory that was allocated..
- Better standards compliance.
- Make all functions `static' (except `main', of course).
- Use `%g' instead of `%lf' to print floating point values.
src/libcollectdclient: Add a library which abstracts talking to the `unixsock' plugin.
Merge branch 'master' of octo@verplant.org:/var/lib/git/collectd
mysql plugin: Be more careful when parsing the `Port' argument.
collectd.conf(5): Document the new options of the mysql plugin.
mysql plugin: Allow configuration of `Port' and `Socket'.
Hi,
I have a patch for mysql collectd library.
The patch allow to specify also Port and Socket
parameters for those who have a non-standard configuration
of mysql.
It's very straightforward. If accepted, there is only to
change documentation and config file to reflect the new
parameters.
Enjoy
Mirko
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Hi,
I have a patch for mysql collectd library.
The patch allow to specify also Port and Socket
parameters for those who have a non-standard configuration
of mysql.
It's very straightforward. If accepted, there is only to
change documentation and config file to reflect the new
parameters.
Enjoy
Mirko
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
filter_pcre: Handle out of memory situations more gracefully.
Merge branch 'sh/next'
Merge branch 'collectd-4.5'
Merge branch 'collectd-4.4' into collectd-4.5
src/utils_rrdcreate.c: srrd_create: Copy the `filename' argument.
Some versions of librrd, for example the one in Debian Etch, don't have the
`const' qualifier for the first (filename) argument for `rrd_create_r'. So
we'll copy the argument first. This sucks big time, but is the only reasonable
way to get around this.
Some versions of librrd, for example the one in Debian Etch, don't have the
`const' qualifier for the first (filename) argument for `rrd_create_r'. So
we'll copy the argument first. This sucks big time, but is the only reasonable
way to get around this.
Install types.db into PKGDATADIR instead of PKGLIBDIR.
The FHS specifies that /usr/share should be used to store architecture
independent data while /usr/lib includes object files, libraries and
architecture dependent data.
The FHS specifies that /usr/share should be used to store architecture
independent data while /usr/lib includes object files, libraries and
architecture dependent data.
contrib/oracle: Fixed some typos.
filter_pcre plugin: Added support to rewrite value lists.
For this purpose "Substitute*" options have been introduced for each regex
option. Upon a successful match, the matching substring will be replaced by
the specified replacement text.
Configuration example:
<Plugin filter_pcre>
<RegEx>
Plugin "^sensors$"
PluginInstance "^Some Weird Sensor Chip Name Prefix"
SubstitutePluginInstance "foo"
</RegEx>
</Plugin>
For this purpose "Substitute*" options have been introduced for each regex
option. Upon a successful match, the matching substring will be replaced by
the specified replacement text.
Configuration example:
<Plugin filter_pcre>
<RegEx>
Plugin "^sensors$"
PluginInstance "^Some Weird Sensor Chip Name Prefix"
SubstitutePluginInstance "foo"
</RegEx>
</Plugin>
utils_subst: Added a module providing functions for string substitution.
Currently, the functions subst() and asubst() are available which may be used
to replace parts of a string with a specified replacement text. The latter
automatically allocates the memory required for the return value while the
former writes to a user specified buffer.
Currently, the functions subst() and asubst() are available which may be used
to replace parts of a string with a specified replacement text. The latter
automatically allocates the memory required for the return value while the
former writes to a user specified buffer.
utils_*.h: Made header files self-hosting.
Added (hopefully) all missing includes.
Added (hopefully) all missing includes.
filecount plugin: Added the "Recursive" config option.
This option controls whether or not to recurse into subdirectories. It's
enabled by default, so backward-compatibility is retained.
This option controls whether or not to recurse into subdirectories. It's
enabled by default, so backward-compatibility is retained.
collectd.conf(5): Added a missing </RegEx> to the configuration example.
libiptc/Makefile.am: Added xtables.h, libxtc.h to libiptc_la_SOURCES.
Else, those files would not be included in the tarball.
Else, those files would not be included in the tarball.
src/Makefile: Build ipvs and uuid plugins using $AM_CFLAGS.
configure, mysql plugin: Check for mysql.h as well.
Up to now, only mysql/mysql.h has been checked for. However, mysql_config
--cflags usually adds the complete path to mysql.h to the include flags. In
most setups, mysql/mysql.h can be found in the search path as well (usually
the header is available in something like /usr/include/mysql/mysql.h) so this
issue has not been found so far. However, if that's not the case, the build
will fail.
Thanks to Dusty Doris <collectd@dusty.name> for reporting this.
Up to now, only mysql/mysql.h has been checked for. However, mysql_config
--cflags usually adds the complete path to mysql.h to the include flags. In
most setups, mysql/mysql.h can be found in the search path as well (usually
the header is available in something like /usr/include/mysql/mysql.h) so this
issue has not been found so far. However, if that's not the case, the build
will fail.
Thanks to Dusty Doris <collectd@dusty.name> for reporting this.
contrib/collection3: Add the `format' parameter to the graph.cgi.
With this parameter one can specify the file format the graph is returned in,
for example `format=SVG' for an SVG image.
With this parameter one can specify the file format the graph is returned in,
for example `format=SVG' for an SVG image.
src/utils_complain.c: Include "collectd.h" as first header file.
This is needed to get the _FILE_OFFSET_BITS define right.
This is needed to get the _FILE_OFFSET_BITS define right.
apcups plugin: Include "collectd.h" *before" <stdlib.h>.
If not defined, <stdlib.h> sets/defines _FILE_OFFSET_BITS. Since (in 32bit
mode) "collectd.h" defines that, too, you'll run into compilation problems.
If not defined, <stdlib.h> sets/defines _FILE_OFFSET_BITS. Since (in 32bit
mode) "collectd.h" defines that, too, you'll run into compilation problems.