diff options
Diffstat (limited to 'manifests/service')
-rw-r--r-- | manifests/service/mysql.pp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index ca2ae15..2605e8d 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -46,3 +46,54 @@ define nagios::service::mysql( } } + +define nagios::service::mysql_health( + $ensure = present, + $check_hostname = $fqdn, + $check_port = '3306', + $check_username = 'nagios', + $check_password = $nagios_mysql_password, + $check_database = 'information_schema', + $check_warning = undef, + $check_critical = undef, + $check_health_mode = $name, + $check_name = undef, + $check_name2 = undef, + $check_regexp = undef, + $check_units = undef, + $check_mode = 'tcp' +){ + + if ($check_username == '') { + $real_check_username = 'nagios' + } + + case $check_mode { + 'tcp': { + if ($check_hostname == 'localhost') { + $real_check_hostname = '127.0.0.1' + } + else { + $real_check_hostname = $check_hostname + } + } + default: { + if ($check_hostname == '127.0.0.1') { + $real_check_hostname = 'localhost' + } + else { + $real_check_hostname = $check_hostname + } + } + } + + nagios::service { 'mysql_health_${check_health_mode}': + ensure => $ensure, + check_command => "check_mysql_health!${check_hostname}!${check_port}!${real_check_username}!${check_password}${check_health_mode}!{check_database}", + } +} + + + + + |