Merge branch 'pyr/riemann'
authorFlorian Forster <octo@collectd.org>
Mon, 21 Jan 2013 10:10:55 +0000 (11:10 +0100)
committerFlorian Forster <octo@collectd.org>
Mon, 21 Jan 2013 10:10:58 +0000 (11:10 +0100)
Resolves Github issue #221.

1  2 
configure.in
src/Makefile.am
src/collectd.conf.in
src/collectd.conf.pod

diff --combined configure.in
@@@ -270,19 -270,7 +270,19 @@@ if test "x$ac_system" = "xDarwin
  then
        AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
        AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
 +      # For the battery plugin
 +      AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
 +[
 +#if HAVE_IOKIT_IOKITLIB_H
 +#  include <IOKit/IOKitLib.h>
 +#endif
 +#if HAVE_IOKIT_IOTYPES_H
 +#  include <IOKit/IOTypes.h>
 +#endif
 +])
 +
  fi
 +
  AC_CHECK_HEADERS(sys/sysctl.h, [], [],
  [
  #if HAVE_SYS_TYPES_H
@@@ -327,6 -315,17 +327,6 @@@ els
        have_linux_raid_md_u_h="no"
  fi
  
 -# For the battery plugin
 -AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
 -[
 -#if HAVE_IOKIT_IOKITLIB_H
 -#  include <IOKit/IOKitLib.h>
 -#endif
 -#if HAVE_IOKIT_IOTYPES_H
 -#  include <IOKit/IOTypes.h>
 -#endif
 -])
 -
  # For the swap module
  have_linux_wireless_h="no"
  if test "x$ac_system" = "xLinux"
@@@ -4965,8 -4964,9 +4965,9 @@@ AC_PLUGIN([vserver],     [$plugin_vserv
  AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
  AC_PLUGIN([write_graphite], [yes],             [Graphite / Carbon output plugin])
  AC_PLUGIN([write_http],  [$with_libcurl],      [HTTP output plugin])
- AC_PLUGIN([write_redis], [$with_libcredis],    [Redis output plugin])
  AC_PLUGIN([write_mongodb], [$with_libmongoc],  [MongoDB output plugin])
+ AC_PLUGIN([write_redis], [$with_libcredis],    [Redis output plugin])
+ AC_PLUGIN([write_riemann], [$have_protoc_c],   [Riemann output plugin])
  AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
  AC_PLUGIN([zfs_arc],     [$plugin_zfs_arc],    [ZFS ARC statistics])
  
@@@ -5298,8 -5298,9 +5299,9 @@@ Configuration
      wireless  . . . . . . $enable_wireless
      write_graphite  . . . $enable_write_graphite
      write_http  . . . . . $enable_write_http
-     write_redis . . . . . $enable_write_redis
      write_mongodb . . . . $enable_write_mongodb
+     write_redis . . . . . $enable_write_redis
+     write_riemann . . . . $enable_write_riemann
      xmms  . . . . . . . . $enable_xmms
      zfs_arc . . . . . . . $enable_zfs_arc
  
diff --combined src/Makefile.am
@@@ -119,9 -119,6 +119,9 @@@ collectd_tg_LDADD 
  if BUILD_WITH_LIBSOCKET
  collectd_tg_LDADD += -lsocket
  endif
 +if BUILD_WITH_LIBRT
 +collectd_tg_LDADD += -lrt
 +endif
  if BUILD_AIX
  collectd_tg_LDADD += -lm
  endif
@@@ -1339,6 -1336,17 +1339,17 @@@ collectd_LDADD += "-dlopen" write_redis
  collectd_DEPENDENCIES += write_redis.la
  endif
  
+ if BUILD_PLUGIN_WRITE_RIEMANN
+ BUILT_SOURCES += riemann.pb-c.c riemann.pb-c.h
+ CLEANFILES += riemann.pb-c.c riemann.pb-c.h
+ pkglib_LTLIBRARIES += write_riemann.la
+ write_riemann_la_SOURCES = write_riemann.c riemann.pb-c.c
+ write_riemann_la_LDFLAGS = -module -avoid-version
+ write_riemann_la_LIBADD = -lprotobuf-c
+ collectd_LDADD += "-dlopen" write_riemann.la
+ collectd_DEPENDENCIES += write_riemann.la
+ endif
  if BUILD_PLUGIN_XMMS
  pkglib_LTLIBRARIES += xmms.la
  xmms_la_SOURCES = xmms.c
@@@ -1372,14 -1380,13 +1383,14 @@@ dist_man_MANS = collectd.1 
                collectd-perl.5 \
                collectd-python.5 \
                collectd-snmp.5 \
 +              collectd-tg.1 \
                collectd-threshold.5 \
                collectd-unixsock.5 \
                types.db.5
  
  #collectd_1_SOURCES = collectd.pod
  
- EXTRA_DIST = types.db pinba.proto
+ EXTRA_DIST = types.db pinba.proto riemann.proto
  
  EXTRA_DIST +=   collectd.conf.pod \
                collectd-email.pod \
                collectd-python.pod \
                collectd.pod \
                collectd-snmp.pod \
 +              collectd-tg.pod \
                collectd-threshold.pod \
                collectd-unixsock.pod \
                postgresql_default.conf \
  pinba.pb-c.c pinba.pb-c.h: pinba.proto
        protoc-c --c_out . pinba.proto
  
+ riemann.pb-c.c riemann.pb-c.h: riemann.proto
+       protoc-c --c_out . riemann.proto
  install-exec-hook:
        $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
        if test -e $(DESTDIR)$(sysconfdir)/collectd.conf; \
diff --combined src/collectd.conf.in
  #PIDFile     "@localstatedir@/run/@PACKAGE_NAME@.pid"
  #PluginDir   "@libdir@/@PACKAGE_NAME@"
  #TypesDB     "@prefix@/share/@PACKAGE_NAME@/types.db"
 +
 +#----------------------------------------------------------------------------#
 +# Interval at which to query values. This may be overwritten on a per-plugin #
 +# base by using the 'Interval' option of the LoadPlugin block:               #
 +#   <LoadPlugin foo>                                                         #
 +#       Interval 60                                                          #
 +#   </LoadPlugin>                                                            #
 +#----------------------------------------------------------------------------#
  #Interval     10
 +
  #Timeout      2
  #ReadThreads  5
 +#WriteThreads 5
  
  ##############################################################################
  # Logging                                                                    #
  #@BUILD_PLUGIN_WIRELESS_TRUE@LoadPlugin wireless
  #@BUILD_PLUGIN_WRITE_GRAPHITE_TRUE@LoadPlugin write_graphite
  #@BUILD_PLUGIN_WRITE_HTTP_TRUE@LoadPlugin write_http
- #@BUILD_PLUGIN_WRITE_REDIS_TRUE@LoadPlugin write_redis
  #@BUILD_PLUGIN_WRITE_MONGODB_TRUE@LoadPlugin write_mongodb
+ #@BUILD_PLUGIN_WRITE_REDIS_TRUE@LoadPlugin write_redis
+ #@BUILD_PLUGIN_WRITE_RIEMANN_TRUE@LoadPlugin write_riemann
  #@BUILD_PLUGIN_XMMS_TRUE@LoadPlugin xmms
  #@BUILD_PLUGIN_ZFS_ARC_TRUE@LoadPlugin zfs_arc
  
  #             #SelectDB "custdb0"
  #             Query "num_of_customers"
  #             #Query "..."
 +#             #Host "..."
  #     </Database>
  #</Plugin>
  
  #                     ValuesFrom "count"
  #             </Result>
  #     </Query>
 +#     <Writer sqlstore>
 +#             # See contrib/postgresql/collectd_insert.sql for details
 +#             Statement "SELECT collectd_insert($1, $2, $3, $4, $5, $6, $7, $8, $9);"
 +#             StoreRates true
 +#     </Writer>
  #     <Database foo>
  #             Host "hostname"
  #             Port "5432"
  #             Query backend # predefined
  #             Query rt36_tickets
  #     </Database>
 +#     <Database qux>
 +#             Service "collectd_store"
 +#             Writer sqlstore
 +#             # see collectd.conf(5) for details
 +#             CommitInterval 30
 +#     </Database>
  #</Plugin>
  
  #<Plugin powerdns>
  #     </URL>
  #</Plugin>
  
- #<Plugin write_redis>
+ #<Plugin write_mongodb>
  #     <Node "example">
  #             Host "localhost"
- #             Port "6379"
+ #             Port "27017"
  #             Timeout 1000
+ #             StoreRates false
  #     </Node>
  #</Plugin>
  
- #<Plugin write_mongodb>
+ #<Plugin write_redis>
  #     <Node "example">
  #             Host "localhost"
- #             Port "27017"
+ #             Port "6379"
  #             Timeout 1000
- #             StoreRates false
  #     </Node>
  #</Plugin>
  
+ #<Plugin write_riemann>
+ #     <Node "example">
+ #             Host "localhost">
+ #             Port 5555
+ #             StoreRates true
+ #     </Node>
+ #     Tag "foobar"
+ #</Plugin>
  ##############################################################################
  # Filter configuration                                                       #
  #----------------------------------------------------------------------------#
diff --combined src/collectd.conf.pod
@@@ -181,14 -181,8 +181,14 @@@ see L<collectd-threshold(5)> for detail
  
  Number of threads to start for reading plugins. The default value is B<5>, but
  you may want to increase this if you have more than five plugins that take a
 -long time to read. Mostly those are plugin that do network-IO. Setting this to
 -a value higher than the number of plugins you've loaded is totally useless.
 +long time to read. Mostly those are plugins that do network-IO. Setting this to
 +a value higher than the number of registered read callbacks is not recommended.
 +
 +=item B<WriteThreads> I<Num>
 +
 +Number of threads to start for dispatching value lists to write plugins. The
 +default value is B<5>, but you may want to increase this if you have more than
 +five plugins that may take relatively long to write to.
  
  =item B<Hostname> I<Name>
  
@@@ -508,7 -502,7 +508,7 @@@ mode will be used, i.e. delivery is gua
  default), the I<transient> delivery mode will be used, i.e. messages may be
  lost due to high load, overflowing queues or similar issues.
  
 -=item B<Format> B<Command>|B<JSON> (Publish only)
 +=item B<Format> B<Command>|B<JSON>|B<Graphite> (Publish only)
  
  Selects the format in which messages are sent to the broker. If set to
  B<Command> (the default), values are sent as C<PUTVAL> commands which are
@@@ -1366,23 -1360,11 +1366,23 @@@ documentation for each driver, somewher
  L<http://libdbi-drivers.sourceforge.net/>. However, the options "host",
  "username", "password", and "dbname" seem to be deE<nbsp>facto standards.
  
 +DBDs can register two types of options: String options and numeric options. The
 +plugin will use the C<dbi_conn_set_option> function when the configuration
 +provides a string and the C<dbi_conn_require_option_numeric> function when the
 +configuration provides a number. So these two lines will actually result in
 +different calls being used:
 +
 +  DriverOption "Port" 1234      # numeric
 +  DriverOption "Port" "1234"    # string
 +
  Unfortunately, drivers are not too keen to report errors when an unknown option
  is passed to them, so invalid settings here may go unnoticed. This is not the
  plugin's fault, it will report errors if it gets them from the libraryE<nbsp>/
  the driver. If a driver complains about an option, the plugin will dump a
 -complete list of all options understood by that driver to the log.
 +complete list of all options understood by that driver to the log. There is no
 +way to programatically find out if an option expects a string or a numeric
 +argument, so you will have to refer to the appropriate DBD's documentation to
 +find this out. Sorry.
  
  =item B<SelectDB> I<Database>
  
@@@ -1397,11 -1379,6 +1397,11 @@@ query needs to be defined I<before> thi
  blocks you want to refer to must be placed above the database block you want to
  refer to them from.
  
 +=item B<Host> I<Hostname>
 +
 +Sets the B<host> field of I<value lists> to I<Hostname> when dispatching
 +values. Defaults to the global hostname setting.
 +
  =back
  
  =head2 Plugin C<df>
@@@ -5534,6 -5511,63 +5534,63 @@@ number
  
  =back
  
+ =head2 Plugin C<write_riemann>
+ The I<write_riemann plugin> will send values to I<Riemann>, a powerfull stream
+ aggregation and monitoring system. The plugin sends I<Protobuf> encoded data to
+ I<Riemann> using UDP packets.
+ Synopsis:
+  <Plugin "write_riemann">
+    <Node "example">
+      Host "localhost"
+      Port "5555"
+      StoreRates false
+      Delay 10
+    </Node>
+    Tag "foobar"
+  </Plugin>
+ The following options are understood by the I<write_riemann plugin>:
+ =over 4
+ =item E<lt>B<Node> I<Name>E<gt>
+ The plugin's configuration consists of one or more B<Node> blocks. Each block
+ is given a unique I<Name> and specifies one connection to an instance of
+ I<Riemann>. Indise the B<Node> block, the following per-connection options are
+ understood:
+ =over 4
+ =item B<Host> I<Address>
+ Hostname or address to connect to. Defaults to C<localhost>.
+ =item B<Port> I<Service>
+ Service name or port number to connect to. Defaults to C<5555>.
+ =item B<StoreRates> B<false>|B<true>
+ If set to B<true> (the default), convert counter values to rates. If set to
+ B<false> counter values are stored as is, i.e. as an increasing integer number.
+ This will be reflected in the C<ds_type> tag: If B<StoreRates> is enabled,
+ converted values will have "rate" appended to the data source type, e.g.
+ C<ds_type:derive:rate>.
+ =back
+ =item B<Tag> I<String>
+ Add the given string as an additional tag to the metric being sent to
+ I<Riemann>.
+ =back
  =head1 THRESHOLD CONFIGURATION
  
  Starting with version C<4.3.0> collectd has support for B<monitoring>. By that