module-mysql/manifests/server/nagios.pp

27 lines
924 B
ObjectPascal
Raw Normal View History

2013-01-02 17:13:45 +01:00
# setup nagios check for mysql
class mysql::server::nagios {
# 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
2012-06-14 19:53:44 +02:00
if $mysql::server::nagios_notcp {
$nagios_mysql_user = 'nagios@localhost'
} else {
$nagios_mysql_user = 'nagios@%'
nagios::service::mysql { 'connection-time':
2013-01-02 17:13:45 +01:00
check_host => $::fqdn,
require => Mysql_grant[$nagios_mysql_user],
}
}
mysql_user{$nagios_mysql_user:
2013-01-02 18:48:49 +01:00
password_hash => $mysql::server::nagios_password_hash,
2013-01-02 17:13:45 +01:00
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:
2013-01-02 17:13:45 +01:00
privileges => [ 'select_priv', 'repl_client_priv' ],
require => [ Mysql_user[$nagios_mysql_user], Package['mysql'] ],
}
}