From collectd Wiki
Revision as of 11:19, 8 September 2015 by Njh (talk | contribs) (Synopsis)

Jump to: navigation, search
MQTT plugin
Type: read, write
Callbacks: config, init, write
Status: supported
First version: 5.6
Copyright: 2014-2015 Florian octo Forster
2014 Marc Falzon
License: MIT license
Manpage: collectd.conf(5)
List of Plugins

The MQTT plugin transmits or receives values collected by collectd via the MQTT protocol. MQTT is a "light weight" publish-subscribe messaging protocol for use on top of the TCP/IP protocol. Data is sent to or received from a MQTT Server, also known as a message broker. The values are encoded and parsed in the plain text protocol. It is possible to use three different levels of Quality of Service (QoS), which offer different levels of assurance that the message will be delivered.


<Plugin "mqtt">
  # Send values to an MQTT server
  <Publish "some_name">
    Host "localhost"
#   Port "1883"
#   User "mqttuser"
#   Password "password"
#   ClientId "collectd-hostname"
#   QoS 0
#   Prefix "collectd"
#   Retain true
#   StoreRates false
  # Receive values from an MQTT server
  <Subscribe "some_name">
    Host "localhost"
#   Port "1883"
#   User "mqttuser"
#   Password "password"
#   ClientId "collectd-hostname"
#   QoS 0
#   CleanSession false
#   Topic "subscribetopic"

The plugin's configuration is in Publish and/or Subscribe blocks, configuring the sending and receiving direction respectively. The plugin will register a write callback named "mqtt/name" where name is the string argument given to the Publish block. Both types of blocks share many but not all of the following options. If an option is valid in only one of the blocks, it will be mentioned explicitly.


See also