diff --git a/manifests/plugin/mysql/database.pp b/manifests/plugin/mysql/database.pp index 48cf70bd1..a9909190a 100644 --- a/manifests/plugin/mysql/database.pp +++ b/manifests/plugin/mysql/database.pp @@ -9,8 +9,8 @@ $masterstats = false, $slavestats = false, $socket = undef, - $innodbstats = false, - $slavenotifications = false, + $innodbstats = undef, + $slavenotifications = undef, ) { include collectd::params include collectd::plugin::mysql @@ -18,11 +18,19 @@ $conf_dir = $collectd::params::plugin_conf_dir validate_string($database, $host, $username, $password, $port) - validate_bool($masterstats, $slavestats, $innodbstats, $slavenotifications) + validate_bool($masterstats, $slavestats) if $socket { validate_string($socket) } + if $innodbstats != undef { + validate_bool($innodbstats) + } + + if $slavenotifications != undef { + validate_bool($slavenotifications) + } + if ($masterstats == true and $slavestats == true) { fail('master and slave statistics are mutually exclusive.') } diff --git a/templates/mysql-database.conf.erb b/templates/mysql-database.conf.erb index 2a48e2a7e..e98f3214d 100644 --- a/templates/mysql-database.conf.erb +++ b/templates/mysql-database.conf.erb @@ -15,7 +15,11 @@ <%- if @socket -%> Socket "<%= @socket %>" <%- end -%> +<%- if not @innodbstats.nil? -%> InnodbStats <%= @innodbstats %> +<%- end -%> +<%- if not @slavenotifications.nil? -%> SlaveNotifications <%= @slavenotifications %> +<%- end -%>