Merge branch 'collectd-5.6' into collectd-5.7
authorPavel Rochnyack <pavel2000@ngs.ru>
Fri, 20 Oct 2017 13:54:09 +0000 (20:54 +0700)
committerPavel Rochnyack <pavel2000@ngs.ru>
Fri, 20 Oct 2017 13:54:09 +0000 (20:54 +0700)
1  2 
src/collectd.conf.pod
src/memcached.c

diff --combined src/collectd.conf.pod
@@@ -555,7 -555,6 +555,7 @@@ B<Synopsis:
   #   GraphiteEscapeChar "_"
   #   GraphiteSeparateInstances false
   #   GraphiteAlwaysAppendDS false
 + #   GraphitePreserveSeparator false
     </Publish>
  
     # Receive values from an AMQP broker
@@@ -730,12 -729,6 +730,12 @@@ If set to B<true>, append the name of t
  identifier. If set to B<false> (the default), this is only done when there is
  more than one DS.
  
 +=item B<GraphitePreserveSeparator> B<false>|B<true>
 +
 +If set to B<false> (the default) the C<.> (dot) character is replaced with
 +I<GraphiteEscapeChar>. Otherwise, if set to B<true>, the C<.> (dot) character
 +is preserved, i.e. passed through.
 +
  =back
  
  =head2 Plugin C<apache>
@@@ -1121,13 -1114,6 +1121,13 @@@ When set to B<true>, the battery plugi
  and "remaining capacity") and B<degraded> (difference between "design capacity"
  and "last full capacity").
  
 +=item B<QueryStateFS> B<false>|B<true>
 +
 +When set to B<true>, the battery plugin will only read statistics
 +related to battery performance as exposed by StateFS at
 +/run/state. StateFS is used in Mer-based Sailfish OS, for
 +example.
 +
  =back
  
  =head2 Plugin C<bind>
