X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcollectd.conf.pod;h=55aa69b60345e7650781ff13ac1959529db312ba;hb=ef7fec0c4e0bbbabb356e6a570ac6297ee06eb80;hp=1a52ae5cd49d2223a9cf2295a901b922f46e74ae;hpb=0421d0d777f6df3cf78fd5366c82b0ed7adb9684;p=collectd.git diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 1a52ae5c..55aa69b6 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -282,6 +282,161 @@ number. =back +=head2 Plugin C + +This plugin uses the "B" library (L) to +connect to various databases, execute SQL statements and read back the results. +You can configure how each column is to be interpreted and the plugin will +generate one data set from each row returned according to these rules. + +Because the plugin is very generic, the configuration is a little more complex +than those of other plugins. It usually looks something like this: + + + + Statement "SELECT category, COUNT(*) AS value FROM products WHERE in_stock = 0 GROUP BY category" + Type "gauge" + InstancesFrom "category" + ValuesFrom "value" + + + Driver "mysql" + DriverOption "host" "localhost" + DriverOption "username" "collectd" + DriverOption "password" "aZo6daiw" + DriverOption "dbname" "prod_info" + SelectDB "prod_info" + Query "out_of_stock" + + + +The configuration above defines one query and one database. The query is then +linked to the database with the B option I the +BDatabaseE> block. You can have any number of queries and databases +and you can also use the B statement to split up the configuration +file in multiple, smaller files. However, the BQueryE> block I +precede the BDatabaseE> blocks, because the file is interpreted from +top to bottom! + +The following is a complete list of options: + +=head3 B blocks + +Query blocks define SQL 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. + +=over 4 + +=item B I + +Sets the statement that should be executed on the server. This is B +interpreted by collectd, but simply passed to the database server. Therefore, +the SQL dialect that's used depends on the server collectd is connected to. + +The query has to return at least two columns, one for the instance and one +value. You cannot omit the instance, even if the statement is guaranteed to +always return exactly one line. In that case, you can usually specify something +like this: + + Statement "SELECT \"instance\", COUNT(*) AS value FROM table" + +(That works with MySQL but may not be valid SQL according to the spec. If you +use a more strict database server, you may have to select from a dummy table or +something.) + +=item B I + +The B that's used for each line returned. See L for more +details on how types are defined. In short: A type is a predefined layout of +data and the number of values and type of values has to match the type +definition. + +If you specify "temperature" here, you need exactly one gauge column. If you +specify "if_octets", you will need two counter columns. See the B +setting below. + +=item B I [I ...] + +Specifies the columns whose values will be used to create the "TypeInstance" +for each row. You need to specify at least one column for each query. If you +specify more than one column, the value of all columns will be join together +with the hyphen as separation character. + +The plugin itself does not check whether or not all built instances are +different. It's your responsibility to assure that each is unique. + +=item B I [I ...] + +Names the columns whose content is used as the actual data for the data sets +that are dispatched to the daemon. How many such columns you need is determined +by the B setting above. If you specify too many or not enough columns, +the plugin will complain about that and no data will be submitted to the +daemon. + +The actual data type in the columns is not that important. The plugin will +automatically cast the values to the right type if it know how to do that. So +it should be able to handle integer an floating point types, as well as strings +(if they include a number at the beginning). + +=back + +=head3 B blocks + +Database blocks define a connection to a database and which queries should be +sent to that database. Since the used "dbi" library can handle a wide variety +of databases, the configuration is very generic. If in doubt, refer to libdbi's +documentationE- we stick as close to the terminology used there. + +Each database needs a "name" as string argument in the starting tag of the +block. This name will be used as "PluginInstance" in the values submitted to +the daemon. Other than that, that name is not used. + +=over 4 + +=item B I + +Specifies the driver to use to connect to the database. In many cases those +drivers are named after the database they can connect to, but this is not a +technical necessity. These drivers are sometimes referred to as "DBD", +BataBase Briver, and some distributions ship them in separate +packages. Drivers for the "dbi" library are developed by the B +project at L. + +You need to give the driver name as expected by the "dbi" library here. You +should be able to find that in the documentation for each driver. If you +mistype the driver name, the plugin will dump a list of all known driver names +to the log. + +=item B I I + +Sets driver-specific options. What option a driver supports can be found in the +documentation for each driver, somewhere at +L. However, the options "host", +"username", "password", and "dbname" seem to be deEfacto standards. + +Unfortunately, drivers are not too keen to report errors when an unknown option +is passed to them, so invalid settings here may go unnoticed. This is not the +plugin's fault, it will report errors if it gets them from the libraryE/ +the driver. If a driver complains about an option, the plugin will dump a +complete list of all options understood by that driver to the log. + +=item B I + +In some cases, the database name you connect with is not the database name you +want to use for querying data. If this option is set, the plugin will "select" +(switch to) that database after the connection is established. + +=item B I + +Associates the query named I with this database connection. The +query needs to be defined I this statement, i.Ee. all query +blocks you want to refer to must be placed above the database block you want to +refer to them from. + +=back + =head2 Plugin C =over 4 @@ -420,6 +575,174 @@ expected from them. This is documented in great detail in L. =back +=head2 Plugin C + +The C plugin counts the number of files in a certain directory (and +its subdirectories) and their combined size. The configuration is very straight +forward: + + + + Instance "qmail-message" + + + Instance "qmail-todo" + + + Instance "php5-sessions" + Name "sess_*" + + + +The example above counts the number of files in QMail's queue directories and +the number of PHP5 sessions. Jfiy: The "todo" queue holds the messages that +QMail has not yet looked at, the "message" queue holds the messages that were +classified into "local" and "remote". + +As you can see, the configuration consists of one or more C blocks, +each of which specifies a directory in which to count the files. Within those +blocks, the following options are recognized: + +=over 4 + +=item B I + +Sets the plugin instance to I. That instance name must be unique, but +it's your responsibility, the plugin doesn't check for that. If not given, the +instance is set to the directory name with all slashes replaced by underscores +and all leading underscores removed. + +=item B I + +Only count files that match I, where I is a shell-like +wildcard as understood by L. Only the B is checked +against the pattern, not the entire path. In case this makes it easier for you: +This option has been named after the B<-name> parameter to L. + +=item B I + +Count only files of a specific age: If I is greater than zero, only files +that haven't been touched in the last I seconds are counted. If I is +a negative number, this is inversed. For example, if B<-60> is specified, only +files that have been modified in the last minute will be counted. + +The number can also be followed by a "multiplier" to easily specify a larger +timespan. When given in this notation, the argument must in quoted, i.Ee. +must be passed as string. So the B<-60> could also be written as B<"-1m"> (one +minute). Valid multipliers are C (second), C (minute), C (hour), C +(day), C (week), and C (year). There is no "month" multiplier. You can +also specify fractional numbers, e.Eg. B<"0.5d"> is identical to +B<"12h">. + +=item B I + +Count only files of a specific size. When I is a positive number, only +files that are at least this big are counted. If I is a negative number, +this is inversed, i.Ee. only files smaller than the absolute value of +I are counted. + +As with the B option, a "multiplier" may be added. For a detailed +description see above. Valid multipliers here are C (byte), C (kilobyte), +C (megabyte), C (gigabyte), C (terabyte), and C

