Skip to content

write_tsdb plugin

Plugin name write_tsdb
Type write
Callbacks init, config, write
Since 4.9
Copyright 2014 David Schmitt
License GPLv3
Configuration collectd.conf(5)

The OpenTSDB plugin translates and queues collectd metrics to an OpenTSDB instance.

The translation is done in python code and can easily be extended or modified to fit local requirements.

Synopsis

 ModulePath "/path/to/installed/tsdb.py"
 Import "tsdb"
 <Module tsdb>
   server "opentsdb server name"
   port   "https port of opentsdb server"
   ca     "ca file"
   cert   "local certificate"
   key    "local private key"
   tag    "host" "my host name"
   tag    "dc"   "my datacenter"
 </Module>

This will register a writer using the specified SSL certificates. It adds additional tags to each event for filtering on the OpenTSDB side.

See also

Configuration

Configuration options · from collectd.conf(5)

See this section in the full configuration reference

The write_tsdb plugin writes data to OpenTSDB, a scalable open-source time series database. The plugin connects to a TSD, a masterless, no shared state daemon that ingests metrics and stores them in HBase. The plugin uses TCP over the "line based" protocol with a default port 4242. The data will be sent in blocks of at most 1428 bytes to minimize the number of network packets.

Synopsis:

<Plugin write_tsdb>
  ResolveInterval 60
  ResolveJitter 60
  <Node "example">
    Host "tsd-1.my.domain"
    Port "4242"
    HostTags "status=production"
  </Node>
</Plugin>

The configuration consists of one or more <Node Name> blocks and global directives.

Global directives are:

ResolveInterval seconds
ResolveJitter seconds

When collectd connects to a TSDB node, it will request the hostname from DNS. This can become a problem if the TSDB node is unavailable or badly configured because collectd will request DNS in order to reconnect for every metric, which can flood your DNS. So you can cache the last value for ResolveInterval seconds. Defaults to the Interval of the write_tsdb plugin, e.g. 10E<nbsp>seconds.

You can also define a jitter, a random interval to wait in addition to ResolveInterval. This prevents all your collectd servers to resolve the hostname at the same time when the connection fails. Defaults to the Interval of the write_tsdb plugin, e.g. 10E<nbsp>seconds.

Note: If the DNS resolution has already been successful when the socket closes, the plugin will try to reconnect immediately with the cached information. DNS is queried only when the socket is closed for a longer than ResolveInterval + ResolveJitter seconds.

Inside the Node blocks, the following options are recognized:

Host Address
Hostname or address to connect to. Defaults to localhost.
Port Service
Service name or port number to connect to. Defaults to 4242.
HostTags String
When set, HostTags is added to the end of the metric. It is intended to be used for name=value pairs that the TSD will tag the metric with. Dots and whitespace are not escaped in this string.
StoreRates false|true
If set to true, convert counter values to rates. If set to false (the default) counter values are stored as is, as an increasing integer number.
AlwaysAppendDS false|true
If set the true, append the name of the Data Source (DS) to the "metric" identifier. If set to false (the default), this is only done when there is more than one DS.