summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2010-10-18 20:52:42 -0400
committerMicah Anderson <micah@riseup.net>2010-10-18 20:52:42 -0400
commitfa6725705679a79abb1e9cc12e2f1b3d803c623f (patch)
tree345e4b93964bea4febdfe772b57c474ba2d78b2d /manifests
parentf52a66ea0ec13051123eb5ce9fea2f44791e8cee (diff)
. remove the check_mysql_health script from the mysql module, instead it belongs in the nagios module
. 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
Diffstat (limited to 'manifests')
-rw-r--r--manifests/server/nagios.pp63
1 files changed, 5 insertions, 58 deletions
diff --git a/manifests/server/nagios.pp b/manifests/server/nagios.pp
index 92b35cb..4e2b8b8 100644
--- a/manifests/server/nagios.pp
+++ b/manifests/server/nagios.pp
@@ -1,85 +1,32 @@
# manifests/server/nagios.pp
-class mysql::server::nagios {
+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 { 'mysql':
+ nagios::service::mysql { 'connection-time':
check_hostname => $fqdn,
- check_username => 'nagios',
- check_password => $nagios_mysql_password,
- check_mode => 'tcp',
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'] ],
}
-
- nagios::plugin::deploy{'check_mysql_health':
- source => 'mysql/nagios/check_mysql_health',
- require_package => 'libdbd-mysql-perl';
- }
-
- @@nagios_command{
- 'check_mysql_health':
- command_line => '$USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$ --database $ARG6$';
- }
-
- define check_health (
- $ensure = present,
- $check_hostname = '127.0.0.1',
- $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' )
- {
- 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_${name}":
- ensure => $ensure,
- check_command => "check_mysql_health!${check_hostname}!${check_port}!${check_username}!${check_password}!${name}!${check_database}",
- }
- }
}