(petabyte). Please +note that there are 1000 bytes in a kilobyte, not 1024. + +=item B I|I + +Controls whether or not to recurse into subdirectories. Enabled by default. + +=back + +=head2 Plugin C + +This plugin allows you to filter and rewrite value lists based on +Perl-compatible regular expressions whose syntax and semantics are as close as +possible to those of the Perl 5 language. See L for details. + + + + Host "^mail\d+$" + Plugin "^tcpconns$" + TypeInstance "^SYN_" + + Action NoWrite + + + + Plugin "^sensors$" + PluginInstance "^Some Weird Sensor Chip Name Prefix" + + SubstitutePluginInstance "foo" + + + +The configuration consists of one or more C blocks, each of which +specifies a regular expression identifying a set of value lists and how to +handle successful matches. A value list keeps the values of a single data-set +and is identified by the tuple (host, plugin, plugin instance, type, type +instance). The plugin and type instances are optional components. If they are +missing they are treated as empty strings. Within those blocks, the following +options are recognized: + +=over 4 + +=item B I + +=item B I + +=item B I + +=item B I + +=item B I + +Specifies the regular expression for each component of the identifier. If any +of these options is missing it is interpreted as a pattern which matches any +string. All five components of a value list have to match the appropriate +regular expression to trigger the specified action. + +=item B I|I|I + +Specify how to handle successful matches: + +=over 4 + +=item B + +Do not send the value list to any output (a.k.a. write) plugins. + +=item B + +Skip threshold checking for this value list. + +=item B + +Completely ignore this value list. + +=back + +Two or more actions may be combined by specifying multiple B options. + +=item B I + +=item B I + +=item B I + +=item B I + +=item B I + +Upon a successful match, the matching substring will be replaced by the +specified I text. These options require that an appropriate regex +has been specified before, e.Eg. B requires that the +B option has been specified before. + +B: It is not recommended to modify the type unless you really know what +you are doing. The type is used to identify the data-set definition of the +dispatched values. + +=back + =head2 Plugin C To get values from B collectd connects to B (127.0.0.1), @@ -472,6 +795,38 @@ other interfaces are collected. =back +=head2 Plugin C + +=over 4 + +=item B I + +Selects sensors to collect or to ignore, depending on B. + +=item B I|I + +If no configuration if given, the B plugin will collect data from all +sensors found of type "temperature", "voltage", "current" and "fanspeed". +This option enables you to do that: By setting B to I +the effect of B is inverted: All selected sensors are ignored and +all other sensors are collected. + +=item B I|I + +If a sensor appears after initialization time of a minute a notification +is sent. + +=item B I|I + +If a sensor disappears a notification is sent. + +=item B I|I + +If you have for example dual power supply and one of them is (un)plugged then +a notification is sent. + +=back + =head2 Plugin C =over 4 @@ -664,12 +1019,12 @@ database 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. -This plugin issues C and evaluates C, -C and C which correspond to F, -F and F. Also, the values of -C are put in F and values of C are put -in F. Please refer to the B, -I<5.2.4. Server Status Variables> for an explanation of these values. +This plugin issues the MySQL C command and collects information +about MySQL network traffic, executed statements, requests, the query cache +and threads by evaluating the C, C, +C, C and C return values. Please refer to the +B, I<5.1.6. Server Status Variables> for an +explanation of these values. Use the following options to configure the plugin: @@ -681,7 +1036,9 @@ Hostname of the database server. Defaults to B. =item B I -Username to use when connecting to the database. +Username to use when connecting to the database. The user does not have to be +granted any privileges (which is synonym to granting the C privilege). +Any existing MySQL user will do. =item B I @@ -692,6 +1049,23 @@ Password needed to log into the database. Select this database. Defaults to I which is a perfectly reasonable option for what this plugin does. +=item B I + +TCP-port to connect to. The port must be specified in its numeric form, but it +must be passed as a string nonetheless. For example: + + Port "3306" + +If B is set to B (the default), this setting has no effect. +See the documentation for the C function for details. + +=item B I + +Specifies the path to the UNIX domain socket of the MySQL server. This option +only has any effect, if B is set to B (the default). +Otherwise, use the B option above. See the documentation for the +C function for details. + =back =head2 Plugin C @@ -934,9 +1308,18 @@ L. =head2 Plugin C +B See notes below. + The C plugin uses the B library from the B project L to read sensors connected via the onewire bus. +Currently only temperature sensors (sensors with the family code C<10>, +e.Eg. DS1820, DS18S20, DS1920) can be read. If you have other sensors you +would like to have included, please send a sort request to the mailing list. + +Hubs (the DS2409 chips) are working, but read the note, why this plugin is +experimental, below. + =over 4 =item B I @@ -953,6 +1336,8 @@ with that version, the following configuration worked for us: Device "-s localhost:4304" +This directive is B and does not have a default value. + =item B I Selects sensors to collect or to ignore, depending on B, see @@ -972,6 +1357,76 @@ interfaces are collected. =back +B The C plugin is experimental, because it doesn't yet +work with big setups. It works with one sensor being attached to one +controller, but as soon as you throw in a couple more senors and maybe a hub +or two, reading all values will take more than ten seconds (the default +interval). We will probably add some separate thread for reading the sensors +and some cache or something like that, but it's not done yet. We will try to +maintain backwards compatibility in the future, but we can't probmise. So in +short: If it works for you: Great! But kaap in mind that the config I +change, though this is unlikely. Oh, and if you want to help improving this +plugin, just send a short notice to the mailing list. ThanksE:) + +=head2 Plugin C + +The "oracle" plugin uses the Oracle® Call Interface (OCI) to connect to an +Oracle® Database and lets you execute SQL statements there. It is very similar +to the "dbi" plugin, because it was written around the same time. See the "dbi" +plugin's documentation above for details. + + + + Statement "SELECT category, COUNT(*) AS value FROM products WHERE in_stock = 0 GROUP BY category" + Type "gauge" + InstancesFrom "category" + ValuesFrom "value" + + + ConnectID "db01" + Username "oracle" + Password "secret" + Query "out_of_stock" + + + +=head3 B blocks + +The Query blocks are handled identically to the Query blocks of the "dbi" +plugin. Please see its documentation above for details on how to specify +queries. + +=head3 B blocks + +Database blocks define a connection to a database and which queries should be +sent to that database. Each database needs a "name" as string argument in the +starting tag of the block. This name will be used as "PluginInstance" in the +values submitted to the daemon. Other than that, that name is not used. + +=over 4 + +=item B I + +Defines the "database alias" or "service name" to connect to. Usually, these +names are defined in the file named C<$ORACLE_HOME/network/admin/tnsnames.ora>. + +=item B I + +Username used for authentication. + +=item B I + +Password used for authentication. + +=item B I + +Associates the query named I with this database connection. The +query needs to be defined I this statement, i.Ee. all query +blocks you want to refer to must be placed above the database block you want to +refer to them from. + +=back + =head2 Plugin C This plugin embeds a Perl-interpreter into collectd and provides an interface @@ -996,16 +1451,31 @@ Sets the Time-To-Live of generated ICMP packets. The C plugin queries statistics from PostgreSQL databases. It keeps a persistent connection to all configured databases and tries to -reconnect if the connection has been interrupted. The statistics are collected -from PostgreSQL's B which thus has to be enabled for -this plugin to work correctly. This should usually be the case by default. -See the section "The Statistics Collector" of the B -for details. +reconnect if the connection has been interrupted. A database is configured by +specifying a B block as described below. The default statistics are +collected from PostgreSQL's B which thus has to be +enabled for this plugin to work correctly. This should usually be the case by +default. See the section "The Statistics Collector" of the B for details. + +By specifying custom database queries using a B block as described +below, you may collect any data that is available from some PostgreSQL +database. This way, you are able to access statistics of external daemons +which are available in a PostgreSQL database or use future or special +statistics provided by PostgreSQL without the need to upgrade your collectd +installation. The B manual can be found at L. + + Query "SELECT magic, spells FROM wizard WHERE host = $1;" + Param hostname + Column gauge magic + Column counter spells + + Host "hostname" Port "5432" @@ -1013,15 +1483,121 @@ L. Password "secret" SSLMode "prefer" KRBSrvName "kerberos_service_name" + Query magic Service "service_name" +The B block defines one database query which may later be used by a +database definition. It accepts a single mandatory argument which specifies +the name of the query. The names of all queries have to be unique. The +following configuration options are available to define the query: + +=over 4 + +=item B I + +Specify the I which the plugin should execute. The string may +contain the tokens B<$1>, B<$2>, etc. which are used to reference the first, +second, etc. parameter. The value of the parameters is specified by the +B configuration option - see below for details. To include a literal +B<$> character followed by a number, surround it with single quotes (B<'>). + +Any SQL command which may return data (such as C