Merge branch 'ag/curl_xml'
authorFlorian Forster <octo@huhu.verplant.org>
Wed, 13 Jan 2010 15:16:28 +0000 (16:16 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Wed, 13 Jan 2010 15:16:28 +0000 (16:16 +0100)
1  2 
configure.in
src/collectd.conf.pod

diff --combined configure.in
  if test "x$with_python" = "xyes"
  then
        AC_MSG_CHECKING([for Python CPPFLAGS])
 -      python_include_path=`echo "import distutils.sysconfig;print distutils.sysconfig.get_python_inc()" | "$with_python_prog" 2>&1`
 +      python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
        python_config_status=$?
  
        if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
  if test "x$with_python" = "xyes"
  then
        AC_MSG_CHECKING([for Python LDFLAGS])
 -      python_library_path=`echo "import distutils.sysconfig;print distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0)" | "$with_python_prog" 2>&1`
 +      python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1`
        python_config_status=$?
  
        if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
  if test "x$with_python" = "xyes"
  then
        AC_MSG_CHECKING([for Python LIBS])
 -      python_library_flags=`echo "import distutils.sysconfig;print distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0)" | "$with_python_prog" 2>&1`
 +      python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1`
        python_config_status=$?
  
        if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
@@@ -3790,6 -3790,7 +3790,7 @@@ plugin_contextswitch="no
  plugin_cpu="no"
  plugin_cpufreq="no"
  plugin_curl_json="no"
+ plugin_curl_xml="no"
  plugin_df="no"
  plugin_disk="no"
  plugin_entropy="no"
        plugin_curl_json="yes"
  fi
  
+ if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
+ then
+       plugin_curl_xml="yes"
+ fi
  if test "x$have_processor_info" = "xyes"
  then
        plugin_cpu="yes"
@@@ -4082,6 -4088,7 +4088,7 @@@ AC_PLUGIN([cpu],         [$plugin_cpu]
  AC_PLUGIN([csv],         [yes],                [CSV output plugin])
  AC_PLUGIN([curl],        [$with_libcurl],      [CURL generic web statistics])
  AC_PLUGIN([curl_json],   [$plugin_curl_json],    [CouchDB statistics])
+ AC_PLUGIN([curl_xml],   [$plugin_curl_xml],    [CURL generic xml statistics])
  AC_PLUGIN([dbi],         [$with_libdbi],       [General database statistics])
  AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
  AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
@@@ -4392,6 -4399,7 +4399,7 @@@ Configuration
      csv . . . . . . . . . $enable_csv
      curl  . . . . . . . . $enable_curl
      curl_json . . . . . . $enable_curl_json
+     curl_xml  . . . . . . $enable_curl_xml
      dbi . . . . . . . . . $enable_dbi
      df  . . . . . . . . . $enable_df
      disk  . . . . . . . . $enable_disk
diff --combined src/collectd.conf.pod
@@@ -619,6 -619,110 +619,110 @@@ Type-instance to use. Defaults to the c
  
  =back
  
+ =head2 Plugin C<curl_xml>
+ The B<curl_xml plugin> uses B<libcurl> (L<http://curl.haxx.se/>) and B<libxml2>
+ (L<http://xmlsoft.org/>) to retrieve XML data via cURL.
+  <Plugin "curl_xml">
+    <URL "http://localhost/stats.xml">
+      Host "my_host"
+      Instance "some_instance"
+      User "collectd"
+      Password "thaiNg0I"
+      VerifyPeer true
+      VerifyHost true
+      CACert "/path/to/ca.crt"
+      <XPath "table[@id=\"magic_level\"]/tr">
+        Type "magic_level"
+        #InstancePrefix "prefix-"
+        InstanceFrom "td[1]"
+        ValuesFrom "td[2]/span[@class=\"level\"]"
+      </XPath>
+    </URL>
+  </Plugin>
+ In the B<Plugin> block, there may be one or more B<URL> blocks, each defining a
+ URL to be fetched via HTTP (using libcurl). Within each B<URL> block there are
+ options which specify the connection parameters, for example authentication
+ information, and one or more B<XPath> blocks.
+ Each B<XPath> block specifies how to get one type of information. The
+ string argument must be a valid XPath expression which returns a list
+ of "base elements". One value is dispatched for each "base element". The
+ I<type instance> and values are looked up using further I<XPath> expressions
+ that should be relative to the base element.
+ Within the B<URL> block the following options are accepted:
+ =over 4
+ =item B<Host> I<Name>
+ Use I<Name> as the host name when submitting values. Defaults to the global
+ host name setting.
+ =item B<Instance> I<Instance>
+ Use I<Instance> as the plugin instance when submitting values. Defaults to an
+ empty string (no plugin instance).
+ =item B<User> I<User>
+ =item B<Password> I<Password>
+ =item B<VerifyPeer> B<true>|B<false>
+ =item B<VerifyHost> B<true>|B<false>
+ =item B<CACert> I<CA Cert File>
+ These options behave exactly equivalent to the appropriate options of the
+ I<cURL> and I<cURL-JSON> plugins. Please see there for a detailed description.
+ =item E<lt>B<XPath> I<XPath-expression>E<gt>
+ Within each B<URL> block, there must be one or more B<XPath> blocks. Each
+ B<XPath> block specifies how to get one type of information. The string
+ argument must be a valid XPath expression which returns a list of "base
+ elements". One value is dispatched for each "base element".
+ Within the B<XPath> block the following options are accepted:
+ =over 4
+ =item B<Type> I<Type>
+ Specifies the I<Type> used for submitting patches. This determines the number
+ of values that are required / expected and whether the strings are parsed as
+ signed or unsigned integer or as double values. See L<types.db(5)> for details.
+ This option is required.
+ =item B<InstancePrefix> I<InstancePrefix>
+ Prefix the I<type instance> with I<InstancePrefix>. The values are simply
+ concatenated together without any separator.
+ This option is optional.
+ =item B<InstanceFrom> I<InstanceFrom>
+ Specifies a XPath expression to use for determining the I<type instance>. The
+ XPath expression must return exactly one element. The element's value is then
+ used as I<type instance>, possibly prefixed with I<InstancePrefix> (see above).
+ This value is required. As a special exception, if the "base XPath expression"
+ (the argument to the B<XPath> block) returns exactly one argument, then this
+ option may be omitted.
+ =item B<ValuesFrom> I<ValuesFrom> [I<ValuesFrom> ...]
+ Specifies one or more XPath expression to use for reading the values. The
+ number of XPath expressions must match the number of data sources in the
+ I<type> specified with B<Type> (see above). Each XPath expression must return
+ exactly one element. The element's value is then parsed as a number and used as
+ value for the appropriate value in the value list dispatched to the daemon.
+ =back
+ =back
  =head2 Plugin C<dbi>
  
  This plugin uses the B<dbi> library (L<http://libdbi.sourceforge.net/>) to
@@@ -1104,12 -1208,6 +1208,12 @@@ note that there are 1000 bytes in a kil
  
  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>
@@@ -3341,8 -3439,6 +3445,8 @@@ multiple routers
        User "collectd"
        Password "secr3t"
        CollectInterface true
 +      CollectCPULoad true
 +      CollectMemory true
      </Router>
      <Router>
        Host "router1.example.com"
        Password "5ecret"
        CollectInterface true
        CollectRegistrationTable true
 +      CollectDF true
 +      CollectDisk true
      </Router>
    </Plugin>
  
@@@ -3389,29 -3483,6 +3493,29 @@@ present on the device. Defaults to B<fa
  When set to B<true>, information about wireless LAN connections will be
  collected. Defaults to B<false>.
  
 +=item B<CollectCPULoad> B<true>|B<false>
 +
 +When set to B<true>, information about the CPU usage will be collected. The
 +number is a dimensionless value where zero indicates no CPU usage at all.
 +Defaults to B<false>.
 +
 +=item B<CollectMemory> B<true>|B<false>
 +
 +When enabled, the amount of used and free memory will be collected. How used
 +memory is calculated is unknown, for example whether or not caches are counted
 +as used space.
 +Defaults to B<false>.
 +
 +=item B<CollectDF> B<true>|B<false>
 +
 +When enabled, the amount of used and free disk space will be collected.
 +Defaults to B<false>.
 +
 +=item B<CollectDisk> B<true>|B<false>
 +
 +When enabled, the number of sectors written and bad blocks will be collected.
 +Defaults to B<false>.
 +
  =back
  
  =head2 Plugin C<rrdcached>