@@@ -2393,67 -2379,6 +2393,67 @@@ Enabled by default, collects unknown (a
  
  =back
  
 +=head2 Plugin C<dpdkstat>
 +
 +The I<dpdkstat plugin> collects information about DPDK interfaces using the
 +extended NIC stats API in DPDK.
 +
 +B<Synopsis:>
 +
 + <Plugin "dpdkstat">
 +    Coremask "0x4"
 +    MemoryChannels "4"
 +    ProcessType "secondary"
 +    FilePrefix "rte"
 +    EnabledPortMask 0xffff
 +    PortName "interface1"
 +    PortName "interface2"
 + </Plugin>
 +
 +B<Options:>
 +
 +=over 4
 +
 +=item B<Coremask> I<Mask>
 +
 +A string containing an hexadecimal bit mask of the cores to run on. Note that
 +core numbering can change between platforms and should be determined beforehand.
 +
 +=item B<Memorychannels> I<Channels>
 +
 +A string containing a number of memory channels per processor socket.
 +
 +=item B<ProcessType> I<type>
 +
 +A string containing the type of DPDK process instance.
 +
 +=item B<FilePrefix> I<File>
 +
 +The prefix text used for hugepage filenames. The filename will be set to
 +/var/run/.<prefix>_config where prefix is what is passed in by the user.
 +
 +=item B<SocketMemory> I<MB>
 +
 +A string containing amount of Memory to allocate from hugepages on specific
 +sockets in MB
 +
 +=item B<EnabledPortMask> I<Mask>
 +
 +A hexidecimal bit mask of the DPDK ports which should be enabled. A mask
 +of 0x0 means that all ports will be disabled. A bitmask of all Fs means
 +that all ports will be enabled. This is an optional argument - default
 +is all ports enabled.
 +
 +=item B<PortName> I<Name>
 +
 +A string containing an optional name for the enabled DPDK ports. Each PortName
 +option should contain only one port name; specify as many PortName options as
 +desired. Default naming convention will be used if PortName is blank. If there
 +are less PortName options than there are enabled ports, the default naming
 +convention will be used for the additional ports.
 +
 +=back
 +
  =head2 Plugin C<email>
  
  =over 4
@@@ -2904,101 -2829,6 +2904,101 @@@ TCP-Port to connect to. Defaults to B<7
  
  =back
  
 +=head2 Plugin C<hugepages>
 +
 +To collect B<hugepages> information, collectd reads directories
 +"/sys/devices/system/node/*/hugepages" and
 +"/sys/kernel/mm/hugepages".
 +Reading of these directories can be disabled by the following
 +options (default is enabled).
 +
 +=over 4
 +
 +=item B<ReportPerNodeHP> B<true>|B<false>
 +
 +If enabled, information will be collected from the hugepage
 +counters in "/sys/devices/system/node/*/hugepages".
 +This is used to check the per-node hugepage statistics on
 +a NUMA system.
 +
 +=item B<ReportRootHP> B<true>|B<false>
 +
 +If enabled, information will be collected from the hugepage
 +counters in "/sys/kernel/mm/hugepages".
 +This can be used on both NUMA and non-NUMA systems to check
 +the overall hugepage statistics.
 +
 +=item B<ValuesPages> B<true>|B<false>
 +
 +Whether to report hugepages metrics in number of pages.
 +Defaults to B<true>.
 +
 +=item B<ValuesBytes> B<false>|B<true>
 +
 +Whether to report hugepages metrics in bytes.
 +Defaults to B<false>.
 +
 +=item B<ValuesPercentage> B<false>|B<true>
 +
 +Whether to report hugepages metrics as percentage.
 +Defaults to B<false>.
 +
 +=back
 +
 +=head2 Plugin C<intel_rdt>
 +
 +The I<intel_rdt> plugin collects information provided by monitoring features of
 +Intel Resource Director Technology (Intel(R) RDT) like Cache Monitoring
 +Technology (CMT), Memory Bandwidth Monitoring (MBM). These features provide
 +information about utilization of shared resources. CMT monitors last level cache
 +occupancy (LLC). MBM supports two types of events reporting local and remote
 +memory bandwidth. Local memory bandwidth (MBL) reports the bandwidth of
 +accessing memory associated with the local socket. Remote memory bandwidth (MBR)
 +reports the bandwidth of accessing the remote socket. Also this technology
 +allows to monitor instructions per clock (IPC).
 +Monitor events are hardware dependant. Monitoring capabilities are detected on
 +plugin initialization and only supported events are monitored.
 +
 +B<Synopsis:>
 +
 +  <Plugin "intel_rdt">
 +    Cores "0-2" "3,4,6" "8-10,15"
 +  </Plugin>
 +
 +B<Options:>
 +
 +=over 4
 +
 +=item B<Interval> I<seconds>
 +
 +The interval within which to retrieve statistics on monitored events in seconds.
 +For milliseconds divide the time by 1000 for example if the desired interval
 +is 50ms, set interval to 0.05. Due to limited capacity of counters it is not
 +recommended to set interval higher than 1 sec.
 +
 +=item B<Cores> I<cores groups>
 +
 +All events are reported on a per core basis. Monitoring of the events can be
 +configured for group of cores (aggregated statistics). This field defines groups
 +of cores on which to monitor supported events. The field is represented as list
 +of strings with core group values. Each string represents a list of cores in a
 +group. Allowed formats are:
 +    0,1,2,3
 +    0-10,20-18
 +    1,3,5-8,10,0x10-12
 +
 +If an empty string is provided as value for this field default cores
 +configuration is applied - a separate group is created for each core.
 +
 +=back
 +
 +B<Note:> By default global interval is used to retrieve statistics on monitored
 +events. To configure a plugin specific interval use B<Interval> option of the
 +intel_rdt <LoadPlugin> block. For milliseconds divide the time by 1000 for
 +example if the desired interval is 50ms, set interval to 0.05.
 +Due to limited capacity of counters it is not recommended to set interval higher
 +than 1 sec.
 +
  =head2 Plugin C<interface>
  
  =over 4
@@@ -3420,12 -3250,11 +3420,12 @@@ interpreted. For a description of matc
  
  The B<memcached plugin> connects to a memcached server and queries statistics
  about cache utilization, memory and bandwidth used.
 -L<http://www.danga.com/memcached/>
 +L<http://memcached.org/>
  
   <Plugin "memcached">
     <Instance "name">
 -     Host "memcache.example.com"
 +     #Host "memcache.example.com"
 +     Address "127.0.0.1"
       Port 11211
     </Instance>
   </Plugin>
@@@ -3438,25 -3267,16 +3438,25 @@@ following options are allowed
  
  =item B<Host> I<Hostname>
  
 -Hostname to connect to. Defaults to B<127.0.0.1>.
 +Sets the B<host> field of dispatched values. Defaults to the global hostname
 +setting.
 +For backwards compatibility, values are also dispatched with the global
 +hostname when B<Host> is set to B<127.0.0.1> or B<localhost> and B<Address> is
 +not set.
 +
 +=item B<Address> I<Address>
 +
 +Hostname or IP to connect to. For backwards compatibility, defaults to the
 +value of B<Host> or B<127.0.0.1> if B<Host> is unset.
  
  =item B<Port> I<Port>
  
 -TCP-Port to connect to. Defaults to B<11211>.
 +TCP port to connect to. Defaults to B<11211>.
  
  =item B<Socket> I<Path>
  
  Connect to I<memcached> using the UNIX domain socket at I<Path>. If this
 -setting is given, the B<Host> and B<Port> settings are ignored.
 +setting is given, the B<Address> and B<Port> settings are ignored.
  
  =back
  
@@@ -5903,7 -5723,7 +5903,7 @@@ values are made available through thos
  
  =item B<$1>
  
 -The timestamp of the queried value as a floating point number.
 +The timestamp of the queried value as an RFC 3339-formatted local time.
  
  =item B<$2>
  
@@@ -6939,6 -6759,8 +6939,8 @@@ Calculate and dispatch various values o
  an interval. If set to B<False>, the default, these values aren't calculated /
  dispatched.
  
+ Please note what reported timer values less than 0.001 are ignored in all B<Timer*> reports.
  =back
  
  =head2 Plugin C<swap>
@@@ -7125,15 -6947,6 +7127,15 @@@ user using (extended) regular expressio
          Type "counter"
          Instance "local_user"
        </Match>
 +      <Match>
 +        Regex "l=([0-9]*\\.[0-9]*)"
 +        <DSType "Distribution">
 +          Percentile 99
 +          Bucket 0 100
 +        </DSType>
 +        Type "latency"
 +        Instance "foo"
 +      </Match>
      </File>
    </Plugin>
  
@@@ -7196,13 -7009,6 +7198,13 @@@ Use the greatest number only
  
  Use the last number found.
  
 +=item B<GaugePersist>
 +
 +Use the last number found. The number is not reset at the end of an interval.
 +It is continously reported until another number is matched. This is intended
 +for cases in which only state changes are reported, for example a thermometer
 +that only reports the temperature when it changes.
 +
  =item B<CounterSet>
  
  =item B<DeriveSet>
@@@ -7232,74 -7038,14 +7234,74 @@@ Increase the internal counter by one. T
  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.
  
 +=item B<Distribution>
 +
 +Type to do calculations based on the distribution of values, primarily
 +calculating percentiles. This is primarily geared towards latency, but can be
 +used for other metrics as well. The range of values tracked with this setting
 +must be in the range (0–2^34) and can be fractional. Please note that neither
 +zero nor 2^34 are inclusive bounds, i.e. zero I<cannot> be handled by a
 +distribution.
 +
 +This option must be used together with the B<Percentile> and/or B<Bucket>
 +options.
 +
 +B<Synopsis:>
 +
 +  <DSType "Distribution">
 +    Percentile 99
 +    Bucket 0 100
 +  </DSType>
 +
 +=over 4
 +
 +=item B<Percentile> I<Percent>
 +
 +Calculate and dispatch the configured percentile, i.e. compute the value, so
 +that I<Percent> of all matched values are smaller than or equal to the computed
 +latency.
 +
 +Metrics are reported with the I<type> B<Type> (the value of the above option)
 +and the I<type instance> C<[E<lt>InstanceE<gt>-]E<lt>PercentE<gt>>.
 +
 +This option may be repeated to calculate more than one percentile.
 +
 +=item B<Bucket> I<lower_bound> I<upper_bound>
 +
 +Export the number of values (a C<DERIVE>) falling within the given range. Both,
 +I<lower_bound> and I<upper_bound> may be a fractional number, such as B<0.5>.
 +Each B<Bucket> option specifies an interval C<(I<lower_bound>,
 +I<upper_bound>]>, i.e. the range I<excludes> the lower bound and I<includes>
 +the upper bound. I<lower_bound> and I<upper_bound> may be zero, meaning no
 +lower/upper bound.
 +
 +To export the entire (0–inf) range without overlap, use the upper bound of the
 +previous range as the lower bound of the following range. In other words, use
 +the following schema:
 +
 +  Bucket   0   1
 +  Bucket   1   2
 +  Bucket   2   5
 +  Bucket   5  10
 +  Bucket  10  20
 +  Bucket  20  50
 +  Bucket  50   0
 +
 +Metrics are reported with the I<type> C<bucket> and the I<type instance>
 +C<E<lt>TypeE<gt>[-E<lt>InstanceE<gt>]-E<lt>lower_boundE<gt>_E<lt>upper_boundE<gt>>.
 +
 +This option may be repeated to calculate more than one rate.
 +
  =back
  
 -As you'd expect the B<Gauge*> types interpret the submatch as a floating point
 -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.
 +=back
 +
 +The B<Gauge*> and B<Distribution> types interpret the submatch as a floating
 +point 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>
  
@@@ -7556,7 -7302,7 +7558,7 @@@ couple metrics: number of records, and 
  
  =item B<Host> I<Hostname/IP>
  
 -The hostname or ip which identifies the server.
 +The hostname or IP which identifies the server.
  Default: B<127.0.0.1>
  
  =item B<Port> I<Service/Port>
@@@ -7570,60 -7316,61 +7572,60 @@@ Default: B<1978
  =head2 Plugin C<turbostat>
  
  The I<Turbostat plugin> reads CPU frequency and C-state residency on modern
 -Intel processors by using the new Model Specific Registers.
 +Intel processors by using I<Model Specific Registers>.
  
  =over 4
  
  =item B<CoreCstates> I<Bitmask(Integer)>
  
 -Bitmask of the list of core C states supported by the processor.
 +Bit mask of the list of core C-states supported by the processor.
  This option should only be used if the automated detection fails.
 -Default value extracted from the cpu model and family.
 +Default value extracted from the CPU model and family.
  
  Currently supported C-states (by this plugin): 3, 6, 7
  
 -Example: (1<<3)+(1<<6)+(1<<7) = 392 for all states
 +B<Example:>
 +
 +  All states (3, 6 and 7):
 +  (1<<3) + (1<<6) + (1<<7) = 392
  
  =item B<PackageCstates> I<Bitmask(Integer)>
  
 -Bitmask of the list of pacages C states supported by the processor.
 -This option should only be used if the automated detection fails.
 -Default value extracted from the cpu model and family.
 +Bit mask of the list of packages C-states supported by the processor. This
 +option should only be used if the automated detection fails. Default value
 +extracted from the CPU model and family.
  
  Currently supported C-states (by this plugin): 2, 3, 6, 7, 8, 9, 10
  
 -Example: (1<<2)+(1<<3)+(1<<6)+(1<<7) = 396 for states 2, 3, 6 and 7
 -
 -=item B<SystemManagementInterrupt> I<true>|I<false>
 +B<Example:>
  
 -Boolean enabling the collection of the I/O System-Management Interrupt
 -counter'. This option should only be used if the automated detection
 -fails or if you want to disable this feature.
 +  States 2, 3, 6 and 7:
 +  (1<<2) + (1<<3) + (1<<6) + (1<<7) = 396
  
 -=item B<DigitalTemperatureSensor> I<true>|I<false>
 +=item B<SystemManagementInterrupt> I<true>|I<false>
  
 -Boolean enabling the collection of the temperature of each core.
 -This option should only be used if the automated detectionfails or
 -if you want to disable this feature.
 +Boolean enabling the collection of the I/O System-Management Interrupt counter.
 +This option should only be used if the automated detection fails or if you want
 +to disable this feature.
  
  =item B<DigitalTemperatureSensor> I<true>|I<false>
  
 -Boolean enabling the collection of the temperature of each package.
 -This option should only be used if the automated detectionfails or
 -if you want to disable this feature.
 +Boolean enabling the collection of the temperature of each core. This option
 +should only be used if the automated detection fails or if you want to disable
 +this feature.
  
  =item B<TCCActivationTemp> I<Temperature>
  
 -Thermal Control Circuit Activation Temperature of the installed
 -CPU. This temperature is used when collecting the temperature of
 -cores or packages. This option should only be used if the automated
 -detection fails. Default value extracted from B<MSR_IA32_TEMPERATURE_TARGET>
 +I<Thermal Control Circuit Activation Temperature> of the installed CPU. This
 +temperature is used when collecting the temperature of cores or packages. This
 +option should only be used if the automated detection fails. Default value
 +extracted from B<MSR_IA32_TEMPERATURE_TARGET>.
  
  =item B<RunningAveragePowerLimit> I<Bitmask(Integer)>
  
 -Bitmask of the list of elements to be thermally monitored. This option
 -should only be used if the automated detection fails or if you want to
 -disable some collections. The different bits of this bitmask accepted
 -by this plugin are:
 +Bit mask of the list of elements to be thermally monitored. This option should
 +only be used if the automated detection fails or if you want to disable some
 +collections. The different bits of this bit mask accepted by this plugin are:
  
  =over 4
  
  
  =back
  
 +=item B<LogicalCoreNames> I<true>|I<false>
 +
 +Boolean enabling the use of logical core numbering for per core statistics.
 +When enabled, C<cpuE<lt>nE<gt>> is used as plugin instance, where I<n> is a
 +sequential number assigned by the kernel. Otherwise, C<coreE<lt>nE<gt>> is used
 +where I<n> is the n-th core of the socket, causing name conflicts when there is
 +more than one socket.
 +
  =back
  
  =head2 Plugin C<unixsock>
@@@ -7926,49 -7665,6 +7928,49 @@@ Example
  Ignore all I<hdb> devices on any domain, but other block devices (eg. I<hda>)
  will be collected.
  
 +=item B<BlockDeviceFormat> B<target>|B<source>
 +
 +If I<BlockDeviceFormat> is set to B<target>, the default, then the device name
 +seen by the guest will be used for reporting metrics. 
 +This corresponds to the C<E<lt>targetE<gt>> node in the XML definition of the
 +domain.
 +
 +If I<BlockDeviceFormat> is set to B<source>, then metrics will be reported
 +using the path of the source, e.g. an image file.
 +This corresponds to the C<E<lt>sourceE<gt>> node in the XML definition of the
 +domain.
 +
 +B<Example:>
 +
 +If the domain XML have the following device defined:
 +
 +  <disk type='block' device='disk'>
 +    <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
 +    <source dev='/var/lib/libvirt/images/image1.qcow2'/>
 +    <target dev='sda' bus='scsi'/>
 +    <boot order='2'/>
 +    <address type='drive' controller='0' bus='0' target='0' unit='0'/>
 +  </disk>
 +
 +Setting C<BlockDeviceFormat target> will cause the I<type instance> to be set
 +to C<sda>.
 +Setting C<BlockDeviceFormat source> will cause the I<type instance> to be set
 +to C<var_lib_libvirt_images_image1.qcow2>.
 +
 +=item B<BlockDeviceFormatBasename> B<false>|B<true>
 +
 +The B<BlockDeviceFormatBasename> controls whether the full path or the
 +L<basename(1)> of the source is being used as the I<type instance> when
 +B<BlockDeviceFormat> is set to B<source>. Defaults to B<false>.
 +
 +B<Example:>
 +
 +Assume the device path (source tag) is C</var/lib/libvirt/images/image1.qcow2>.
 +Setting C<BlockDeviceFormatBasename false> will cause the I<type instance> to
 +be set to C<var_lib_libvirt_images_image1.qcow2>.
 +Setting C<BlockDeviceFormatBasename true> will cause the I<type instance> to be
 +set to C<image1.qcow2>.
 +
  =item B<HostnameFormat> B<name|uuid|hostname|...>
  
  When the virt plugin logs data, it sets the hostname of the collected data
@@@ -8135,38 -7831,6 +8137,38 @@@ If set to B<true>, append the name of t
  identifier. If set to B<false> (the default), this is only done when there is
  more than one DS.
  
 +=item B<PreserveSeparator> B<false>|B<true>
 +
 +If set to B<false> (the default) the C<.> (dot) character is replaced with
 +I<EscapeCharacter>. Otherwise, if set to B<true>, the C<.> (dot) character
 +is preserved, i.e. passed through.
 +
 +=item B<DropDuplicateFields> B<false>|B<true>
 +
 +If set to B<true>, detect and remove duplicate components in Graphite metric
 +names. For example, the metric name  C<host.load.load.shortterm> will
 +be shortened to C<host.load.shortterm>.
 +
 +=back
 +
 +=head2 Plugin C<write_log>
 +
 +The C<write_log> plugin writes metrics as INFO log messages.
 +
 +This plugin supports two output formats: I<Graphite> and I<JSON>.
 +
 +Synopsis:
 +
 + <Plugin write_log>
 +   Format Graphite
 + </Plugin>
 +
 +=over 4
 +
 +=item B<Format> I<Format>
 +
 +The output format to use. Can be one of C<Graphite> or C<JSON>.
 +
  =back
  
  =head2 Plugin C<write_tsdb>
@@@ -8275,41 -7939,6 +8277,41 @@@ want to use authentication all three fi
  
  =back
  
 +=head2 Plugin C<write_prometheus>
 +
 +The I<write_prometheus plugin> implements a tiny webserver that can be scraped
 +using I<Prometheus>.
 +
 +B<Options:>
 +
 +=over 4
 +
 +=item B<Port> I<Port>
 +
 +Port the embedded webserver should listen on. Defaults to B<9103>.
 +
 +=item B<StalenessDelta> I<Seconds>
 +
 +Time in seconds after which I<Prometheus> considers a metric "stale" if it
 +hasn't seen any update for it. This value must match the setting in Prometheus.
 +It defaults to B<300> seconds (5 minutes), same as Prometheus.
 +
 +B<Background:>
 +
 +I<Prometheus> has a global setting, C<StalenessDelta>, which controls after
 +which time a metric without updates is considered "stale". This setting
 +effectively puts an upper limit on the interval in which metrics are reported.
 +
 +When the I<write_prometheus plugin> encounters a metric with an interval
 +exceeding this limit, it will inform you, the user, and provide the metric to
 +I<Prometheus> B<without> a timestamp. That causes I<Prometheus> to consider the
 +metric "fresh" each time it is scraped, with the time of the scrape being
 +considered the time of the update. The result is that there appear more
 +datapoints in I<Prometheus> than were actually created, but at least the metric
 +doesn't disappear periodically.
 +
 +=back
 +
  =head2 Plugin C<write_http>
  
  This output plugin submits values to an HTTP server using POST requests and
@@@ -8543,18 -8172,6 +8545,18 @@@ path component, for example C<host.cpu.
  default), the plugin and plugin instance (and likewise the type and type
  instance) are put into one component, for example C<host.cpu-0.cpu-idle>.
  
 +=item B<GraphiteAlwaysAppendDS> B<true>|B<false>
 +
 +If set to B<true>, append the name of the I<Data Source> (DS) to the "metric"
 +identifier. If set to B<false> (the default), this is only done when there is
 +more than one DS.
 +
 +=item B<GraphitePreserveSeparator> B<false>|B<true>
 +
 +If set to B<false> (the default) the C<.> (dot) character is replaced with
 +I<GraphiteEscapeChar>. Otherwise, if set to B<true>, the C<.> (dot) character
 +is preserved, i.e. passed through.
 +
  =item B<StoreRates> B<true>|B<false>
  
  If set to B<true> (the default), convert counter values to rates. If set to
