summaryrefslogtreecommitdiff
path: root/manifests/service
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2010-10-18 20:55:48 -0400
committerMicah Anderson <micah@riseup.net>2010-10-18 20:55:48 -0400
commitb057ff41f32ccba198a41a5babc51da6f48911a5 (patch)
tree2d1da1db5524c3632e17358a983cb4e1036c2178 /manifests/service
parent5cb689737e367ce751956575b11b0d46bf241f91 (diff)
. add the check_mysql_health plugin
. add an additional nagios::defaults::plugins class that is included in the nagios::defaults, this can be used to install other nagios plugins that aren't distributed in the nagios-plugins package . use the nagios::defaults::plugins to setup the check_mysql_health plugin . add a check_mysql_health command to defaults/commands.pp in the section for commands for services defined by other modules . change the nagios::service::mysql to use the more advanced check_mysql_health plugin, instead of the basic check_mysql plugin
Diffstat (limited to 'manifests/service')
-rw-r--r--manifests/service/mysql.pp83
1 files changed, 41 insertions, 42 deletions
diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp
index ca2ae15..d501f06 100644
--- a/manifests/service/mysql.pp
+++ b/manifests/service/mysql.pp
@@ -1,48 +1,47 @@
-# Checks a mysql instance via tcp or socket
+# Checks a mysql instance via tcp or socket
define nagios::service::mysql(
- $ensure = present,
- $check_hostname = 'absent',
- $check_port = '3306',
- $check_username = 'nagios',
- $check_password = '',
- $check_database = 'absent',
- $check_mode = 'tcp'
-){
- if ($check_hostname == 'absent') {
- fail("Please specify a hostname, ip address or socket to check a mysql instance.")
- }
-
- 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
- }
- }
- }
+ $ensure = present,
+ $check_host = 'absent',
+ $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_database == 'absent') {
- nagios::service { 'mysql':
- ensure => $ensure,
- check_command => "check_mysql!${real_check_hostname}!${check_port}!${check_username}!${check_password}",
- }
+ if ($check_host == 'absent') {
+ fail("Please specify a hostname, ip address or socket to check a mysql instance.")
+ }
+
+ case $check_mode {
+ 'tcp': {
+ if ($check_host == 'localhost') {
+ $real_check_host = '127.0.0.1'
+ }
+ else {
+ $real_check_host = $check_host
+ }
}
- else {
- nagios::service { "mysql_${check_database}":
- ensure => $ensure,
- check_command => "check_mysql_db!${real_check_hostname}!${check_port}!${check_username}!${check_password}!${check_database}",
- }
+ default: {
+ if ($check_host == '127.0.0.1') {
+ $real_check_host = 'localhost'
+ }
+ else {
+ $real_check_host = $check_host
+ }
}
-
+ }
+
+ nagios::service { "mysql_health_${name}":
+ ensure => $ensure,
+ check_command => "check_mysql_health!${check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}",
+ }
}