Skip to content

write_prometheus plugin

Plugin name write_prometheus
Type write
Callbacks config, init, write, shutdown
Status supported
Since 5.7
Copyright 2016 Florian octo Forster
License MIT License
Configuration collectd.conf(5)

The Write Prometheus plugin starts an internal webserver on port 9103 (configurable) and accepts scrape requests from Prometheus, an open-source monitoring system. This plugin is similar in scope to the collectd_exporter written by the Prometheus team and uses the same naming schema so it can be used as a drop-in alternative.

Synopsis

 LoadPlugin write_prometheus

 <Plugin "write_prometheus">
   Port "9103"
 </Plugin>

Dependencies

See also

Configuration

Configuration options · from collectd.conf(5)

See this section in the full configuration reference

The write_prometheus plugin implements a tiny webserver that can be scraped using Prometheus.

Options:

Host Host

Bind to the hostname / address Host. By default, the plugin will bind to the "any" address, i.e. accept packets sent to any of the hosts addresses.

This option is supported only for libmicrohttpd newer than 0.9.0.

Port Port
Port the embedded webserver should listen on. Defaults to 9103.
StalenessDelta Seconds

Time in seconds after which 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 300 seconds (5 minutes), same as Prometheus.

Background:

Prometheus has a global setting, 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 write_prometheus plugin encounters a metric with an interval exceeding this limit, it will inform you, the user, and provide the metric to Prometheus without a timestamp. That causes 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 Prometheus than were actually created, but at least the metric doesn't disappear periodically.