From 83d9e8613d3d1b16b69f30dd24fbbf84867f61df Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sat, 25 Dec 2010 17:52:38 -0500 Subject: add in the missing --warning and --critical options to check_mysql_health --- manifests/service/mysql.pp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'manifests/service') diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index d501f06..6b68b73 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -20,7 +20,15 @@ define nagios::service::mysql( if ($check_host == 'absent') { fail("Please specify a hostname, ip address or socket to check a mysql instance.") } + + if $check_warning != undef { + $real_check_warning = "--warning $check_warning" + } + if $check_critical != undef { + $real_check_critical = "--critical $check_critical" + } + case $check_mode { 'tcp': { if ($check_host == 'localhost') { @@ -42,6 +50,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}", + check_command => "check_mysql_health!${check_host}!${check_port}!${check_username}!${check_password}!${real_check_warning}${real_check_critical}${name}!${check_database}", } } -- cgit v1.2.3 From 89d7f78db3ede8c9a343f115b13d6e4f12b1fe7a Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sat, 25 Dec 2010 17:54:04 -0500 Subject: fix check_mysql_health real_check_host variable --- manifests/service/mysql.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/service') diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index 6b68b73..96b63c6 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -50,6 +50,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${check_host}!${check_port}!${check_username}!${check_password}!${real_check_warning}${real_check_critical}${name}!${check_database}", + check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${real_check_warning}${real_check_critical}${name}!${check_database}", } } -- cgit v1.2.3 From d51c4fb34ba3cc9df45186b5eb556d45d298b05c Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sat, 25 Dec 2010 18:26:22 -0500 Subject: fix the --warning --critical by appending it as optional ending arguments in the command specifier --- manifests/service/mysql.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/service') diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index 96b63c6..ab4d8db 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -50,6 +50,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${real_check_warning}${real_check_critical}${name}!${check_database}", + check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}!${real_check_warning}!${real_check_critical}", } } -- cgit v1.2.3 From 6c74be1b9365826063d8298acd73f8c5717531ff Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sat, 25 Dec 2010 18:51:18 -0500 Subject: it might be that having ! when there are no arguments will cause nagios to be unhappy, so lets only put them in when we have arguments to pass --- manifests/service/mysql.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests/service') diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index ab4d8db..7ebdd85 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -22,11 +22,11 @@ define nagios::service::mysql( } if $check_warning != undef { - $real_check_warning = "--warning $check_warning" + $real_check_warning = "!--warning $check_warning" } if $check_critical != undef { - $real_check_critical = "--critical $check_critical" + $real_check_critical = "!--critical $check_critical" } case $check_mode { @@ -50,6 +50,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}!${real_check_warning}!${real_check_critical}", + check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}${real_check_warning}${real_check_critical}", } } -- cgit v1.2.3 From 43cc87a174f53062fa04990faf046ece9ab76f66 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 12 Apr 2011 19:01:38 -0400 Subject: add imap and pop service definitions --- manifests/service/imap.pp | 32 ++++++++++++++++++++++++++++++++ manifests/service/pop.pp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 manifests/service/imap.pp create mode 100644 manifests/service/pop.pp (limited to 'manifests/service') diff --git a/manifests/service/imap.pp b/manifests/service/imap.pp new file mode 100644 index 0000000..063231d --- /dev/null +++ b/manifests/service/imap.pp @@ -0,0 +1,32 @@ +define nagios::service::imap( + $ensure = 'present', + $host = 'absent', + $port = '143', + $tls = true, + $tls_port = '993' +){ + + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + nagios::service{ + "imap_${name}_${port}": + ensure => $ensure; + "imaps_${name}_${tls_port}": + ensure => $tls ? { + true => ensure, + default => 'absent' + }; + } + + if $ensure != 'absent' { + Nagios::Service["imap_${name}_${port}"]{ + check_command => "check_imap!${real_host}!${port}", + } + Nagios::Service["imaps_${name}_${tls_port}"]{ + check_command => "check_imap_ssl!${real_host}!${tls_port}", + } + } +} diff --git a/manifests/service/pop.pp b/manifests/service/pop.pp new file mode 100644 index 0000000..3b87afc --- /dev/null +++ b/manifests/service/pop.pp @@ -0,0 +1,32 @@ +define nagios::service::pop( + $ensure = 'present', + $host = 'absent', + $port = '110', + $tls = true, + $tls_port = '995' +){ + + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + nagios::service{ + "pop_${name}_${port}": + ensure => $ensure; + "pops_${name}_${tls_port}": + ensure => $tls ? { + true => ensure, + default => 'absent' + }; + } + + if $ensure != 'absent' { + Nagios::Service["pop_${name}_${port}"]{ + check_command => "check_pop3!${real_host}!${port}", + } + Nagios::Service["pops_${name}_${tls_port}"]{ + check_command => "check_pop3_ssl!${real_host}!${tls_port}", + } + } +} -- cgit v1.2.3 From 6b1b71b9007ecc938754a6b256d9f5b7cc63c780 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 12 Apr 2011 19:18:02 -0400 Subject: fix typo in imap/pop services --- manifests/service/imap.pp | 2 +- manifests/service/pop.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests/service') diff --git a/manifests/service/imap.pp b/manifests/service/imap.pp index 063231d..b703db4 100644 --- a/manifests/service/imap.pp +++ b/manifests/service/imap.pp @@ -16,7 +16,7 @@ define nagios::service::imap( ensure => $ensure; "imaps_${name}_${tls_port}": ensure => $tls ? { - true => ensure, + true => $ensure, default => 'absent' }; } diff --git a/manifests/service/pop.pp b/manifests/service/pop.pp index 3b87afc..9ec4aec 100644 --- a/manifests/service/pop.pp +++ b/manifests/service/pop.pp @@ -16,7 +16,7 @@ define nagios::service::pop( ensure => $ensure; "pops_${name}_${tls_port}": ensure => $tls ? { - true => ensure, + true => $ensure, default => 'absent' }; } -- cgit v1.2.3 From 673a61cec6ce8209ed5a169cd53da7bcf9ba94d6 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 19 Apr 2011 15:14:11 -0400 Subject: fix check_health_mode parameter --- manifests/service/mysql.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/service') diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index 7ebdd85..1b7bf81 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -50,6 +50,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}${real_check_warning}${real_check_critical}", + check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${check_health_mode}!${check_database}${real_check_warning}${real_check_critical}", } } -- cgit v1.2.3 From b5d1ad97b2b33d9a64991616ebe42bc9e0be8737 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 19 Apr 2011 16:19:10 -0400 Subject: add the potential for the --name to be set for arbitrary sql commands --- manifests/service/mysql.pp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'manifests/service') diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index 1b7bf81..2fde402 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -21,6 +21,10 @@ define nagios::service::mysql( fail("Please specify a hostname, ip address or socket to check a mysql instance.") } + if $check_name != undef { + $real_check_name = "!--name $check_name" + } + if $check_warning != undef { $real_check_warning = "!--warning $check_warning" } @@ -50,6 +54,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${check_health_mode}!${check_database}${real_check_warning}${real_check_critical}", + check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${check_health_mode}!${check_database}${real_check_name}${real_check_warning}${real_check_critical}", } } -- cgit v1.2.3 From 1159fd799dcf85bedbe0bb9ce44971263250ee46 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Feb 2012 14:42:16 +0100 Subject: use trocla for that password --- manifests/service/mysql.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests/service') diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index 2fde402..53f1461 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -1,11 +1,11 @@ -# Checks a mysql instance via tcp or socket +# Checks a mysql instance via tcp or socket define nagios::service::mysql( $ensure = present, $check_host = 'absent', $check_port = '3306', $check_username = 'nagios', - $check_password = $nagios_mysql_password, + $check_password = trocla("mysql_nagios_${::fqdn}",'plain','length: 32'), $check_database = 'information_schema', $check_warning = undef, $check_critical = undef, @@ -51,7 +51,7 @@ define nagios::service::mysql( } } } - + nagios::service { "mysql_health_${name}": ensure => $ensure, check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${check_health_mode}!${check_database}${real_check_name}${real_check_warning}${real_check_critical}", -- cgit v1.2.3 From 1eef6f70c0b3096be24954bfd23306cf82a0d316 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 18 Apr 2012 14:41:13 -0400 Subject: put single quotes around the password to guard against exclamation points in passwords --- manifests/service/mysql.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/service') diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index 53f1461..4a9c81a 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -54,6 +54,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${check_health_mode}!${check_database}${real_check_name}${real_check_warning}${real_check_critical}", + check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!'${check_password}'!${check_health_mode}!${check_database}${real_check_name}${real_check_warning}${real_check_critical}", } } -- cgit v1.2.3