@@@ -9489,8 -9106,6 +9491,8 @@@ Available options
  
  =item B<TypeInstance> I<Regex>
  
 +=item B<MetaData> I<String> I<Regex>
 +
  Match values where the given regular expressions match the various fields of
  the identifier of a value. If multiple regular expressions are given, B<all>
  regexen must match for a value to match.
@@@ -9779,10 -9394,6 +9781,10 @@@ Available options
  
  =item B<TypeInstance> I<Regex> I<Replacement>
  
 +=item B<MetaData> I<String> I<Regex> I<Replacement>
 +
 +=item B<DeleteMetaData> I<String> I<Regex>
 +
  Match the appropriate field with the given regular expression I<Regex>. If the
  regular expression matches, that part that matches is replaced with
  I<Replacement>. If multiple places of the input buffer match a given regular
@@@ -9821,37 -9432,9 +9823,37 @@@ Available options
  
  =item B<MetaData> I<String> I<String>
  
 -Set the appropriate field to the given string. The strings for plugin instance
 -and type instance may be empty, the strings for host and plugin may not be
 -empty. It's currently not possible to set the type of a value this way.
 +Set the appropriate field to the given string. The strings for plugin instance,
 +type instance, and meta data may be empty, the strings for host and plugin may
 +not be empty. It's currently not possible to set the type of a value this way.
 +
 +The following placeholders will be replaced by an appropriate value:
 +
 +=over 4
 +
 +=item B<%{host}>
 +
 +=item B<%{plugin}>
 +
 +=item B<%{plugin_instance}>
 +
 +=item B<%{type}>
 +
 +=item B<%{type_instance}>
 +
 +These placeholders are replaced by the identifier field of the same name.
 +
 +=item B<%{meta:>I<name>B<}>
 +
 +These placeholders are replaced by the meta data value with the given name.
 +
 +=back
 +
 +Please note that these placeholders are B<case sensitive>!
 +
 +=item B<DeleteMetaData> I<String>
 +
 +Delete the named meta data field.
  
  =back
  
