From 38d8bd2bdafa5db9e6fc064a86e388958c1c70d9 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 11 Dec 2009 11:34:03 -0500 Subject: manage mysql munin plugin per-OS, use debian.cnf on Debian --- manifests/munin.pp | 23 ----------------------- manifests/server.pp | 5 ++++- manifests/server/munin/debian.pp | 9 +++++++++ manifests/server/munin/default.pp | 23 +++++++++++++++++++++++ 4 files changed, 36 insertions(+), 24 deletions(-) delete mode 100644 manifests/munin.pp create mode 100644 manifests/server/munin/debian.pp create mode 100644 manifests/server/munin/default.pp diff --git a/manifests/munin.pp b/manifests/munin.pp deleted file mode 100644 index b4f82dd..0000000 --- a/manifests/munin.pp +++ /dev/null @@ -1,23 +0,0 @@ -# manifests/munin.pp - -class mysql::munin { - case $munin_mysql_password { - '': { fail("please specify \$munin_mysql_password to enable mysql munin plugin")} - } - - mysql_user{'munin@localhost': - password_hash => mysql_password("$munin_mysql_password"), - require => Package['mysql'], - } - - mysql_grant{'munin@localhost': - privileges => 'select_priv', - require => [ Mysql_user['munin@localhost'], Package['mysql'] ], - } - - munin::plugin { - [mysql_bytes, mysql_queries, mysql_slowqueries, mysql_threads]: - config => "env.mysqlopts --user=munin --password=${munin_mysql_password} -h localhost", - require => [ Mysql_grant['munin@localhost'], Mysql_user['munin@localhost'], Package['mysql'] ] - } -} diff --git a/manifests/server.pp b/manifests/server.pp index d3916a7..49ef9eb 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -11,7 +11,10 @@ class mysql::server { } if $use_munin { - include mysql::munin + case $operatingsystem { + debian: { include mysql::server::munin::debian } + default: { include mysql::server::munin::default } + } } if $use_shorewall { diff --git a/manifests/server/munin/debian.pp b/manifests/server/munin/debian.pp new file mode 100644 index 0000000..2b2acb4 --- /dev/null +++ b/manifests/server/munin/debian.pp @@ -0,0 +1,9 @@ +# manifests/server/munin/debian.pp + +class mysql::server::munin::debian { + munin::plugin { + [mysql_bytes, mysql_queries, mysql_slowqueries, mysql_threads]: + config => "user root\nenv.mysqlopts --defaults-file=/etc/mysql/debian.cnf", + require => Package['mysql'], + } +} diff --git a/manifests/server/munin/default.pp b/manifests/server/munin/default.pp new file mode 100644 index 0000000..b60ff0d --- /dev/null +++ b/manifests/server/munin/default.pp @@ -0,0 +1,23 @@ +# manifests/server/munin/default.pp + +class mysql::server::munin::default { + case $munin_mysql_password { + '': { fail("please specify \$munin_mysql_password to enable mysql munin plugin")} + } + + mysql_user{'munin@localhost': + password_hash => mysql_password("$munin_mysql_password"), + require => Package['mysql'], + } + + mysql_grant{'munin@localhost': + privileges => 'select_priv', + require => [ Mysql_user['munin@localhost'], Package['mysql'] ], + } + + munin::plugin { + [mysql_bytes, mysql_queries, mysql_slowqueries, mysql_threads]: + config => "env.mysqlopts --user=munin --password=${munin_mysql_password} -h localhost", + require => [ Mysql_grant['munin@localhost'], Mysql_user['munin@localhost'], Package['mysql'] ] + } +} -- cgit v1.2.3