Merge commit 'trenkel/st/python'
authorFlorian Forster <octo@huhu.verplant.org>
Tue, 5 Jan 2010 10:55:28 +0000 (11:55 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Tue, 5 Jan 2010 10:55:28 +0000 (11:55 +0100)
Conflicts:

src/python.c

27 files changed:
ChangeLog
README
bindings/Makefile.am
bindings/perl/lib/Collectd.pm
bindings/perl/lib/Collectd/Plugins/Monitorus.pm
configure.in
contrib/collection3/README
src/apache.c
src/battery.c
src/collectd-python.pod
src/collectd-snmp.pod
src/collectd.conf.in
src/collectd.conf.pod
src/common.c
src/common.h
src/curl.c
src/df.c
src/filecount.c
src/memory.c
src/network.c
src/oracle.c
src/ping.c
src/processes.c
src/routeros.c
src/rrdtool.c
src/thermal.c
version-gen.sh

index 5aed2de..6275837 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * scale target: This target to scale (multiply) values by an arbitrary
          value has been added.
 
+2009-12-18, Version 4.8.2
+       * Build system, java plugin: Don't use “find -L” to search for Java
+         headers, because it's a GNU extension.
+       * Build system: Support for parallel builds has been improved. Thanks
+         Sebastian Harl and Stefan Völkel for looking into this.
+       * collectd: Print error messages to STDERR if no log plugin has been
+         loaded.
+       * genericjmx plugin: Close and re-open the connection upon I/O-errors.
+       * gmond plugin: Fix typos which caused syntax errors.
+       * memory plugin: Handling of >4 Gbyte of memory has been fixed.
+       * network plugin: The license has been changed to LGPL 2.1.
+       * oracle plugin: Reconnect to the database if the connection dies.
+       * rrdcached plugin: Work-around for a bug in RRDtool 1.4rc2 has been
+         added.
+       * snmp plugin: Handling of negative values has been fixed. Strings
+         containing control characters are now interpreted as hex-strings.
+       * unixsock plugin: A memory leak in the LISTVAL command has been
+         fixed. Thanks to Ben Knight for his patch.
+
 2009-10-04, Version 4.8.1
        * Build system: Issues when building the iptables plugin have been
          fixed.
@@ -53,7 +72,7 @@
          been added. “DERIVE” can be used for counters that are reset
          occasionally. Thanks to Mariusz Gronczewski for implementing this.
        * thresholds: The advanced threshold options “Percentage”, “Hits”, and
-         “Hysteresis” have been added. Thanks to Andrés J. Díaz for hit
+         “Hysteresis” have been added. Thanks to Andrés J. Díaz for his
          patches.
        * curl_json plugin: The new cURL-JSON plugin reads JSON files using
          the cURL library and parses the contents according to user
          lists, where at least one data source is of type COUNTER and the
          counter value of all counter data sources is zero.
 
+2009-12-18, Version 4.7.5
+       * Build system, java plugin: Don't use “find -L” to search for Java
+         headers, because it's a GNU extension.
+       * Build system: Support for parallel builds has been improved. Thanks
+         Sebastian Harl and Stefan Völkel for looking into this.
+       * collectd: Print error messages to STDERR if no log plugin has been
+         loaded.
+       * memory plugin: Handling of >4 Gbyte of memory has been fixed.
+       * network plugin: The license has been changed to LGPL 2.1.
+       * oracle plugin: Reconnect to the database if the connection dies.
+       * rrdcached plugin: Work-around for a bug in RRDtool 1.4rc2 has been
+         added.
+       * snmp plugin: Handling of negative values has been fixed. Strings
+         containing control characters are now interpreted as hex-strings.
+       * unixsock plugin: A memory leak in the LISTVAL command has been
+         fixed. Thanks to Ben Knight for his patch.
+
 2009-10-03, Version 4.7.4
        * Build system: Issues when building the iptables plugin have been
          fixed.
diff --git a/README b/README
index e95bae6..96fbdf3 100644 (file)
--- a/README
+++ b/README
@@ -223,6 +223,9 @@ Features
       collectd without the need to start a heavy interpreter every interval.
       See collectd-python(5) for details.
 
+    - routeros
+      Query interface and wireless registration statistics from RouterOS.
+
     - rrdcached
       RRDtool caching daemon (RRDcacheD) statistics.
 
@@ -386,6 +389,9 @@ Features
     - match_empty_counter
       Match counter values which are currently zero.
 
+    - match_hashed
+      Match values using a hash function of the hostname.
+
     - match_regex
       Match values by their identifier based on regular expressions.
 
@@ -401,6 +407,9 @@ Features
     - target_replace
       Replace parts of an identifier using regular expressions.
 
+    - target_scale
+      Scale (multiply) values by an arbitrary value.
+
     - target_set
       Set (overwrite) entire parts of an identifier.
 
index b81340b..f39e9bb 100644 (file)
@@ -7,6 +7,7 @@ endif
 EXTRA_DIST = perl/Makefile.PL \
             perl/lib/Collectd.pm \
             perl/lib/Collectd/Unixsock.pm \
+            perl/lib/Collectd/Plugins/Monitorus.pm \
             perl/lib/Collectd/Plugins/OpenVZ.pm
 
 all-local: @PERL_BINDINGS@
index 557950c..ef2f3e5 100644 (file)
@@ -135,6 +135,12 @@ my %fc_exec_names = (
        FC_TARGET, "invoke"
 );
 
+my %fc_cb_types = (
+       FC_CB_EXEC, "exec",
+       FC_CB_CREATE, "create",
+       FC_CB_DESTROY, "destroy"
+);
+
 foreach my $type (keys %types) {
        $plugins[$type] = &share ({});
 }
@@ -172,7 +178,9 @@ sub plugin_call_all {
        }
 
        if (TYPE_LOG != $type) {
-               DEBUG ("Collectd::plugin_call: type = \"$type\", args=\"@_\"");
+               DEBUG ("Collectd::plugin_call: type = \"$type\" ("
+                       . $types{$type} . "), args=\""
+                       . join(', ', map { defined($_) ? $_ : '<undef>' } @_) . "\"");
        }
 
        if (! defined $plugins[$type]) {
@@ -267,7 +275,8 @@ sub plugin_register {
        my $data = shift;
 
        DEBUG ("Collectd::plugin_register: "
-               . "type = \"$type\", name = \"$name\", data = \"$data\"");
+               . "type = \"$type\" (" . $types{$type}
+               . "), name = \"$name\", data = \"$data\"");
 
        if (! ((defined $type) && (defined $name) && (defined $data))) {
                ERROR ("Usage: Collectd::plugin_register (type, name, data)");
@@ -322,7 +331,8 @@ sub plugin_unregister {
        my $type = shift;
        my $name = shift;
 
-       DEBUG ("Collectd::plugin_unregister: type = \"$type\", name = \"$name\"");
+       DEBUG ("Collectd::plugin_unregister: type = \"$type\" ("
+               . $types{$type} . "), name = \"$name\"");
 
        if (! ((defined $type) && (defined $name))) {
                ERROR ("Usage: Collectd::plugin_unregister (type, name)");
@@ -511,7 +521,9 @@ sub fc_call {
        }
 
        DEBUG ("Collectd::fc_call: "
-               . "type = \"$type\", name = \"$name\", cb_type = \"$cb_type\"");
+               . "type = \"$type\" (" . $fc_types{$type}
+               . "), name = \"$name\", cb_type = \"$cb_type\" ("
+               . $fc_cb_types{$cb_type} . ")");
 
        {
                lock %{$fc_plugins[$type]};
@@ -564,7 +576,8 @@ sub fc_register {
        my %fc : shared;
 
        DEBUG ("Collectd::fc_register: "
-               . "type = \"$type\", name = \"$name\", proc = \"$proc\"");
+               . "type = \"$type\" (" . $fc_types{$type}
+               . "), name = \"$name\", proc = \"$proc\"");
 
        if (! ((defined $type) && (defined $name) && (defined $proc))) {
                ERROR ("Usage: Collectd::fc_register(type, name, proc)");
index 0fee138..7054fbf 100644 (file)
@@ -19,7 +19,7 @@
 #   Jeff Green <jeff at kikisoso.org>
 #
 
-package Collectd::Plugin::Monitorus;
+package Collectd::Plugins::Monitorus;
 
 use strict;
 use warnings;
index a11e3ba..8d0744a 100644 (file)
@@ -3219,7 +3219,7 @@ AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@],
                        with_libupsclient="use_libupsclient_config"
                else if test -x "$withval/bin/libupsclient-config"
                then
-                       with_libupsclient_config="$withval/bin/net-snmp-config"
+                       with_libupsclient_config="$withval/bin/libupsclient-config"
                        with_libupsclient="use_libupsclient_config"
                else
                        AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
index 01d01bb..c890042 100644 (file)
@@ -29,6 +29,7 @@ Dependencies
   distribution itself:
 
   * Config::General
+  * Regexp::Common
   * HTML::Entities
   * RRDs
 
index df1b560..d6712dc 100644 (file)
@@ -202,7 +202,7 @@ static int config_set_boolean (int *ret_boolean, /* {{{ */
                return (-1);
        }
 
-       if (ci->values[0].type != OCONFIG_TYPE_BOOLEAN)
+       if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN)
        {
                if (ci->values[0].value.boolean)
                        *ret_boolean = 1;
index b62ad81..4178d8b 100644 (file)
@@ -514,7 +514,8 @@ static int battery_read (void)
 
        if (0 == access (battery_acpi_dir, R_OK))
                walk_directory (battery_acpi_dir, battery_read_acpi,
-                               /* user_data = */ NULL);
+                               /* user_data = */ NULL,
+                               /* include hidden */ 0);
        else
        {
                char errbuf[1024];
index d832cce..8742104 100644 (file)
@@ -85,7 +85,7 @@ collectd script as well as from a normal python interpreter:
 B<1.> collectd will try to import the B<readline> module to give you a decent
 way of entering your commands. The daemonized collectd won't do that.
 
-=item 
+=item
 
 B<2.> collectd will block I<SIGINT>. Pressing I<Ctrl+C> will usually cause
 collectd to shut down. This would be problematic in an interactive session,
@@ -95,6 +95,16 @@ exception either.
 
 To quit collectd send I<EOF> (press I<Ctrl+D> at the beginning of a new line).
 
+=item
+
+B<3.> collectd handles I<SIGCHLD>. This means that python won't be able to
+determine the return code of spawned processes with system(), popen() and
+subprocess. This will result in python not using external programs like less
+to display help texts. You can override this behavior with the B<PAGER>
+environment variable, e.g. I<export PAGER=less> before starting collectd.
+Depending on your version of python this might or might not result in an
+B<OSError> exception which can be ignored.
+
 =back
 
 =item E<lt>B<Module> I<Name>E<gt> block
@@ -239,17 +249,17 @@ It has no methods beyond the bare minimum and only exists for its data members.
 Data descriptors defined here:
 
 =over 4
+
 =item parent
 
 This represents the parent of this node. On the root node
 of the config tree it will be None.
+
 =item key
 
 This is the keyword of this item, i.e. the first word of any given line in the
 config file. It will always be a string.
+
 =item values
 
 This is a tuple (which might be empty) of all value, i.e. words following the
@@ -257,7 +267,7 @@ keyword in any given line in the config file.
 
 Every item in this tuple will be either a string or a float or a boolean,
 depending on the contents of the configuration file.
+
 =item children
 
 This is a tuple of child nodes. For most nodes this will be empty. If this node
@@ -341,7 +351,7 @@ Methods defined here:
 =over 4
 
 =item B<dispatch>([type][, values][, plugin_instance][, type_instance][, plugin][, host][, time][, interval]) -> None.
-    
+
 Dispatch this instance to the collectd process. The object has members for each
 of the possible arguments for this method. For a detailed explanation of these
 parameters see the member of the same same.
@@ -369,7 +379,7 @@ The interval is the timespan in seconds between two submits for the same data
 source. This value has to be a positive integer, so you can't submit more than
 one value per second. If this member is set to a non-positive value, the
 default value as specified in the config file will be used (default: 10).
-    
+
 If you submit values more often than the specified interval, the average will
 be used. If you submit less values, your graphs will have gaps.
 
@@ -417,11 +427,11 @@ Methods defined here:
 =over 4
 
 =item B<dispatch>([type][, values][, plugin_instance][, type_instance][, plugin][, host][, time][, interval]) -> None.  Dispatch a value list.
-    
+
 Dispatch this instance to the collectd process. The object has members for each
 of the possible arguments for this method. For a detailed explanation of these
 parameters see the member of the same same.
-    
+
 If you do not submit a parameter the value saved in its member will be
 submitted. If you do provide a parameter it will be used instead, without
 altering the member.
index 51e0481..3c6e799 100644 (file)
@@ -175,7 +175,8 @@ traffic.
 The gauge-values returned by the SNMP-agent are multiplied by I<Value>.  This
 is useful when values are transfered as a fixed point real number. For example,
 thermometers may transfer B<243> but actually mean B<24.3>, so you can specify
-a scale value of B<0.1> to correct this. The default value is of course B<1.0>.
+a scale value of B<0.1> to correct this. The default value is, of course,
+B<1.0>.
 
 This value is not applied to counter-values.
 
@@ -184,7 +185,7 @@ This value is not applied to counter-values.
 I<Value> is added to gauge-values returned by the SNMP-agent after they have
 been multiplied by any B<Scale> value. If, for example, a thermometer returns
 degrees Kelvin you could specify a shift of B<273.15> here to store values in
-degrees Celsius. The default value is of course B<0.0>.
+degrees Celsius. The default value is, of course, B<0.0>.
 
 This value is not applied to counter-values.
 
index ad13353..049b07d 100644 (file)
@@ -89,6 +89,7 @@ FQDNLookup   true
 @BUILD_PLUGIN_MEMORY_TRUE@@BUILD_PLUGIN_MEMORY_TRUE@LoadPlugin memory
 #@BUILD_PLUGIN_MULTIMETER_TRUE@LoadPlugin multimeter
 #@BUILD_PLUGIN_MYSQL_TRUE@LoadPlugin mysql
+#@BUILD_PLUGIN_NETAPP_TRUE@LoadPlugin netapp
 #@BUILD_PLUGIN_NETLINK_TRUE@LoadPlugin netlink
 @LOAD_PLUGIN_NETWORK@LoadPlugin network
 #@BUILD_PLUGIN_NFS_TRUE@LoadPlugin nfs
@@ -107,6 +108,8 @@ FQDNLookup   true
 #@BUILD_PLUGIN_POWERDNS_TRUE@LoadPlugin powerdns
 #@BUILD_PLUGIN_PROCESSES_TRUE@LoadPlugin processes
 #@BUILD_PLUGIN_PROTOCOLS_TRUE@LoadPlugin protocols
+#@BUILD_PLUGIN_PYTHON_TRUE@LoadPlugin python
+#@BUILD_PLUGIN_ROUTEROS_TRUE@LoadPlugin routeros
 #@BUILD_PLUGIN_RRDCACHED_TRUE@LoadPlugin rrdcached
 @LOAD_PLUGIN_RRDTOOL@LoadPlugin rrdtool
 #@BUILD_PLUGIN_SENSORS_TRUE@LoadPlugin sensors
@@ -187,6 +190,7 @@ FQDNLookup   true
 #    URL "http://finance.google.com/finance?q=NYSE%3AAMD"
 #    User "foo"
 #    Password "bar"
+#    MeasureResponseTime false
 #    <Match>
 #      Regex "<span +class=\"pr\"[^>]*> *([0-9]*\\.[0-9]+) *</span>"
 #      DSType "GaugeAverage"
@@ -255,6 +259,8 @@ FQDNLookup   true
 #      FSType "ext3"
 #      IgnoreSelected false
 #      ReportByDevice false
+#      ReportReserved false
+#      ReportInodes false
 #</Plugin>
 
 #<Plugin disk>
@@ -412,6 +418,58 @@ FQDNLookup   true
 #      </Database>
 #</Plugin>
 
+#<Plugin netapp>
+#      <Host "netapp1.example.com">
+#              Protocol      "https"
+#              Address       "10.0.0.1"
+#              Port          443
+#              User          "username"
+#              Password      "aef4Aebe"
+#              Interval      30
+#
+#              <WAFL>
+#                      Interval 30
+#                      GetNameCache   true
+#                      GetDirCache    true
+#                      GetBufferCache true
+#                      GetInodeCache  true
+#              </WAFL>
+#
+#              <Disks>
+#                      Interval 30
+#                      GetBusy true
+#              </Disks>
+#
+#              <VolumePerf>
+#                      Interval 30
+#                      GetIO      "volume0"
+#                      IgnoreSelectedIO      false
+#                      GetOps     "volume0"
+#                      IgnoreSelectedOps     false
+#                      GetLatency "volume0"
+#                      IgnoreSelectedLatency false
+#              </VolumePerf>
+#
+#              <VolumeUsage>
+#                      Interval 30
+#                      GetCapacity "vol0"
+#                      GetCapacity "vol1"
+#                      IgnoreSelectedCapacity false
+#                      GetSnapshot "vol1"
+#                      GetSnapshot "vol3"
+#                      IgnoreSelectedSnapshot false
+#              </VolumeUsage>
+#
+#              <System>
+#                      Interval 30
+#                      GetCPULoad     true
+#                      GetInterfaces  true
+#                      GetDiskOps     true
+#                      GetDiskIO      true
+#              </System>
+#      </Host>
+#</Plugin>
+
 #<Plugin netlink>
 #      Interface "All"
 #      VerboseInterface "All"
@@ -506,7 +564,8 @@ FQDNLookup   true
 #      IncludeDir "/my/include/path"
 #      BaseName "Collectd::Plugin"
 #      EnableDebugger ""
-#      LoadPlugin foo
+#      LoadPlugin Monitorus
+#      LoadPlugin OpenVZ
 #
 #      <Plugin foo>
 #              Foo "Bar"
@@ -516,7 +575,12 @@ FQDNLookup   true
 
 #<Plugin ping>
 #      Host "host.foo.bar"
+#      Interval 1.0
+#      Timeout 0.9
 #      TTL 255
+#      SourceAddress "1.2.3.4"
+#      Device "eth0"
+#      MaxMissed -1
 #</Plugin>
 
 #<Plugin postgresql>
@@ -582,6 +646,28 @@ FQDNLookup   true
 #      IgnoreSelected false
 #</Plugin>
 
+#<Plugin python>
+#      ModulePath "/path/to/your/python/modules"
+#      LogTraces true
+#      Interactive true
+#      Import "spam"
+#
+#      <Module spam>
+#              spam "wonderful" "lovely"
+#      </Module>
+#</Plugin>
+
+#<Plugin routeros>
+#      <Router>
+#              Host "router.example.com"
+#              Port "8728"
+#              User "admin"
+#              Password "dozaiTh4"
+#              CollectInterface true
+#              CollectRegistrationTable true
+#      </Router>
+#</Plugin>
+
 #<Plugin rrdcached>
 #      DaemonAddress "unix:/tmp/rrdcached.sock"
 #      DataDir "@prefix@/var/lib/@PACKAGE_NAME@/rrd"
@@ -740,6 +826,7 @@ FQDNLookup   true
 
 # Load required matches:
 #@BUILD_PLUGIN_MATCH_EMPTY_COUNTER_TRUE@LoadPlugin match_empty_counter
+#@BUILD_PLUGIN_MATCH_HASHED_TRUE@LoadPlugin match_hashed
 #@BUILD_PLUGIN_MATCH_REGEX_TRUE@LoadPlugin match_regex
 #@BUILD_PLUGIN_MATCH_VALUE_TRUE@LoadPlugin match_value
 #@BUILD_PLUGIN_MATCH_TIMEDIFF_TRUE@LoadPlugin match_timediff
@@ -747,6 +834,7 @@ FQDNLookup   true
 # Load required targets:
 #@BUILD_PLUGIN_TARGET_NOTIFICATION_TRUE@LoadPlugin target_notification
 #@BUILD_PLUGIN_TARGET_REPLACE_TRUE@LoadPlugin target_replace
+#@BUILD_PLUGIN_TARGET_SCALE_TRUE@LoadPlugin target_scale
 #@BUILD_PLUGIN_TARGET_SET_TRUE@LoadPlugin target_set
 
 #----------------------------------------------------------------------------#
index 37ea1da..9af1ff5 100644 (file)
@@ -503,14 +503,16 @@ and are checked by default depends on the distribution you use.
 
 =item B<MeasureResponseTime> B<true>|B<false>
 
-Measure response time for the request. Disabled by default.
+Measure response time for the request. If this setting is enabled, B<Match>
+blocks (see below) are optional. Disabled by default.
 
 =item B<E<lt>MatchE<gt>>
 
 One or more B<Match> blocks that define how to match information in the data
 returned by C<libcurl>. The C<curl> plugin uses the same infrastructure that's
 used by the C<tail> plugin, so please see the documentation of the C<tail>
-plugin below on how matches are defined.
+plugin below on how matches are defined. If the B<MeasureResponseTime> option
+is set to B<true>, B<Match> blocks are optional.
 
 =back
 
@@ -1102,6 +1104,12 @@ note that there are 1000 bytes in a kilobyte, not 1024.
 
 Controls whether or not to recurse into subdirectories. Enabled by default.
 
+=item B<IncludeHidden> I<true>|I<false>
+
+Controls whether or not to include "hidden" files and directories in the count.
+"Hidden" files and directories are those, whose name begins with a dot.
+Defaults to I<false>, i.e. by default hidden files and directories are ignored.
+
 =back
 
 =head2 Plugin C<GenericJMX>
@@ -2785,6 +2793,13 @@ Sets the outgoing network device to be used. I<name> has to specify an
 interface name (e.E<nbsp>g. C<eth0>). This might not be supported by all
 operating systems.
 
+=item B<MaxMissed> I<Packets>
+
+Trigger a DNS resolv after the host has not replied to I<Packets> packets. This
+enables the use of dynamic DNS services (like dyndns.org) with the ping plugin.
+
+Default: B<-1> (disabled)
+
 =back
 
 =head2 Plugin C<postgresql>
index c6a651d..3695a9b 100644 (file)
@@ -1008,7 +1008,7 @@ int notification_init (notification_t *n, int severity, const char *message,
 } /* int notification_init */
 
 int walk_directory (const char *dir, dirwalk_callback_f callback,
-               void *user_data)
+               void *user_data, int include_hidden)
 {
        struct dirent *ent;
        DIR *dh;
@@ -1029,9 +1029,18 @@ int walk_directory (const char *dir, dirwalk_callback_f callback,
        while ((ent = readdir (dh)) != NULL)
        {
                int status;
-
-               if (ent->d_name[0] == '.')
-                       continue;
+               
+               if (include_hidden)
+               {
+                       if ((strcmp (".", ent->d_name) == 0)
+                                       || (strcmp ("..", ent->d_name) == 0))
+                               continue;
+               }
+               else /* if (!include_hidden) */
+               {
+                       if (ent->d_name[0]=='.')
+                               continue;
+               }
 
                status = (*callback) (dir, ent->d_name, user_data);
                if (status != 0)
index 019e8b6..2d5c794 100644 (file)
@@ -280,7 +280,7 @@ int notification_init (notification_t *n, int severity, const char *message,
 typedef int (*dirwalk_callback_f)(const char *dirname, const char *filename,
                void *user_data);
 int walk_directory (const char *dir, dirwalk_callback_f callback,
-               void *user_data);
+               void *user_data, int hidden);
 int read_file_contents (const char *filename, char *buf, int bufsize);
 
 counter_t counter_diff (counter_t old_value, counter_t new_value);
index abf45c2..bc11c28 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * collectd - src/curl.c
  * Copyright (C) 2006-2009  Florian octo Forster
+ * Copyright (C) 2009       Aman Gupta
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -17,6 +18,7 @@
  *
  * Authors:
  *   Florian octo Forster <octo at verplant.org>
+ *   Aman Gupta <aman at tmm1.net>
  **/
 
 #include "collectd.h"
index 62775fd..9185ba4 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -1,6 +1,6 @@
 /**
  * collectd - src/df.c
- * Copyright (C) 2005-2007  Florian octo Forster
+ * Copyright (C) 2005-2009  Florian octo Forster
  * Copyright (C) 2009       Paul Sadauskas
  *
  * This program is free software; you can redistribute it and/or modify it
index 05bb4b3..47f99e9 100644 (file)
@@ -32,6 +32,7 @@
 #include <fnmatch.h>
 
 #define FC_RECURSIVE 1
+#define FC_HIDDEN 2
 
 struct fc_directory_conf_s
 {
@@ -310,8 +311,8 @@ static int fc_config_add_dir_size (fc_directory_conf_t *dir,
   return (0);
 } /* int fc_config_add_dir_size */
 
-static int fc_config_add_dir_recursive (fc_directory_conf_t *dir,
-    oconfig_item_t *ci)
+static int fc_config_add_dir_option (fc_directory_conf_t *dir,
+    oconfig_item_t *ci, int bit)
 {
   if ((ci->values_num != 1)
       || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
@@ -322,12 +323,12 @@ static int fc_config_add_dir_recursive (fc_directory_conf_t *dir,
   }
 
   if (ci->values[0].value.boolean)
-    dir->options |= FC_RECURSIVE;
+    dir->options |= bit;
   else
-    dir->options &= ~FC_RECURSIVE;
+    dir->options &= ~bit;
 
   return (0);
-} /* int fc_config_add_dir_recursive */
+} /* int fc_config_add_dir_option */
 
 static int fc_config_add_dir (oconfig_item_t *ci)
 {
@@ -380,7 +381,9 @@ static int fc_config_add_dir (oconfig_item_t *ci)
     else if (strcasecmp ("Size", option->key) == 0)
       status = fc_config_add_dir_size (dir, option);
     else if (strcasecmp ("Recursive", option->key) == 0)
-      status = fc_config_add_dir_recursive (dir, option);
+      status = fc_config_add_dir_option (dir, option, FC_RECURSIVE);
+    else if (strcasecmp ("IncludeHidden", option->key) == 0)
+      status = fc_config_add_dir_option (dir, option, FC_HIDDEN);
     else
     {
       WARNING ("filecount plugin: fc_config_add_dir: "
@@ -475,7 +478,8 @@ static int fc_read_dir_callback (const char *dirname, const char *filename,
 
   if (S_ISDIR (statbuf.st_mode) && (dir->options & FC_RECURSIVE))
   {
-    status = walk_directory (abs_path, fc_read_dir_callback, dir);
+    status = walk_directory (abs_path, fc_read_dir_callback, dir,
+        /* include hidden = */ (dir->options & FC_HIDDEN) ? 1 : 0);
     return (status);
   }
   else if (!S_ISREG (statbuf.st_mode))
@@ -537,8 +541,9 @@ static int fc_read_dir (fc_directory_conf_t *dir)
 
   if (dir->mtime != 0)
     dir->now = time (NULL);
-
-  status = walk_directory (dir->path, fc_read_dir_callback, dir);
+    
+  status = walk_directory (dir->path, fc_read_dir_callback, dir,
+      /* include hidden */ (dir->options & FC_HIDDEN) ? 1 : 0);
   if (status != 0)
   {
     WARNING ("filecount plugin: walk_directory (%s) failed.", dir->path);
index ecaa0c0..b79a74b 100644 (file)
@@ -158,10 +158,10 @@ static int memory_read (void)
        vm_statistics_data_t   vm_data;
        mach_msg_type_number_t vm_data_len;
 
-       long long wired;
-       long long active;
-       long long inactive;
-       long long free;
+       gauge_t wired;
+       gauge_t active;
+       gauge_t inactive;
+       gauge_t free;
 
        if (!port_host || !pagesize)
                return (-1);
@@ -195,10 +195,10 @@ static int memory_read (void)
         *   This memory is not being used.
         */
 
-       wired    = vm_data.wire_count     * pagesize;
-       active   = vm_data.active_count   * pagesize;
-       inactive = vm_data.inactive_count * pagesize;
-       free     = vm_data.free_count     * pagesize;
+       wired    = (gauge_t) (((uint64_t) vm_data.wire_count)     * ((uint64_t) pagesize));
+       active   = (gauge_t) (((uint64_t) vm_data.active_count)   * ((uint64_t) pagesize));
+       inactive = (gauge_t) (((uint64_t) vm_data.inactive_count) * ((uint64_t) pagesize));
+       free     = (gauge_t) (((uint64_t) vm_data.free_count)     * ((uint64_t) pagesize));
 
        memory_submit ("wired",    wired);
        memory_submit ("active",   active);
index 1b45375..8615753 100644 (file)
@@ -4,17 +4,18 @@
  * Copyright (C) 2009       Aman Gupta
  *
  * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; only version 2 of the License is applicable.
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; only version 2.1 of the License is
+ * applicable.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  * Authors:
  *   Florian octo Forster <octo at verplant.org>
index 78a09ff..49cf657 100644 (file)
@@ -598,6 +598,41 @@ static int o_read_database (o_database_t *db) /* {{{ */
   size_t i;
   int status;
 
+  if (db->oci_service_context != NULL)
+  {
+    OCIServer *server_handle;
+    ub4 connection_status;
+
+    server_handle = NULL;
+    status = OCIAttrGet ((void *) db->oci_service_context, OCI_HTYPE_SVCCTX, 
+        (void *) &server_handle, /* size pointer = */ NULL,
+        OCI_ATTR_SERVER, oci_error);
+    if (status != OCI_SUCCESS)
+    {
+      o_report_error ("o_read_database", "OCIAttrGet", oci_error);
+      return (-1);
+    }
+    assert (server_handle != NULL);
+
+    connection_status = 0;
+    status = OCIAttrGet ((void *) server_handle, OCI_HTYPE_SERVER,
+        (void *) &connection_status, /* size pointer = */ NULL,
+        OCI_ATTR_SERVER_STATUS, oci_error);
+    if (status != OCI_SUCCESS)
+    {
+      o_report_error ("o_read_database", "OCIAttrGet", oci_error);
+      return (-1);
+    }
+
+    if (connection_status != OCI_SERVER_NORMAL)
+    {
+      INFO ("oracle plugin: Connection to %s lost. Trying to reconnect.",
+          db->name);
+      OCIHandleFree (db->oci_service_context, OCI_HTYPE_SVCCTX);
+      db->oci_service_context = NULL;
+    }
+  } /* if (db->oci_service_context != NULL) */
+
   if (db->oci_service_context == NULL)
   {
     status = OCILogon (oci_env, oci_error,
index e1540c3..5366b98 100644 (file)
@@ -49,6 +49,7 @@ struct hostlist_s
 
   uint32_t pkg_sent;
   uint32_t pkg_recv;
+  uint32_t pkg_missed;
 
   double latency_total;
   double latency_squared;
@@ -69,6 +70,7 @@ static char  *ping_device = NULL;
 static int    ping_ttl = PING_DEF_TTL;
 static double ping_interval = 1.0;
 static double ping_timeout = 0.9;
+static int    ping_max_missed = -1;
 
 static int             ping_thread_loop = 0;
 static int             ping_thread_error = 0;
@@ -85,7 +87,8 @@ static const char *config_keys[] =
 #endif
   "TTL",
   "Interval",
-  "Timeout"
+  "Timeout",
+  "MaxMissed"
 };
 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
 
@@ -284,7 +287,37 @@ static void *ping_thread (void *arg) /* {{{ */
         hl->pkg_recv++;
         hl->latency_total += latency;
         hl->latency_squared += (latency * latency);
-      }
+
+        /* reset missed packages counter */
+        hl->pkg_missed = 0;
+      } else
+        hl->pkg_missed++;
+
+      /* if the host did not answer our last N packages, trigger a resolv. */
+      if (ping_max_missed >= 0 && hl->pkg_missed >= ping_max_missed)
+      { /* {{{ */
+        /* we reset the missed package counter here, since we only want to
+         * trigger a resolv every N packages and not every package _AFTER_ N
+         * missed packages */
+        hl->pkg_missed = 0;
+
+        WARNING ("ping plugin: host %s has not answered %d PING requests,"
+          " triggering resolve", hl->host, ping_max_missed);
+
+        /* we trigger the resolv simply be removeing and adding the host to our
+         * ping object */
+        status = ping_host_remove (pingobj, hl->host);
+        if (status != 0)
+        {
+          WARNING ("ping plugin: ping_host_remove (%s) failed.", hl->host);
+        }
+        else
+        {
+          status = ping_host_add (pingobj, hl->host);
+          if (status != 0)
+            WARNING ("ping plugin: ping_host_add (%s) failed.", hl->host);
+        }
+      } /* }}} ping_max_missed */
     } /* }}} for (iter) */
 
     if (gettimeofday (&tv_end, NULL) < 0)
@@ -436,6 +469,7 @@ static int ping_config (const char *key, const char *value) /* {{{ */
     hl->host = host;
     hl->pkg_sent = 0;
     hl->pkg_recv = 0;
+    hl->pkg_missed = 0;
     hl->latency_total = 0.0;
     hl->latency_squared = 0.0;
     hl->next = hostlist_head;
@@ -485,6 +519,12 @@ static int ping_config (const char *key, const char *value) /* {{{ */
       WARNING ("ping plugin: Ignoring invalid timeout %g (%s)",
           tmp, value);
   }
+  else if (strcasecmp (key, "MaxMissed") == 0)
+  {
+    ping_max_missed = atoi (value);
+    if (ping_max_missed < 0)
+      INFO ("ping plugin: MaxMissed < 0, disabled re-resolving of hosts");
+  }
   else
   {
     return (-1);
index 576a5b1..8c7700a 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2006-2008  Florian octo Forster
  * Copyright (C) 2008       Oleg King
  * Copyright (C) 2009       Sebastian Harl
+ * Copyright (C) 2009       Andrés J. Díaz
  * Copyright (C) 2009       Manuel Sanmartin
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -25,6 +26,7 @@
  *   Florian octo Forster <octo at verplant.org>
  *   Oleg King <king2 at kaluga.ru>
  *   Sebastian Harl <sh at tokkee.org>
+ *   Andrés J. Díaz <ajdiaz at connectical.com>
  *   Manuel Sanmartin
  **/
 
index 02c96d7..4fe33fa 100644 (file)
@@ -39,8 +39,8 @@ struct cr_data_s
 };
 typedef struct cr_data_s cr_data_t;
 
-static void cr_submit_io (const char *type, const char *type_instance, /* {{{ */
-    counter_t rx, counter_t tx)
+static void cr_submit_io (cr_data_t *rd, const char *type, /* {{{ */
+    const char *type_instance, counter_t rx, counter_t tx)
 {
        value_t values[2];
        value_list_t vl = VALUE_LIST_INIT;
@@ -50,7 +50,7 @@ static void cr_submit_io (const char *type, const char *type_instance, /* {{{ */
 
        vl.values = values;
        vl.values_len = STATIC_ARRAY_SIZE (values);
-       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.host, rd->node, sizeof (vl.host));
        sstrncpy (vl.plugin, "routeros", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
        sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
@@ -58,37 +58,41 @@ static void cr_submit_io (const char *type, const char *type_instance, /* {{{ */
        plugin_dispatch_values (&vl);
 } /* }}} void cr_submit_io */
 
-static void submit_interface (const ros_interface_t *i) /* {{{ */
+static void submit_interface (cr_data_t *rd, /* {{{ */
+    const ros_interface_t *i)
 {
   if (i == NULL)
     return;
 
   if (!i->running)
   {
-    submit_interface (i->next);
+    submit_interface (rd, i->next);
     return;
   }
 
-  cr_submit_io ("if_packets", i->name,
+  cr_submit_io (rd, "if_packets", i->name,
       (counter_t) i->rx_packets, (counter_t) i->tx_packets);
-  cr_submit_io ("if_octets", i->name,
+  cr_submit_io (rd, "if_octets", i->name,
       (counter_t) i->rx_bytes, (counter_t) i->tx_bytes);
-  cr_submit_io ("if_errors", i->name,
+  cr_submit_io (rd, "if_errors", i->name,
       (counter_t) i->rx_errors, (counter_t) i->tx_errors);
-  cr_submit_io ("if_dropped", i->name,
+  cr_submit_io (rd, "if_dropped", i->name,
       (counter_t) i->rx_drops, (counter_t) i->tx_drops);
 
-  submit_interface (i->next);
+  submit_interface (rd, i->next);
 } /* }}} void submit_interface */
 
 static int handle_interface (__attribute__((unused)) ros_connection_t *c, /* {{{ */
-    const ros_interface_t *i, __attribute__((unused)) void *user_data)
+    const ros_interface_t *i, void *user_data)
 {
-  submit_interface (i);
+  if ((i == NULL) || (user_data == NULL))
+    return (EINVAL);
+
+  submit_interface (user_data, i);
   return (0);
 } /* }}} int handle_interface */
 
-static void cr_submit_gauge (const char *type, /* {{{ */
+static void cr_submit_gauge (cr_data_t *rd, const char *type, /* {{{ */
     const char *type_instance, gauge_t value)
 {
        value_t values[1];
@@ -98,7 +102,7 @@ static void cr_submit_gauge (const char *type, /* {{{ */
 
        vl.values = values;
        vl.values_len = STATIC_ARRAY_SIZE (values);
-       sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+       sstrncpy (vl.host, rd->node, sizeof (vl.host));
        sstrncpy (vl.plugin, "routeros", sizeof (vl.plugin));
        sstrncpy (vl.type, type, sizeof (vl.type));
        sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
@@ -106,7 +110,8 @@ static void cr_submit_gauge (const char *type, /* {{{ */
        plugin_dispatch_values (&vl);
 } /* }}} void cr_submit_gauge */
 
-static void submit_regtable (const ros_registration_table_t *r) /* {{{ */
+static void submit_regtable (cr_data_t *rd, /* {{{ */
+    const ros_registration_table_t *r)
 {
   char type_instance[DATA_MAX_NAME_LEN];
 
@@ -116,38 +121,40 @@ static void submit_regtable (const ros_registration_table_t *r) /* {{{ */
   /*** RX ***/
   ssnprintf (type_instance, sizeof (type_instance), "%s-%s-rx",
       r->interface, r->radio_name);
-  cr_submit_gauge ("bitrate", type_instance,
+  cr_submit_gauge (rd, "bitrate", type_instance,
       (gauge_t) (1000000.0 * r->rx_rate));
-  cr_submit_gauge ("signal_power", type_instance,
+  cr_submit_gauge (rd, "signal_power", type_instance,
       (gauge_t) r->rx_signal_strength);
-  cr_submit_gauge ("signal_quality", type_instance,
+  cr_submit_gauge (rd, "signal_quality", type_instance,
       (gauge_t) r->rx_ccq);
 
   /*** TX ***/
   ssnprintf (type_instance, sizeof (type_instance), "%s-%s-tx",
       r->interface, r->radio_name);
-  cr_submit_gauge ("bitrate", type_instance,
+  cr_submit_gauge (rd, "bitrate", type_instance,
       (gauge_t) (1000000.0 * r->tx_rate));
-  cr_submit_gauge ("signal_power", type_instance,
+  cr_submit_gauge (rd, "signal_power", type_instance,
       (gauge_t) r->tx_signal_strength);
-  cr_submit_gauge ("signal_quality", type_instance,
+  cr_submit_gauge (rd, "signal_quality", type_instance,
       (gauge_t) r->tx_ccq);
 
   /*** RX / TX ***/
   ssnprintf (type_instance, sizeof (type_instance), "%s-%s",
       r->interface, r->radio_name);
-  cr_submit_io ("if_octets", type_instance,
+  cr_submit_io (rd, "if_octets", type_instance,
       (counter_t) r->rx_bytes, (counter_t) r->tx_bytes);
-  cr_submit_gauge ("snr", type_instance, (gauge_t) r->signal_to_noise);
+  cr_submit_gauge (rd, "snr", type_instance, (gauge_t) r->signal_to_noise);
 
-  submit_regtable (r->next);
+  submit_regtable (rd, r->next);
 } /* }}} void submit_regtable */
 
 static int handle_regtable (__attribute__((unused)) ros_connection_t *c, /* {{{ */
-    const ros_registration_table_t *r,
-    __attribute__((unused)) void *user_data)
+    const ros_registration_table_t *r, void *user_data)
 {
-  submit_regtable (r);
+  if ((r == NULL) || (user_data == NULL))
+    return (EINVAL);
+
+  submit_regtable (user_data, r);
   return (0);
 } /* }}} int handle_regtable */
 
@@ -180,7 +187,7 @@ static int cr_read (user_data_t *user_data) /* {{{ */
   if (rd->collect_interface)
   {
     status = ros_interface (rd->connection, handle_interface,
-       /* user data = */ NULL);
+       /* user data = */ rd);
     if (status != 0)
     {
       char errbuf[128];
@@ -195,7 +202,7 @@ static int cr_read (user_data_t *user_data) /* {{{ */
   if (rd->collect_regtable)
   {
     status = ros_registration_table (rd->connection, handle_regtable,
-       /* user data = */ NULL);
+       /* user data = */ rd);
     if (status != 0)
     {
       char errbuf[128];
index ee5d70c..ed1ced1 100644 (file)
@@ -676,6 +676,7 @@ static int rrd_cache_insert (const char *filename,
                rc->values = NULL;
                rc->first_value = 0;
                rc->last_value = 0;
+               rc->random_variation = 0;
                rc->flags = FLAG_NONE;
                new_rc = 1;
        }
index 2b70805..b9d07bf 100644 (file)
@@ -218,13 +218,13 @@ static int thermal_config (const char *key, const char *value)
 static int thermal_sysfs_read (void)
 {
        return walk_directory (dirname_sysfs, thermal_sysfs_device_read,
-                       /* user_data = */ NULL);
+                       /* user_data = */ NULL, /* include hidden */ 0);
 }
 
 static int thermal_procfs_read (void)
 {
        return walk_directory (dirname_procfs, thermal_procfs_device_read,
-                       /* user_data = */ NULL);
+                       /* user_data = */ NULL, /* include hidden */ 0);
 }
 
 static int thermal_init (void)
index a36d6f5..bd87bbb 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-DEFAULT_VERSION="4.8.1.git"
+DEFAULT_VERSION="4.8.2.git"
 
 VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"