Merge remote-tracking branch 'github/pr/1124'
authorFlorian Forster <octo@collectd.org>
Tue, 14 Jul 2015 06:19:38 +0000 (08:19 +0200)
committerFlorian Forster <octo@collectd.org>
Tue, 14 Jul 2015 06:19:38 +0000 (08:19 +0200)
1  2 
src/Makefile.am
src/collectd.conf.in
src/collectd.conf.pod

diff --combined src/Makefile.am
@@@ -27,13 -27,6 +27,13 @@@ noinst_LTLIBRARIES 
  check_PROGRAMS =
  TESTS =
  
 +noinst_LTLIBRARIES += liblatency.la
 +liblatency_la_SOURCES = utils_latency.c utils_latency.h
 +check_PROGRAMS += test_utils_latency
 +TESTS += test_utils_latency
 +test_utils_latency_SOURCES = utils_latency_test.c testing.h
 +test_utils_latency_LDADD = liblatency.la daemon/libcommon.la daemon/libplugin_mock.la -lm
 +
  noinst_LTLIBRARIES += liblookup.la
  liblookup_la_SOURCES = utils_vl_lookup.c utils_vl_lookup.h
  liblookup_la_LIBADD = daemon/libavltree.la
@@@ -644,6 -637,14 +644,14 @@@ modbus_la_CFLAGS = $(AM_CFLAGS) $(BUILD
  modbus_la_LIBADD = $(BUILD_WITH_LIBMODBUS_LIBS)
  endif
  
+ if BUILD_PLUGIN_MQTT
+ pkglib_LTLIBRARIES += mqtt.la
+ mqtt_la_SOURCES = mqtt.c
+ mqtt_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+ mqtt_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBMOSQUITTO_CPPFLAGS)
+ mqtt_la_LIBADD = $(BUILD_WITH_LIBMOSQUITTO_LIBS)
+ endif
  if BUILD_PLUGIN_MULTIMETER
  pkglib_LTLIBRARIES += multimeter.la
  multimeter_la_SOURCES = multimeter.c
@@@ -973,9 -974,10 +981,9 @@@ endi
  
  if BUILD_PLUGIN_STATSD
  pkglib_LTLIBRARIES += statsd.la
 -statsd_la_SOURCES = statsd.c \
 -                    utils_latency.h utils_latency.c
 +statsd_la_SOURCES = statsd.c
  statsd_la_LDFLAGS = $(PLUGIN_LDFLAGS)
 -statsd_la_LIBADD = -lpthread -lm
 +statsd_la_LIBADD = liblatency.la -lpthread -lm
  endif
  
  if BUILD_PLUGIN_SWAP
diff --combined src/collectd.conf.in
@@@ -99,9 -99,9 +99,9 @@@
  #@BUILD_PLUGIN_BATTERY_TRUE@LoadPlugin battery
  #@BUILD_PLUGIN_BIND_TRUE@LoadPlugin bind
  #@BUILD_PLUGIN_CEPH_TRUE@LoadPlugin ceph
 +#@BUILD_PLUGIN_CGROUPS_TRUE@LoadPlugin cgroups
  #@BUILD_PLUGIN_CONNTRACK_TRUE@LoadPlugin conntrack
  #@BUILD_PLUGIN_CONTEXTSWITCH_TRUE@LoadPlugin contextswitch
 -#@BUILD_PLUGIN_CGROUPS_TRUE@LoadPlugin cgroups
  @BUILD_PLUGIN_CPU_TRUE@@BUILD_PLUGIN_CPU_TRUE@LoadPlugin cpu
  #@BUILD_PLUGIN_CPUFREQ_TRUE@LoadPlugin cpufreq
  @LOAD_PLUGIN_CSV@LoadPlugin csv
  #@BUILD_PLUGIN_HDDTEMP_TRUE@LoadPlugin hddtemp
  @BUILD_PLUGIN_INTERFACE_TRUE@@BUILD_PLUGIN_INTERFACE_TRUE@LoadPlugin interface
  #@BUILD_PLUGIN_IPC_TRUE@@BUILD_PLUGIN_IPC_TRUE@LoadPlugin ipc
 -#@BUILD_PLUGIN_IPTABLES_TRUE@LoadPlugin iptables
  #@BUILD_PLUGIN_IPMI_TRUE@LoadPlugin ipmi
 +#@BUILD_PLUGIN_IPTABLES_TRUE@LoadPlugin iptables
  #@BUILD_PLUGIN_IPVS_TRUE@LoadPlugin ipvs
  #@BUILD_PLUGIN_IRQ_TRUE@LoadPlugin irq
  #@BUILD_PLUGIN_JAVA_TRUE@LoadPlugin java
  #@BUILD_PLUGIN_MEMCACHEC_TRUE@LoadPlugin memcachec
  #@BUILD_PLUGIN_MEMCACHED_TRUE@LoadPlugin memcached
  @BUILD_PLUGIN_MEMORY_TRUE@@BUILD_PLUGIN_MEMORY_TRUE@LoadPlugin memory
 +#@BUILD_PLUGIN_MIC_TRUE@LoadPlugin mic
  #@BUILD_PLUGIN_MODBUS_TRUE@LoadPlugin modbus
