Merge branch 'collectd-4.10'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 17 Aug 2010 16:53:38 +0000 (18:53 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 17 Aug 2010 16:53:38 +0000 (18:53 +0200)
1  2 
src/collectd.conf.pod
src/configfile.c

diff --combined src/collectd.conf.pod
@@@ -57,6 -57,33 +57,33 @@@ directory for the daemon
  Loads the plugin I<Plugin>. There must be at least one such line or B<collectd>
  will be mostly useless.
  
+ Starting with collectd 4.9, this may also be a block in which further options
+ affecting the behavior of B<LoadPlugin> may be specified. The following
+ options are allowed inside a B<LoadPlugin> block:
+   <LoadPlugin perl>
+     Globals true
+   </LoadPlugin>
+ =over 4
+ =item B<Globals> B<true|false>
+ If enabled, collectd will export all global symbols of the plugin (and of all
+ libraries loaded as dependencies of the plugin) and, thus, makes those symbols
+ available for resolving unresolved symbols in subsequently loaded plugins if
+ that is supported by your system. By default, this is disabled.
+ This is useful (or possibly even required), e.E<nbsp>g., when loading a plugin
+ that embeds some scripting language into the daemon (e.E<nbsp>g. the C<perl>
+ or C<python> plugins). Scripting languages usually provide means to load
+ extensions written in C. Those extensions require symbols provided by the
+ interpreter, which is loaded as a dependency of the respective collectd
+ plugin. See the documentation of those plugins (e.E<nbsp>g.,
+ L<collectd-perl(5)> or L<collectd-python(5)>) for details.
+ =back
  =item B<Include> I<Path>
  
  If I<Path> points to a file, includes that file. If I<Path> points to a
@@@ -128,8 -155,13 +155,8 @@@ hostname will be determined using the L
  
  If B<Hostname> is determined automatically this setting controls whether or not
  the daemon should try to figure out the "fully qualified domain name", FQDN.
 -This is done using a lookup of the name returned by C<gethostname>.
 -
 -Using this feature (i.E<nbsp>e. setting this option to B<true>) is recommended.
 -However, to preserve backwards compatibility the default is set to B<false>.
 -The sample config file that is installed with C<makeE<nbsp>install> includes a
 -line which sets this option, though, so that default installations will have
 -this setting enabled.
 +This is done using a lookup of the name returned by C<gethostname>. This option
 +is enabled by default.
  
  =item B<PreCacheChain> I<ChainName>
  
@@@ -994,6 -1026,22 +1021,6 @@@ Report using the device name rather tha
  (the default), it will report a disk as "root", but with it I<true>, it will be
  "sda1" (or whichever).
  
 -=item B<ReportReserved> B<true>|B<false>
 -
 -When enabled, the blocks reserved for root are reported separately. When
 -disabled (the default for backwards compatibility reasons) the reserved space
 -will be included in the "free" space.
 -
 -When disabled, the "df" type will be used to store "free" and "used" space. The
 -mount point or disk name (see option B<ReportByDevice>) is used as type
 -instance in this case (again: backwards compatibility).
 -
 -When enabled, the type "df_complex" is used and three files are created. The
 -mount point or disk name is used as plugin instance and the type instance is
 -set to "free", "reserved" and "used" as appropriate.
 -
 -Enabling this option is recommended.
 -
  =item B<ReportInodes> B<true>|B<false>
  
  Enables or disables reporting of free, reserved and used inodes. Defaults to
@@@ -1313,6 -1361,13 +1340,6 @@@ Hostname to connect to. Defaults to B<1
  
  TCP-Port to connect to. Defaults to B<7634>.
  
 -=item B<TranslateDevicename> I<true>|I<false>
 -
 -If enabled, translate the disk names to major/minor device numbers
 -(e.E<nbsp>g. "8-0" for /dev/sda). For backwards compatibility this defaults to
 -I<true> but it's recommended to disable it as it will probably be removed in
 -the next major version.
 -
  =back
  
  =head2 Plugin C<interface>
@@@ -1540,16 -1595,6 +1567,16 @@@ You can also specify combinations of th
  means to concatenate the guest name and UUID (with a literal colon character
  between, thus I<"foo:1234-1234-1234-1234">).
  
 +=item B<InterfaceFormat> B<name>|B<address>
 +
 +When the libvirt plugin logs interface data, it sets the name of the collected
 +data according to this setting. The default is to use the path as provided by
 +the hypervisor (the "dev" property of the target node), which is equal to
 +setting B<name>.
 +
 +B<address> means use the interface's mac address. This is useful since the
 +interface path might change between reboots of a guest or across migrations.
 +
  =back
  
  =head2 Plugin C<logfile>
@@@ -1811,7 -1856,7 +1838,7 @@@ B<Collect> option is mandatory
  The C<mysql plugin> requires B<mysqlclient> to be installed. It connects to
  one or more databases when started and keeps the connection up as long as
  possible. When the connection is interrupted for whatever reason it will try
 -to re-connect. The plugin will complaint loudly in case anything goes wrong.
 +to re-connect. The plugin will complain loudly in case anything goes wrong.
  
  This plugin issues the MySQL C<SHOW STATUS> / C<SHOW GLOBAL STATUS> command
  and collects information about MySQL network traffic, executed statements,
@@@ -2592,6 -2637,16 +2619,6 @@@ the same multicast group. While this re
  necessary it's not a huge problem since the plugin has a duplicate detection,
  so the values will not loop.
  
 -=item B<CacheFlush> I<Seconds>
 -
 -For each host/plugin/type combination the C<network plugin> caches the time of
 -the last value being sent or received. Every I<Seconds> seconds the plugin
 -searches and removes all entries that are older than I<Seconds> seconds, thus
 -freeing the unused memory again. Since this process is somewhat expensive and
 -normally doesn't do much, this value should not be too small. The default is
 -1800 seconds, but setting this to 86400 seconds (one day) will not do much harm
 -either.
 -
  =item B<ReportStats> B<true>|B<false>
  
  The network plugin cannot only receive and send statistics, it can also create
@@@ -3225,6 -3280,11 +3252,6 @@@ allowed as long as a single non-empty c
  
  The returned lines will be handled separately one after another.
  
 -=item B<Query> I<sql query statement>
 -
 -This is a deprecated synonym for B<Statement>. It will be removed in version 5
 -of collectd.
 -
  =item B<Param> I<hostname>|I<database>|I<username>|I<interval>
  
  Specify the parameters which should be passed to the SQL query. The parameters
@@@ -3300,6 -3360,21 +3327,6 @@@ This option is required inside a B<Resu
  times. If multiple B<ValuesFrom> options are specified, the columns are read
  in the given order.
  
 -=item B<Column> I<type> [I<type instance>]
 -
 -This is a deprecated alternative to a B<Result> block. It will be removed in
 -version 5 of collectd. It is equivalent to the following B<Result> block:
 -
 -  <Result>
 -    Type I<type>
 -    InstancePrefix I<type instance>
 -    ValuesFrom I<name of the x. column>
 -  </Result>
 -
 -The order of the B<Column> options defines which columns of the query result
 -should be used. The first option specifies the data found in the first column,
 -the second option that of the second column, and so on.
 -
  =item B<MinVersion> I<version>
  
  =item B<MaxVersion> I<version>
@@@ -3314,6 -3389,13 +3341,6 @@@ The I<version> has to be specified as t
  and patch-level versions, each represented as two-decimal-digit numbers. For
  example, version 8.2.3 will become 80203.
  
 -=item B<MinPGVersion> I<version>
 -
 -=item B<MaxPGVersion> I<version>
 -
 -These are deprecated synonyms for B<MinVersion> and B<MaxVersion>
 -respectively. They will be removed in version 5 of collectd.
 -
  =back
  
  The following predefined queries are available (the definitions can be found
@@@ -3724,52 -3806,6 +3751,52 @@@ Defaults to B<false>
  
  =back
  
 +=head2 Plugin C<redis>
 +
 +The I<Redis plugin> connects to one or more Redis servers and gathers
 +information about each server's state. For each server there is a I<Node> block
 +which configures the connection parameters for this node.
 +
 +  <Plugin redis>
 +    <Node "example">
 +        Host "localhost"
 +        Port "6379"
 +        Timeout 2000
 +    </Node>
 +  </Plugin>
 +
 +The information shown in the synopsis above is the I<default configuration>
 +which is used by the plugin if no configuration is present.
 +
 +=over 4
 +
 +=item B<Node> I<Nodename>
 +
 +The B<Node> block identifies a new Redis node, that is a new Redis instance
 +running in an specified host and port. The name for node is a canonical
 +identifier which is used as I<plugin instance>. It is limited to
 +64E<nbsp>characters in length.
 +
 +=item B<Host> I<Hostname>
 +
 +The B<Host> option is the hostname or IP-address where the Redis instance is
 +running on.
 +
 +=item B<Port> I<Port>
 +
 +The B<Port> option is the TCP port on which the Redis instance accepts
 +connections. Either a service name of a port number may be given. Please note
 +that numerical port numbers must be given as a string, too.
 +
 +=item B<Timeout> I<Timeout in miliseconds>
 +
 +The B<Timeout> option set the socket timeout for node response. Since the Redis
 +read function is blocking, you should keep this value as low as possible. Keep
 +in mind that the sum of all B<Timeout> values for all B<Nodes> should be lower
 +than B<Interval> defined globally.
 +
 +=back
 +
  =head2 Plugin C<rrdcached>
  
  The C<rrdcached> plugin uses the RRDtool accelerator daemon, L<rrdcached(1)>,
@@@ -4166,25 -4202,37 +4193,37 @@@ Use the last number found
  
  =item B<CounterSet>
  
- The matched number is a counter. Simply sets the internal counter to this
- value.
+ =item B<DeriveSet>
+ =item B<AbsoluteSet>
+ The matched number is a counter. Simply I<sets> the internal counter to this
+ value. Variants exist for C<COUNTER>, C<DERIVE>, and C<ABSOLUTE> data sources.
  
  =item B<CounterAdd>
  
- Add the matched value to the internal counter.
+ =item B<DeriveAdd>
+ Add the matched value to the internal counter. In case of B<DeriveAdd>, the
+ matched number may be negative, which will effectively subtract from the
+ internal counter.
  
  =item B<CounterInc>
  
- Increase the internal counter by one. This B<DSType> is the only one that does
- not use the matched subexpression, but simply counts the number of matched
+ =item B<DeriveInc>
+ Increase the internal counter by one. These B<DSType> are the only ones that do
+ not use the matched subexpression, but simply count the number of matched
  lines. Thus, you may use a regular expression without submatch in this case.
  
  =back
  
  As you'd expect the B<Gauge*> types interpret the submatch as a floating point
- number, using L<strtod(3)>. The B<CounterSet> and B<CounterAdd> interpret the
- submatch as an integer using L<strtoll(3)>. B<CounterInc> does not use the
- submatch at all and it may be omitted in this case.
+ number, using L<strtod(3)>. The B<Counter*> and B<AbsoluteSet> types interpret
+ the submatch as an unsigned integer using L<strtoull(3)>. The B<Derive*> types
+ interpret the submatch as a signed integer using L<strtoll(3)>. B<CounterInc>
+ and B<DeriveInc> do not use the submatch at all and it may be omitted in this
+ case.
  
  =item B<Type> I<Type>
  
@@@ -4407,68 -4455,6 +4446,68 @@@ Take the UUID from the given file (defa
  
  =back
  
 +=head2 Plugin C<varnish>
 +
 +The Varnish plugin collects information about Varnish, an HTTP accelerator.
 +
 +=over 4
 +
 +=item B<CollectCache> B<true>|B<false>
 +
 +Cache hits and misses. True by default.
 +
 +=item B<CollectConnections> B<true>|B<false>
 +
 +Number of client connections received, accepted and dropped. True by default.
 +
 +=item B<CollectBackend> B<true>|B<false>
 +
 +Back-end connection statistics, such as successful, reused,
 +and closed connections. True by default.
 +
 +=item B<CollectSHM> B<true>|B<false>
 +
 +Statistics about the shared memory log, a memory region to store
 +log messages which is flushed to disk when full. True by default.
 +
 +=item B<CollectESI> B<true>|B<false>
 +
 +Edge Side Includes (ESI) parse statistics. False by default.
 +
 +=item B<CollectFetch> B<true>|B<false>
 +
 +Statistics about fetches (HTTP requests sent to the backend). False by default.
 +
 +=item B<CollectHCB> B<true>|B<false>
 +
 +Inserts and look-ups in the crit bit tree based hash. Look-ups are
 +divided into locked and unlocked look-ups. False by default.
 +
 +=item B<CollectSMA> B<true>|B<false>
 +
 +malloc or umem (umem_alloc(3MALLOC) based) storage statistics.
 +The umem storage component is Solaris specific. False by default.
 +
 +=item B<CollectSMS> B<true>|B<false>
 +
 +synth (synthetic content) storage statistics. This storage
 +component is used internally only. False by default.
 +
 +=item B<CollectSM> B<true>|B<false>
 +
 +file (memory mapped file) storage statistics. False by default.
 +
 +=item B<CollectTotals> B<true>|B<false>
 +
 +Collects overview counters, such as the number of sessions created,
 +the number of requests and bytes transferred. False by default.
 +
 +=item B<CollectWorkers> B<true>|B<false>
 +
 +Collect statistics about worker threads. False by default.
 +
 +=back
 +
  =head2 Plugin C<vmem>
  
  The C<vmem> plugin collects information about the usage of virtual memory.
@@@ -4629,13 -4615,6 +4668,13 @@@ information
           WarningMin 100000000
         </Type>
       </Plugin>
 +
 +     <Type "load">
 +      DataSource "midterm"
 +      FailureMax 4
 +      Hits 3
 +      Hysteresis 3
 +     </Type>
     </Host>
   </Threshold>
  
@@@ -4708,27 -4687,6 +4747,27 @@@ percentage value, relative to the othe
  example for the "df" type, where you may want to issue a warning when less than
  5E<nbsp>% of the total space is available. Defaults to B<false>.
  
 +=item B<Hits> I<Value>
 +
 +Sets the number of occurrences which the threshold must be arised before to
 +dispatch any notification or, in other words, the number of B<Interval>s
 +than the threshold must be match before dispatch any notification.
 +
 +=item B<Hysteresis> I<Value>
 +
 +Sets the hysteresis value for threshold. The hysteresis is a method to
 +prevent flapping between states, until a new received value for
 +a previously matched threshold down below the threshold condition
 +(B<WarningMax>, B<FailureMin> or everthing else) minus the hysteresis value,
 +the failure (respectively warning) state will be keep.
 +
 +=item B<Interesting> B<true>|B<false>
 +
 +If set to B<true> (the default), the threshold must be treated as
 +interesting and, when a number of B<Timeout> values will lost, then
 +a missing notification will be dispatched. On the other hand, if set to
 +B<false>, the missing notification will never dispatched for this threshold.
 +
  =back
  
  =head1 FILTER CONFIGURATION
diff --combined src/configfile.c
@@@ -1,6 -1,6 +1,6 @@@
  /**
   * collectd - src/configfile.c
 - * Copyright (C) 2005-2009  Florian octo Forster
 + * Copyright (C) 2005-2010  Florian octo Forster
   *
   * 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
@@@ -96,7 -96,7 +96,7 @@@ static cf_global_option_t cf_global_opt
        {"BaseDir",     NULL, PKGLOCALSTATEDIR},
        {"PIDFile",     NULL, PIDFILE},
        {"Hostname",    NULL, NULL},
 -      {"FQDNLookup",  NULL, "false"},
 +      {"FQDNLookup",  NULL, "true"},
        {"Interval",    NULL, "10"},
        {"ReadThreads", NULL, "5"},
        {"Timeout",     NULL, "2"},
@@@ -701,11 -701,10 +701,10 @@@ static oconfig_item_t *cf_read_generic 
                if (status != 0)
                {
                        char errbuf[1024];
-                       ERROR ("configfile: stat (%s) failed: %s",
+                       WARNING ("configfile: stat (%s) failed: %s",
                                        path_ptr,
                                        sstrerror (errno, errbuf, sizeof (errbuf)));
-                       oconfig_free (root);
-                       return (NULL);
+                       continue;
                }
  
                if (S_ISREG (statbuf.st_mode))
                        temp = cf_read_dir (path_ptr, depth);
                else
                {
-                       ERROR ("configfile: %s is neither a file nor a "
+                       WARNING ("configfile: %s is neither a file nor a "
                                        "directory.", path);
                        continue;
                }
  
        wordfree (&we);
  
+       if (root->children == NULL)
+       {
+               oconfig_free (root);
+               return (NULL);
+       }
        return (root);
  } /* oconfig_item_t *cf_read_generic */
  /* #endif HAVE_WORDEXP_H */
@@@ -1009,37 -1014,11 +1014,37 @@@ int cf_util_get_boolean (const oconfig_
                return (-1);
        }
  
 -      *ret_bool = ci->values[0].value.boolean ? true : false;
 +      *ret_bool = ci->values[0].value.boolean ? 1 : 0;
  
        return (0);
  } /* }}} int cf_util_get_boolean */
  
 +int cf_util_get_flag (const oconfig_item_t *ci, /* {{{ */
 +              unsigned int *ret_value, unsigned int flag)
 +{
 +      int status;
 +      _Bool b;
 +
 +      if (ret_value == NULL)
 +              return (EINVAL);
 +
 +      b = 0;
 +      status = cf_util_get_boolean (ci, &b);
 +      if (status != 0)
 +              return (status);
 +
 +      if (b)
 +      {
 +              *ret_value |= flag;
 +      }
 +      else
 +      {
 +              *ret_value &= ~flag;
 +      }
 +
 +      return (0);
 +} /* }}} int cf_util_get_flag */
 +
  /* Assures that the config option is a string. The string is then converted to
   * a port number using `service_name_to_port_number' and returned. Returns the
   * port number in the range [1-65535] or less than zero upon failure. */