Skip to content

Commit

Permalink
mysql: make new settings optional
Browse files Browse the repository at this point in the history
  • Loading branch information
t-8ch committed Aug 21, 2015
1 parent 8520ac4 commit d7386ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 11 additions & 3 deletions manifests/plugin/mysql/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,28 @@
$masterstats = false,
$slavestats = false,
$socket = undef,
$innodbstats = false,
$slavenotifications = false,
$innodbstats = undef,
$slavenotifications = undef,
) {
include collectd::params
include collectd::plugin::mysql

$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.')
}
Expand Down
4 changes: 4 additions & 0 deletions templates/mysql-database.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
<%- if @socket -%>
Socket "<%= @socket %>"
<%- end -%>
<%- if not @innodbstats.nil? -%>
InnodbStats <%= @innodbstats %>
<%- end -%>
<%- if not @slavenotifications.nil? -%>
SlaveNotifications <%= @slavenotifications %>
<%- end -%>
</Database>
</Plugin>

0 comments on commit d7386ae

Please sign in to comment.