diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/server.pp | 6 | ||||
-rw-r--r-- | manifests/server/nagios.pp | 28 |
2 files changed, 33 insertions, 1 deletions
diff --git a/manifests/server.pp b/manifests/server.pp index 49ef9eb..60fc93d 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -16,7 +16,11 @@ class mysql::server { default: { include mysql::server::munin::default } } } - + + if $use_nagios { + include mysql::server::nagios + } + if $use_shorewall { include shorewall::rules::mysql } diff --git a/manifests/server/nagios.pp b/manifests/server/nagios.pp new file mode 100644 index 0000000..147667f --- /dev/null +++ b/manifests/server/nagios.pp @@ -0,0 +1,28 @@ +# manifests/server/nagios.pp + +class mysql::server::nagios { + case $nagios_mysql_password { + '': { fail("please specify \$nagios_mysql_password to enable nagios mysql check")} + } + + mysql_user{'nagios@localhost': + password_hash => mysql_password("${nagios_mysql_password}"), + require => Package['mysql'], + } + + mysql_grant{'nagios@localhost': + privileges => 'select_priv', + require => [ Mysql_user['nagios@localhost'], Package['mysql'] ], + } + + # Flip this variable if you need to check MySQL through check_ssh or check_nrpe, + # in that case you will have to manually define nagios::service::mysql + if ($nagios_mysql_notcp != true) { + nagios::service::mysql { 'mysql': + check_hostname => $fqdn, + check_username => 'nagios', + check_password => $nagios_mysql_password, + check_mode => 'tcp', + } + } +} |