diff --combined src/memcached.c
  
  struct memcached_s {
    char *name;
 -  char *socket;
    char *host;
 -  char *port;
 +  char *socket;
 +  char *connhost;
 +  char *connport;
  };
  typedef struct memcached_s memcached_t;
  
@@@ -58,10 -57,9 +58,10 @@@ static void memcached_free(void *arg) 
      return;
  
    sfree(st->name);
 -  sfree(st->socket);
    sfree(st->host);
 -  sfree(st->port);
 +  sfree(st->socket);
 +  sfree(st->connhost);
 +  sfree(st->connport);
    sfree(st);
  }
  
@@@ -93,20 -91,26 +93,20 @@@ static int memcached_connect_unix(memca
  } /* int memcached_connect_unix */
  
  static int memcached_connect_inet(memcached_t *st) {
 -  const char *host;
 -  const char *port;
 -
    struct addrinfo *ai_list;
    int status;
    int fd = -1;
  
 -  host = (st->host != NULL) ? st->host : MEMCACHED_DEF_HOST;
 -  port = (st->port != NULL) ? st->port : MEMCACHED_DEF_PORT;
 -
    struct addrinfo ai_hints = {.ai_family = AF_UNSPEC,
                                .ai_flags = AI_ADDRCONFIG,
                                .ai_socktype = SOCK_STREAM};
  
 -  status = getaddrinfo(host, port, &ai_hints, &ai_list);
 +  status = getaddrinfo(st->connhost, st->connport, &ai_hints, &ai_list);
    if (status != 0) {
      char errbuf[1024];
      ERROR("memcached plugin: memcached_connect_inet: "
            "getaddrinfo(%s,%s) failed: %s",
 -          host, port,
 +          st->connhost, st->connport,
            (status == EAI_SYSTEM) ? sstrerror(errno, errbuf, sizeof(errbuf))
                                   : gai_strerror(status));
      return (-1);
@@@ -216,19 -220,33 +216,19 @@@ static int memcached_query_daemon(char 
  } /* int memcached_query_daemon */
  
  static void memcached_init_vl(value_list_t *vl, memcached_t const *st) {
 -  char const *host = st->host;
 -
 -  /* Set vl->host to hostname_g, if:
 -   * - Legacy mode is used.
 -   * - "Socket" option is given (doc: "Host option is ignored").
 -   * - "Host" option is not provided.
 -   * - "Host" option is set to "localhost" or "127.0.0.1". */
 -  if ((strcmp(st->name, "__legacy__") == 0) || (st->socket != NULL) ||
 -      (st->host == NULL) || (strcmp("127.0.0.1", st->host) == 0) ||
 -      (strcmp("localhost", st->host) == 0))
 -    host = hostname_g;
 -
    sstrncpy(vl->plugin, "memcached", sizeof(vl->plugin));
 -  sstrncpy(vl->host, host, sizeof(vl->host));
 -  if (strcmp(st->name, "__legacy__") != 0)
 +  if (st->host != NULL)
 +    sstrncpy(vl->host, st->host, sizeof(vl->host));
 +  if (st->name != NULL)
      sstrncpy(vl->plugin_instance, st->name, sizeof(vl->plugin_instance));
  }
  
  static void submit_derive(const char *type, const char *type_inst,
                            derive_t value, memcached_t *st) {
 -  value_t values[1];
    value_list_t vl = VALUE_LIST_INIT;
 -  memcached_init_vl(&vl, st);
 -
 -  values[0].derive = value;
  
 -  vl.values = values;
 +  memcached_init_vl(&vl, st);
 +  vl.values = &(value_t){.derive = value};
    vl.values_len = 1;
    sstrncpy(vl.type, type, sizeof(vl.type));
    if (type_inst != NULL)
  
  static void submit_derive2(const char *type, const char *type_inst,
                             derive_t value0, derive_t value1, memcached_t *st) {
 -  value_t values[2];
    value_list_t vl = VALUE_LIST_INIT;
 -  memcached_init_vl(&vl, st);
 -
 -  values[0].derive = value0;
 -  values[1].derive = value1;
 +  value_t values[] = {
 +      {.derive = value0}, {.derive = value1},
 +  };
  
 +  memcached_init_vl(&vl, st);
    vl.values = values;
 -  vl.values_len = 2;
 +  vl.values_len = STATIC_ARRAY_SIZE(values);
    sstrncpy(vl.type, type, sizeof(vl.type));
    if (type_inst != NULL)
      sstrncpy(vl.type_instance, type_inst, sizeof(vl.type_instance));
  
  static void submit_gauge(const char *type, const char *type_inst, gauge_t value,
                           memcached_t *st) {
 -  value_t values[1];
    value_list_t vl = VALUE_LIST_INIT;
 -  memcached_init_vl(&vl, st);
  
 -  values[0].gauge = value;
 -
 -  vl.values = values;
 +  memcached_init_vl(&vl, st);
 +  vl.values = &(value_t){.gauge = value};
    vl.values_len = 1;
    sstrncpy(vl.type, type, sizeof(vl.type));
    if (type_inst != NULL)
  
  static void submit_gauge2(const char *type, const char *type_inst,
                            gauge_t value0, gauge_t value1, memcached_t *st) {
 -  value_t values[2];
    value_list_t vl = VALUE_LIST_INIT;
 -  memcached_init_vl(&vl, st);
 -
 -  values[0].gauge = value0;
 -  values[1].gauge = value1;
 +  value_t values[] = {
 +      {.gauge = value0}, {.gauge = value1},
 +  };
  
 +  memcached_init_vl(&vl, st);
    vl.values = values;
 -  vl.values_len = 2;
 +  vl.values_len = STATIC_ARRAY_SIZE(values);
    sstrncpy(vl.type, type, sizeof(vl.type));
    if (type_inst != NULL)
      sstrncpy(vl.type_instance, type_inst, sizeof(vl.type_instance));
@@@ -341,9 -364,10 +341,10 @@@ static int memcached_read(user_data_t *
       * CPU time consumed by the memcached process
       */
      if (FIELD_IS("rusage_user")) {
-       rusage_user = atoll(fields[2]);
+       /* Convert to useconds */
+       rusage_user = atof(fields[2]) * 1000000;
      } else if (FIELD_IS("rusage_system")) {
-       rusage_syst = atoll(fields[2]);
+       rusage_syst = atof(fields[2]) * 1000000;
      }
  
      /*
@@@ -471,53 -495,16 +472,53 @@@ static int memcached_add_read_callback(
    char callback_name[3 * DATA_MAX_NAME_LEN];
    int status;
  
 -  assert(st->name != NULL);
 -  ssnprintf(callback_name, sizeof(callback_name), "memcached/%s", st->name);
 +  ssnprintf(callback_name, sizeof(callback_name), "memcached/%s",
 +            (st->name != NULL) ? st->name : "__legacy__");
 +
 +  /* If no <Address> used then:
 +   * - Connect to the destination specified by <Host>, if present.
 +   *   If not, use the default address.
 +   * - Use the default hostname (set st->host to NULL), if
 +   *    - Legacy mode is used (no configuration options at all), or
 +   *    - "Host" option is not provided, or
 +   *    - "Host" option is set to "localhost" or "127.0.0.1".
 +   *
 +   * If <Address> used then host may be set to "localhost" or "127.0.0.1"
 +   * explicitly.
 +   */
 +  if (st->connhost == NULL) {
 +    if (st->host) {
 +      st->connhost = strdup(st->host);
 +      if (st->connhost == NULL)
 +        return (ENOMEM);
 +
 +      if ((strcmp("127.0.0.1", st->host) == 0) ||
 +          (strcmp("localhost", st->host) == 0))
 +        sfree(st->host);
 +    } else {
 +      st->connhost = strdup(MEMCACHED_DEF_HOST);
 +      if (st->connhost == NULL)
 +        return (ENOMEM);
 +    }
 +  }
 +
 +  if (st->connport == NULL) {
 +    st->connport = strdup(MEMCACHED_DEF_PORT);
 +    if (st->connport == NULL)
 +      return (ENOMEM);
 +  }
 +
 +  assert(st->connhost != NULL);
 +  assert(st->connport != NULL);
  
 -  user_data_t ud = {.data = st, .free_func = memcached_free};
 +  status = plugin_register_complex_read(
 +      /* group = */ "memcached",
 +      /* name      = */ callback_name,
 +      /* callback  = */ memcached_read,
 +      /* interval  = */ 0, &(user_data_t){
 +                               .data = st, .free_func = memcached_free,
 +                           });
  
 -  status = plugin_register_complex_read(/* group = */ "memcached",
 -                                        /* name      = */ callback_name,
 -                                        /* callback  = */ memcached_read,
 -                                        /* interval  = */ 0,
 -                                        /* user_data = */ &ud);
    return (status);
  } /* int memcached_add_read_callback */
  
   * <Plugin memcached>
   *   <Instance "instance_name">
   *     Host foo.zomg.com
 + *     Address 1.2.3.4
   *     Port "1234"
   *   </Instance>
   * </Plugin>
@@@ -540,22 -526,23 +541,22 @@@ static int config_add_instance(oconfig_
    st = calloc(1, sizeof(*st));
    if (st == NULL) {
      ERROR("memcached plugin: calloc failed.");
 -    return (-1);
 +    return (ENOMEM);
    }
  
    st->name = NULL;
 -  st->socket = NULL;
    st->host = NULL;
 -  st->port = NULL;
 +  st->socket = NULL;
 +  st->connhost = NULL;
 +  st->connport = NULL;
  
 -  if (strcasecmp(ci->key, "Plugin") == 0) /* default instance */
 -    st->name = sstrdup("__legacy__");
 -  else /* <Instance /> block */
 +  if (strcasecmp(ci->key, "Instance") == 0)
      status = cf_util_get_string(ci, &st->name);
 +
    if (status != 0) {
      sfree(st);
      return (status);
    }
 -  assert(st->name != NULL);
  
    for (int i = 0; i < ci->children_num; i++) {
      oconfig_item_t *child = ci->children + i;
        status = cf_util_get_string(child, &st->socket);
      else if (strcasecmp("Host", child->key) == 0)
        status = cf_util_get_string(child, &st->host);
 +    else if (strcasecmp("Address", child->key) == 0)
 +      status = cf_util_get_string(child, &st->connhost);
      else if (strcasecmp("Port", child->key) == 0)
 -      status = cf_util_get_service(child, &st->port);
 +      status = cf_util_get_service(child, &st->connport);
      else {
        WARNING("memcached plugin: Option `%s' not allowed here.", child->key);
        status = -1;
@@@ -624,11 -609,10 +625,11 @@@ static int memcached_init(void) 
    st = calloc(1, sizeof(*st));
    if (st == NULL)
      return (ENOMEM);
 -  st->name = sstrdup("__legacy__");
 -  st->socket = NULL;
 +  st->name = NULL;
    st->host = NULL;
 -  st->port = NULL;
 +  st->socket = NULL;
 +  st->connhost = NULL;
 +  st->connport = NULL;
  
    status = memcached_add_read_callback(st);
    if (status == 0)