Make collectd to log also to file
authorMartin Mágr <mmagr@redhat.com>
Tue, 20 Jun 2017 13:47:36 +0000 (15:47 +0200)
committerMartin Mágr <mmagr@redhat.com>
Wed, 21 Jun 2017 14:23:00 +0000 (16:23 +0200)
This change will make possible to set collectd to log to file
(/var/log/collectd.log by default).

Change-Id: I50289ad6657852d37abbf12938128ff9ab9e3bac

manifests/profile/base/metrics/collectd.pp

index 098f795..088e6e2 100644 (file)
 #   for more details.
 #   Defaults to hiera('step')
 #
+# [*enable_file_logging*]
+#   (Optional) Boolean. Whether to enable logfile plugin.
+#   which we should send metrics.
+#   Defaults to false
+#
 # [*collectd_server*]
 #   (Optional) String. The name or address of a collectd server to
 #   which we should send metrics.
@@ -49,6 +54,7 @@
 class tripleo::profile::base::metrics::collectd (
   $step = Integer(hiera('step')),
 
+  $enable_file_logging = false,
   $collectd_server = undef,
   $collectd_port = undef,
   $collectd_username = undef,
@@ -58,6 +64,9 @@ class tripleo::profile::base::metrics::collectd (
 ) {
   if $step >= 3 {
     include ::collectd
+    if $enable_file_logging {
+      include ::collectd::plugin::logfile
+    }
 
     if ! ($collectd_securitylevel in [undef, 'None', 'Sign', 'Encrypt']) {
       fail('collectd_securitylevel must be one of (None, Sign, Encrypt).')