2009-12-11 21:25:20 +01:00
|
|
|
# manifests/server/nagios.pp
|
|
|
|
|
|
|
|
class mysql::server::nagios {
|
|
|
|
case $nagios_mysql_password {
|
|
|
|
'': { fail("please specify \$nagios_mysql_password to enable nagios mysql check")}
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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) {
|
2009-12-22 17:41:54 +01:00
|
|
|
$nagios_mysql_user = 'nagios@%'
|
2009-12-11 21:25:20 +01:00
|
|
|
nagios::service::mysql { 'mysql':
|
|
|
|
check_hostname => $fqdn,
|
|
|
|
check_username => 'nagios',
|
|
|
|
check_password => $nagios_mysql_password,
|
|
|
|
check_mode => 'tcp',
|
2009-12-22 17:41:54 +01:00
|
|
|
require => Mysql_grant[$nagios_mysql_user],
|
2009-12-11 21:25:20 +01:00
|
|
|
}
|
|
|
|
}
|
2009-12-22 17:41:54 +01:00
|
|
|
else {
|
|
|
|
$nagios_mysql_user = 'nagios@localhost'
|
|
|
|
}
|
|
|
|
|
|
|
|
mysql_user{$nagios_mysql_user:
|
|
|
|
password_hash => mysql_password("${nagios_mysql_password}"),
|
|
|
|
require => Package['mysql'],
|
|
|
|
}
|
|
|
|
|
|
|
|
mysql_grant{$nagios_mysql_user:
|
|
|
|
privileges => 'select_priv',
|
|
|
|
require => [ Mysql_user[$nagios_mysql_user], Package['mysql'] ],
|
|
|
|
}
|
2009-12-11 21:25:20 +01:00
|
|
|
}
|