+ #@BUILD_PLUGIN_MQTT_TRUE@LoadPlugin mqtt
  #@BUILD_PLUGIN_MULTIMETER_TRUE@LoadPlugin multimeter
  #@BUILD_PLUGIN_MYSQL_TRUE@LoadPlugin mysql
  #@BUILD_PLUGIN_NETAPP_TRUE@LoadPlugin netapp
  #@BUILD_PLUGIN_USERS_TRUE@LoadPlugin users
  #@BUILD_PLUGIN_UUID_TRUE@LoadPlugin uuid
  #@BUILD_PLUGIN_VARNISH_TRUE@LoadPlugin varnish
 -#@BUILD_PLUGIN_MIC_TRUE@LoadPlugin mic
  #@BUILD_PLUGIN_VIRT_TRUE@LoadPlugin virt
  #@BUILD_PLUGIN_VMEM_TRUE@LoadPlugin vmem
  #@BUILD_PLUGIN_VSERVER_TRUE@LoadPlugin vserver
  #     </Host>
  #</Plugin>
  
+ #<Plugin mqtt>
+ #     <Publish "name">
+ #             Host "localhost"
+ #             Port 1883
+ #             ClientId "localhost"
+ #             User "user"
+ #             Password "secret"
+ #             QoS 0
+ #             Prefix "collectd"
+ #             StoreRates true
+ #             Retain false
+ #     </Publish>
+ #     <Subscribe "name">
+ #             Host "localhost"
+ #             Port 1883
+ #             ClientId "localhost"
+ #             User "user"
+ #             Password "secret"
+ #             QoS 2
+ #             Topic "collectd/#"
+ #             CleanSession true
+ #     </Subscribe>
+ #</Plugin>
  #<Plugin mysql>
  #     <Database db_name>
  #             Host "database.serv.er"
diff --combined src/collectd.conf.pod
@@@ -513,7 -513,9 +513,9 @@@ are disabled by default
  The I<AMQMP plugin> can be used to communicate with other instances of
  I<collectd> or third party applications using an AMQP message broker. Values
  are sent to or received from the broker, which handles routing, queueing and
- possibly filtering or messages.
+ possibly filtering out messages.
+ B<Synopsis:>
  
   <Plugin "amqp">
     # Send values to an AMQP broker
@@@ -3233,6 -3235,114 +3235,114 @@@ B<Collect> option is mandatory
  
  =back
  
