From: Florian Forster Date: Thu, 25 Feb 2010 23:17:18 +0000 (+0100) Subject: Merge branch 'collectd-4.9' X-Git-Tag: collectd-4.10.0~62 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=67e4e517f58dac2a7b0e63b80256231480bfa59d;hp=-c;p=collectd.git Merge branch 'collectd-4.9' --- 67e4e517f58dac2a7b0e63b80256231480bfa59d diff --combined configure.in index ded06bee,b3a7dcc8..a3b2ab6c --- a/configure.in +++ b/configure.in @@@ -1611,6 -1611,7 +1611,7 @@@ with_java_vmtype="client with_java_cflags="" with_java_libs="" JAVAC="$JAVAC" + JAR="$JAR" AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])], [ if test "x$withval" = "xno" @@@ -1671,6 -1672,18 +1672,18 @@@ the AC_MSG_RESULT([not found]) fi fi + if test "x$JAR" = "x" + then + AC_MSG_CHECKING([for jar]) + TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1` + if test "x$TMPDIR" != "x" + then + JAR="$TMPDIR" + AC_MSG_RESULT([$JAR]) + else + AC_MSG_RESULT([not found]) + fi + fi else if test "x$with_java_home" != "x" then AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home]) @@@ -1707,6 -1720,24 +1720,24 @@@ if test "x$JAVAC" = "x then with_java="no (javac not found)" fi + if test "x$JAR" = "x" + then + with_jar_path="$PATH" + if test "x$with_java_home" != "x" + then + with_jar_path="$with_java_home:$with_jar_path" + if test -d "$with_java_home/bin" + then + with_jar_path="$with_java_home/bin:$with_jar_path" + fi + fi + + AC_PATH_PROG(JAR, jar, [], "$with_jar_path") + fi + if test "x$JAR" = "x" + then + with_java="no (jar not found)" + fi SAVE_CPPFLAGS="$CPPFLAGS" SAVE_CFLAGS="$CFLAGS" @@@ -2739,7 -2770,7 +2770,7 @@@ f 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" @@@ -2762,7 -2793,7 +2793,7 @@@ f 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" @@@ -2777,7 -2808,7 +2808,7 @@@ f 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,7 -3821,6 +3821,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" @@@ -3930,11 -3960,6 +3961,11 @@@ the 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" @@@ -4088,7 -4113,6 +4119,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]) @@@ -4399,7 -4423,6 +4430,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 contrib/collection.cgi index 3cc24c32,100c0c73..af64fb1c --- a/contrib/collection.cgi +++ b/contrib/collection.cgi @@@ -13,6 -13,7 +13,7 @@@ use Data::Dumper () our $Config = "/etc/collection.conf"; our @DataDirs = (); + our @DontShowTypes = (); our $LibDir; our $ValidTimespan = @@@ -78,6 -79,10 +79,10 @@@ sub read_confi $value =~ s#/*$##; $LibDir = $value; } + elsif ($key eq 'dontshowtype') + { + push (@DontShowTypes, $value); + } else { print STDERR "Unknown key: $key\n"; @@@ -239,6 -244,7 +244,7 @@@ sub _find_type my $name = "$_"; $name =~ s/\.rrd$//i; my ($type, $instance) = split (m/-/, $name, 2); + if (grep { $_ eq $type } @DontShowTypes) { next; } $types{$type} = [] if (!$types{$type}); push (@{$types{$type}}, $instance) if (defined ($instance)); } @@@ -970,28 -976,6 +976,28 @@@ sub load_graph_definition 'GPRINT:avg:LAST:%5.1lf%s Last', 'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l' ], + apache_connections => ['DEF:min={file}:count:MIN', + 'DEF:avg={file}:count:AVERAGE', + 'DEF:max={file}:count:MAX', + "AREA:max#$HalfBlue", + "AREA:min#$Canvas", + "LINE1:avg#$FullBlue:Connections", + 'GPRINT:min:MIN:%6.2lf Min,', + 'GPRINT:avg:AVERAGE:%6.2lf Avg,', + 'GPRINT:max:MAX:%6.2lf Max,', + 'GPRINT:avg:LAST:%6.2lf Last' + ], + apache_idle_workers => ['DEF:min={file}:count:MIN', + 'DEF:avg={file}:count:AVERAGE', + 'DEF:max={file}:count:MAX', + "AREA:max#$HalfBlue", + "AREA:min#$Canvas", + "LINE1:avg#$FullBlue:Idle Workers", + 'GPRINT:min:MIN:%6.2lf Min,', + 'GPRINT:avg:AVERAGE:%6.2lf Avg,', + 'GPRINT:max:MAX:%6.2lf Max,', + 'GPRINT:avg:LAST:%6.2lf Last' + ], apache_requests => ['DEF:min={file}:count:MIN', 'DEF:avg={file}:count:AVERAGE', 'DEF:max={file}:count:MAX', diff --combined src/apache.c index 1028f046,ad877b5f..39849e6e --- a/src/apache.c +++ b/src/apache.c @@@ -685,11 -685,9 +685,12 @@@ static int apache_read_host (user_data_ { if (strcmp (fields[0], "Scoreboard:") == 0) submit_scoreboard (fields[1], st); - else if (strcmp (fields[0], "BusyServers:") == 0) + else if ((strcmp (fields[0], "BusyServers:") == 0) /* Apache 1.* */ + || (strcmp (fields[0], "BusyWorkers:") == 0) /* Apache 2.* */) submit_gauge ("apache_connections", NULL, atol (fields[1]), st); + else if ((strcmp (fields[0], "IdleServers:") == 0) /* Apache 1.x */ + || (strcmp (fields[0], "IdleWorkers:") == 0) /* Apache 2.x */) + submit_gauge ("apache_idle_workers", NULL, atol (fields[1]), st); } } diff --combined src/collectd-python.pod index 8742104c,45a06d1d..335f6a91 --- a/src/collectd-python.pod +++ b/src/collectd-python.pod @@@ -27,7 -27,8 +27,7 @@@ for collectd in Python. This is a lot m Python-script every time you want to read a value with the C (see L) and provides a lot more functionality, too. -Currently only I is supported and at least I is -required. +At least python I is required. =head1 CONFIGURATION @@@ -38,8 -39,8 +38,8 @@@ Loads the Python plugin I. Unlike most other LoadPlugin lines, this one should be a block containing the line "Globals true". This will cause collectd to export the name of all objects in the python interpreter for all plugins to - see. If you don't do this or your platform does not support it, the embeded - interpreter will start anywa but you won't be able to load certain python + see. If you don't do this or your platform does not support it, the embedded + interpreter will start anyway but you won't be able to load certain python modules, e.g. "time". =item B I @@@ -118,29 -119,6 +118,29 @@@ The I identifies the callback =back +=head1 STRINGS + +There are a lot of places where strings are send from collectd to python and +from python to collectd. How exactly this works depends on wheather byte or +unicode strings or python2 or python3 are used. + +Python2 has I, which is just bytes, and I. Python3 has I, +which is a unicode object, and I. + +When passing strings from python to collectd all of these object are supported +in all places, however I should be used if possible. These strings must +not contain a NUL byte. Ignoring this will result in a I exception. +If a byte string was used it will be used as is by collectd. If a unicode +object was used it will be encoded using the default encoding (see above). If +this is not possible python will raise a I exception. + +Wenn passing strings from collectd to python the behavior depends on the +python version used. Python2 will always receive a I object. Python3 will +usually receive a I object as well, however the original string will be +decoded to unicode using the default encoding. If this fails because the +string is not a valid sequence for this encoding a I object will be +returned instead. + =head1 WRITING YOUR OWN PLUGINS Writing your own plugins is quite simple. collectd manages plugins by means of @@@ -233,7 -211,7 +233,7 @@@ and collectd =head2 Config - The Config class is an object which keeps the informations provided in the + The Config class is an object which keeps the information provided in the configuration file. The sequence of children keeps one entry for each configuration option. Each such entry is another Config instance, which may nest further if nested blocks are used. @@@ -653,7 -631,7 +653,7 @@@ dispatched by the python plugin after u =item This plugin is not compatible with python3. Trying to compile it with python3 - will fail because of the ways string, unicode and bytearray bahavior was + will fail because of the ways string, unicode and bytearray behavior was changed. =item diff --combined src/collectd.conf.in index 9a8ad1b9,844c83be..888875c2 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@@ -63,7 -63,6 +63,7 @@@ FQDNLookup tru @LOAD_PLUGIN_CSV@LoadPlugin csv #@BUILD_PLUGIN_CURL_TRUE@LoadPlugin curl #@BUILD_PLUGIN_CURL_JSON_TRUE@LoadPlugin curl_json +#@BUILD_PLUGIN_CURL_XML_TRUE@LoadPlugin curl_xml #@BUILD_PLUGIN_DBI_TRUE@LoadPlugin dbi #@BUILD_PLUGIN_DF_TRUE@LoadPlugin df #@BUILD_PLUGIN_DISK_TRUE@LoadPlugin disk @@@ -232,25 -231,6 +232,25 @@@ # # +# +# +# Host "my_host" +# Instance "some_instance" +# User "collectd" +# Password "thaiNg0I" +# VerifyPeer true +# VerifyHost true +# CACert "/path/to/ca.crt" +# +# +# Type "magic_level" +# #InstancePrefix "prefix-" +# InstanceFrom "td[1]" +# ValuesFrom "td[2]/span[@class=\"level\"]" +# +# +# + # # # Statement "SELECT 'customers' AS c_key, COUNT(*) AS c_value FROM customers_tbl" @@@ -369,7 -349,7 +369,7 @@@ # # JVMArg "-verbose:jni" - # JVMArg "-Djava.class.path=@prefix@/share/collectd/java" + # JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar" # # LoadPlugin "org.collectd.java.Foobar" # @@@ -685,10 -665,6 +685,10 @@@ # Password "dozaiTh4" # CollectInterface true # CollectRegistrationTable true +# CollectCPULoad true +# CollectMemory true +# CollectDF true +# CollectDisk true # # diff --combined src/collectd.conf.pod index 45e2fac0,33d4f352..3a6f9a28 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@@ -112,7 -112,7 +112,7 @@@ a value higher than the number of plugi =item B I Sets the hostname that identifies a host. If you omit this setting, the - hostname will be determinded using the L system call. + hostname will be determined using the L system call. =item B B @@@ -443,7 -443,7 +443,7 @@@ The curl plugin uses the B (L< and the match infrastructure (the same code used by the tail plugin) to use regular expressions with the received data. - The following example will read the current value of AMD stock from google's + The following example will read the current value of AMD stock from Google's finance page and dispatch the value to collectd. @@@ -562,9 -562,9 +562,9 @@@ The following example will collect the In the B block, there may be one or more B blocks, each defining a URL to be fetched via HTTP (using libcurl) and one or more B blocks. - The B string argument must be in a path format, of which is used to collect - a value from a JSON map object. If a B path element is that of a I<*> wildcard, - the values for all keys will be collectd. + The B string argument must be in a path format, which is used to collect a + value from a JSON map object. If a path element of B is the + I<*>Ewildcard, the values for all keys will be collectd. The following options are valid within B blocks: @@@ -619,110 -619,6 +619,110 @@@ Type-instance to use. Defaults to the c =back +=head2 Plugin C + +The B uses B (L) and B +(L) to retrieve XML data via cURL. + + + + Host "my_host" + Instance "some_instance" + User "collectd" + Password "thaiNg0I" + VerifyPeer true + VerifyHost true + CACert "/path/to/ca.crt" + + + Type "magic_level" + #InstancePrefix "prefix-" + InstanceFrom "td[1]" + ValuesFrom "td[2]/span[@class=\"level\"]" + + + + +In the B block, there may be one or more B blocks, each defining a +URL to be fetched via HTTP (using libcurl). Within each B block there are +options which specify the connection parameters, for example authentication +information, and one or more B blocks. + +Each B 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 and values are looked up using further I expressions +that should be relative to the base element. + +Within the B block the following options are accepted: + +=over 4 + +=item B I + +Use I as the host name when submitting values. Defaults to the global +host name setting. + +=item B I + +Use I as the plugin instance when submitting values. Defaults to an +empty string (no plugin instance). + +=item B I +=item B I +=item B B|B +=item B B|B +=item B I + +These options behave exactly equivalent to the appropriate options of the +I and I plugins. Please see there for a detailed description. + +=item EB IE + +Within each B block, there must be one or more B blocks. Each +B 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 block the following options are accepted: + +=over 4 + +=item B I + +Specifies the I 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 for details. +This option is required. + +=item B I + +Prefix the I with I. The values are simply +concatenated together without any separator. +This option is optional. + +=item B I + +Specifies a XPath expression to use for determining the I. The +XPath expression must return exactly one element. The element's value is then +used as I, possibly prefixed with I (see above). + +This value is required. As a special exception, if the "base XPath expression" +(the argument to the B block) returns exactly one argument, then this +option may be omitted. + +=item B I [I ...] + +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 specified with B (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 This plugin uses the B library (L) to @@@ -773,7 -669,7 +773,7 @@@ The following is a complete list of opt Query blocks define I statements and how the returned data should be interpreted. They are identified by the name that is given in the opening line of the block. Thus the name needs to be unique. Other than that, the name is - not used in collectd. + not used in collectd. In each B block, there is one or more B blocks. B blocks define which column holds which value or instance information. You can use @@@ -831,7 -727,7 +831,7 @@@ options to provide multiple queries wit different syntax. The plugin will use only those queries, where the specified minimum and maximum versions fit the version of the database in use. - The database version is determined by C, see the + The database version is determined by C, see the L for details. Basically, each part of the version is assumed to be in the range from B<00> to B<99> and all dots are removed. So version "4.1.2" becomes @@@ -1056,7 -952,7 +1056,7 @@@ is set to B, all disks are collec =item B I - The dns plugin uses B to capture dns traffic and analyses it. This + The dns plugin uses B to capture dns traffic and analyzes it. This option sets the interface that should be used. If this option is not set, or set to "any", the plugin will try to get packets from B interfaces. This may not work on certain platforms, such as MacEOSEX. @@@ -1208,12 -1104,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 I|I + +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, i.e. by default hidden files and directories are ignored. + =back =head2 Plugin C @@@ -1783,7 -1673,7 +1783,7 @@@ or SQL threads are not running =head2 Plugin C - The netapp plugin can collect various performance and capacity informations + The netapp plugin can collect various performance and capacity information from a NetApp filer using the NetApp API. Please note that NetApp has a wide line of products and a lot of different @@@ -2307,7 -2197,7 +2307,7 @@@ Here are some examples to help you unde =item B - The behaviour is the same as with all other similar plugins: If nothing is + The behavior is the same as with all other similar plugins: If nothing is selected at all, everything is collected. If some things are selected using the options described above, only these statistics are collected. If you set B to B, this behavior is inverted, i.Ee. the @@@ -2319,7 -2209,7 +2319,7 @@@ specified statistics will not be collec The Network plugin sends data to a remote instance of collectd, receives data from a remote instance, or both at the same time. Data which has been received - from the network is usually not transmitted again, but this can be actived, see + from the network is usually not transmitted again, but this can be activated, see the B option below. The default IPv6 multicast group is C. The default IPv4 @@@ -2613,7 -2503,7 +2613,7 @@@ UDP-Port to connect to. Defaults to B<1 =item B B|B - Sets wether or not to perform reverse lookups on peers. Since the name or + Sets whether or not to perform reverse lookups on peers. Since the name or IP-address may be used in a filename it is recommended to disable reverse lookups. The default is to do reverse lookups to preserve backwards compatibility, though. @@@ -3445,8 -3335,6 +3445,8 @@@ multiple routers User "collectd" Password "secr3t" CollectInterface true + CollectCPULoad true + CollectMemory true Host "router1.example.com" @@@ -3454,8 -3342,6 +3454,8 @@@ Password "5ecret" CollectInterface true CollectRegistrationTable true + CollectDF true + CollectDisk true @@@ -3493,29 -3379,6 +3493,29 @@@ present on the device. Defaults to B, information about wireless LAN connections will be collected. Defaults to B. +=item B B|B + +When set to B, 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. + +=item B B|B + +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. + +=item B B|B + +When enabled, the amount of used and free disk space will be collected. +Defaults to B. + +=item B B|B + +When enabled, the number of sectors written and bad blocks will be collected. +Defaults to B. + =back =head2 Plugin C @@@ -4067,7 -3930,7 +4067,7 @@@ selection is configured at all, B =head2 Plugin C - The C connects to a TokyoTyrant server and collects a + The C connects to a TokyoTyrant server and collects a couple metrics: number of records, and database size on disk. =over 4 @@@ -4635,7 -4498,7 +4635,7 @@@ This is the same as writing =back - =head2 Built-in targets + =head2 Built-in targets The following targets are built into the core daemon and therefore need no plugins to be loaded: