Difference between revisions of "Plugin:Write HTTP"

From collectd Wiki
Jump to: navigation, search
m (JSON Example: Missing quote)
(Undo revision 3302 by (Talk))
Line 110: Line 110:
* [http://github.com/gleicon/restmq/blob/master/README.collectd README.collectd]
* [http://github.com/gleicon/restmq/blob/master/README.collectd README.collectd]
It's spooky how clever some ppl are. Tahnks!
== Dependencies ==
* [http://curl.haxx.se/libcurl/ libcurl]
== See also ==
== See also ==

Revision as of 18:59, 21 December 2013

Write HTTP plugin
Type: write
Callbacks: config, flush, write
Status: supported
First version: 4.8
Copyright: 2009 Paul Sadauskas
2009 Doug MacEachern
2007–2009 Florian octo Forster
License: GPLv2
Manpage: collectd.conf(5)
List of Plugins

The Write HTTP plugin sends the values collected by collectd to a web-server using HTTP POST requests. The data is formatted as PUTVAL commands, see plain text protocol.

In order to improve performance the plugin fills a 4 kByte buffer as full as possible and sends multiple lines at once.


<Plugin "write_http">
  <URL "http://example.com/post-collectd">
    User "collectd"
    Password "weCh3ik0"

Example data

The data transmitted to the web-server has the following form:

Command format

PUTVAL leeloo.lan.home.verplant.org/disk-sda/disk_octets interval=10 1251533299:197141504:175136768
PUTVAL leeloo.lan.home.verplant.org/disk-sda/disk_ops interval=10 1251533299:10765:12858
PUTVAL leeloo.lan.home.verplant.org/disk-sda/disk_time interval=10 1251533299:5:140
PUTVAL leeloo.lan.home.verplant.org/disk-sda/disk_merged interval=10 1251533299:4658:29899

JSON format

     "values": [197141504, 175136768],
     "dstypes": ["counter", "counter"],
     "dsnames": ["read", "write"],
     "time": 1251533299,
     "interval": 10,
     "host": "leeloo.lan.home.verplant.org",
     "plugin": "disk",
     "plugin_instance": "sda",
     "type": "disk_octets",
     "type_instance": ""


You can use RestMQ with the collectd "entry point" to consume the data sent by the Write HTTP plugin. RestMQ is a message queue based on Redis which provides a RESTful interface. It includes a special "entry point" which parses the PUTVAL command data and emits the data in a specialized JSON format, it also accepts the JSON produced by the collectd daemon.

Plain Text Protocol Example

You need to set the Format option to "Command" (the default) in order to work with this module:


<Plugin "write_http">
  <URL "http://restmq.example.com/collectd/data">
    Format "Command"
    #User "collectd"
    #Password "weCh3ik0"

Example JSON

   "host": "collectd_restmq_server",
   "type_instance": "df-boot",
   "plugin_instance": "df",
   "value": "1288548767:116497408.000000:391246848.000000",
   "interval": "10"

JSON Example

You need to set the Format option to "JSON" in order to work with this module:


<Plugin "write_http">
  <URL "http://restmq.example.com/collectd/data">
    Format "JSON"
    #User "collectd"
    #Password "weCh3ik0"

Example JSON

   "values": [1.16497e+08,3.91247e+08],



See also