fa67257056
. change the default nagios::service::mysql check to use the check_mysql_health 'connection-time' check mode, which is identical to the original check, with some additional information . stop using nagios::plugin::deploy because this doesn't work when more than one node attempts to realize this class . stop exporting the nagios_command because this doesn't work when more than one node attempts to realize this class . remove the check_health define, instead this be how it was before, as the previous nagios::service::mysql define
32 lines
1 KiB
Puppet
32 lines
1 KiB
Puppet
# 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) {
|
|
$nagios_mysql_user = 'nagios@%'
|
|
nagios::service::mysql { 'connection-time':
|
|
check_hostname => $fqdn,
|
|
require => Mysql_grant[$nagios_mysql_user],
|
|
}
|
|
}
|
|
else {
|
|
$nagios_mysql_user = 'nagios@localhost'
|
|
}
|
|
|
|
mysql_user{$nagios_mysql_user:
|
|
password_hash => mysql_password("${nagios_mysql_password}"),
|
|
require => Package['mysql'],
|
|
}
|
|
|
|
# repl_client_priv is needed to check the replication slave status
|
|
# modes: slave-lag, slave-io-running and slave-sql-running
|
|
mysql_grant{$nagios_mysql_user:
|
|
privileges => [ 'select_priv', 'repl_client_priv' ],
|
|
require => [ Mysql_user[$nagios_mysql_user], Package['mysql'] ],
|
|
}
|
|
}
|