+ =head2 Plugin C<mqtt>
+ The I<MQTT plugin> can send metrics to MQTT (B<Publish> blocks) and receive
+ values from MQTT (B<Subscribe> blocks).
+ B<Synopsis:>
+  <Plugin mqtt>
+    <Publish "name">
+      Host "mqtt.example.com"
+      Prefix "collectd"
+    </Publish>
+    <Subscribe "name">
+      Host "mqtt.example.com"
+      Topic "collectd/#"
+    </Subscribe>
+  </Plugin>
+ The plugin's configuration is in B<Publish> and/or B<Subscribe> blocks,
+ configuring the sending and receiving direction respectively. The plugin will
+ register a write callback named C<mqtt/I<name>> where I<name> is the string
+ argument given to the B<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.
+ B<Options:>
+ =over 4
+ =item B<Host> I<Hostname>
+ Hostname of the MQTT broker to connect to.
+ =item B<Port> I<Service>
+ Port number or service name of the MQTT broker to connect to.
+ =item B<User> I<UserName>
+ Username used when authenticating to the MQTT broker.
+ =item B<Password> I<Password>
+ Password used when authenticating to the MQTT broker.
+ =item B<ClientId> I<ClientId>
+ MQTT client ID to use. Defaults to the hostname used by I<collectd>.
+ =item B<QoS> [B<0>-B<2>]
+ Sets the I<Quality of Service>, with the values C<0>, C<1> and C<2> meaning:
+ =over 4
+ =item B<0>
+ At most once
+ =item B<1>
+ At least once
+ =item B<2>
+ Exactly once
+ =back
+ In B<Publish> blocks, this option determines the QoS flag set on outgoing
+ messages and defaults to B<0>. In B<Subscribe> blocks, determines the maximum
+ QoS setting the client is going to accept and defaults to B<2>. If the QoS flag
+ on a message is larger than the maximum accepted QoS of a subscriber, the
+ message's QoS will be downgraded.
+ =item B<Prefix> I<Prefix> (Publish only)
+ This plugin will use one topic per I<value list> which will looks like a path.
+ I<Prefix> is used as the first path element and defaults to B<collectd>.
+ An example topic name would be:
+  collectd/cpu-0/cpu-user
+ =item B<Retain> B<false>|B<true> (Publish only)
+ Controls whether the MQTT broker will retain (keep a copy of) the last message
+ sent to each topic and deliver it to new subscribers. Defaults to B<false>.
+ =item B<StoreRates> B<true>|B<false> (Publish only)
+ Controls whether C<DERIVE> and C<COUNTER> metrics are converted to a I<rate>
+ before sending. Defaults to B<true>.
+ =item B<CleanSession> B<true>|B<false> (Subscribe only)
+ Controls whether the MQTT "cleans" the session up after the subscriber
+ disconnects or if it maintains the subscriber's subscriptions and all messages
+ that arrive while the subscriber is disconnected. Defaults to B<true>.
+ =item B<Topic> I<TopicName> (Subscribe only)
+ Configures the topic(s) to subscribe to. You can use the single level C<+> and
+ multi level C<#> wildcards. Defaults to B<collectd/#>, i.e. all topics beneath
+ the B<collectd> branch.
+ =back
  =head2 Plugin C<mysql>
  
  The C<mysql plugin> requires B<mysqlclient> to be installed. It connects to
@@@ -7495,7 -7605,6 +7605,7 @@@ Synopsis
          Port "6379"
          Timeout 1000
          Prefix "collectd/"
 +        Database 1
      </Node>
    </Plugin>
  
@@@ -7504,8 -7613,7 +7614,8 @@@ the timestamp as the score. Retrieving 
  C<ZRANGEBYSCORE> I<Redis> command. Additionnally, all the identifiers of these
  I<Sorted Sets> are kept in a I<Set> called C<collectd/values> (or
  C<${prefix}/values> if the B<Prefix> option was specified) and can be retrieved
 -using the C<SMEMBERS> I<Redis> command. See
 +using the C<SMEMBERS> I<Redis> command. You can specify the database to use 
 +with the B<Database> parameter (default is C<0>). See
  L<http://redis.io/commands#sorted_set> and L<http://redis.io/commands#set> for
  details.
  
@@@ -7547,10 -7655,6 +7657,10 @@@ containing all metrics. Defaults to C<c
  like C<collectd/cpu-0/cpu-user>. When setting this to something different, it
  is recommended but not required to include a trailing slash in I<Prefix>.
  
 +=item B<Database> I<Index>
 +
 +This index selects the redis database to use for writing operations. Defaults to C<0>.
 +
  =back
  
  =head2 Plugin C<write_riemann>