diff options
author | mh <mh@immerda.ch> | 2010-06-28 19:28:27 +0200 |
---|---|---|
committer | mh <mh@immerda.ch> | 2010-06-28 19:28:27 +0200 |
commit | c25c57f3945a7edf66bedaa34fa4af62a803d174 (patch) | |
tree | 863c61e2de0c258c859527e14e86b47ffd8f0bb1 /manifests/service | |
parent | 77f601607093b7fb22f3498574d0dedd2cbe01d9 (diff) | |
parent | 5d5ec8c28d0fe39359af8db159b14faeae397e1f (diff) |
merge with lavamind
Diffstat (limited to 'manifests/service')
-rw-r--r-- | manifests/service/http.pp | 6 | ||||
-rw-r--r-- | manifests/service/mysql.pp | 48 | ||||
-rw-r--r-- | manifests/service/ntp.pp | 2 | ||||
-rw-r--r-- | manifests/service/passive.pp | 18 | ||||
-rw-r--r-- | manifests/service/ping.pp | 2 |
5 files changed, 71 insertions, 5 deletions
diff --git a/manifests/service/http.pp b/manifests/service/http.pp index 5c6cda1..5fd9890 100644 --- a/manifests/service/http.pp +++ b/manifests/service/http.pp @@ -16,13 +16,13 @@ define nagios::service::http( } case $ssl_mode { 'force',true,'only': { - nagios::service{"https_${name}_${check_code}_${hostname}": + nagios::service{"https_${name}_${check_code}": ensure => $ensure, check_command => "check_https_url_regex!${real_check_domain}!${check_url}!'${check_code}'", } case $ssl_mode { 'force': { - nagios::service{"httprd_${name}_${hostname}": + nagios::service{"httprd_${name}": ensure => $ensure, check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'301'", } @@ -32,7 +32,7 @@ define nagios::service::http( } case $ssl_mode { false,true: { - nagios::service{"http_${name}_${check_code}_${hostname}": + nagios::service{"http_${name}_${check_code}": ensure => $ensure, check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'${check_code}'", } diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp new file mode 100644 index 0000000..ca2ae15 --- /dev/null +++ b/manifests/service/mysql.pp @@ -0,0 +1,48 @@ +# 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 + } + } + } + + if ($check_database == 'absent') { + nagios::service { 'mysql': + ensure => $ensure, + check_command => "check_mysql!${real_check_hostname}!${check_port}!${check_username}!${check_password}", + } + } + else { + nagios::service { "mysql_${check_database}": + ensure => $ensure, + check_command => "check_mysql_db!${real_check_hostname}!${check_port}!${check_username}!${check_password}!${check_database}", + } + } + +} diff --git a/manifests/service/ntp.pp b/manifests/service/ntp.pp index c07177d..eca255a 100644 --- a/manifests/service/ntp.pp +++ b/manifests/service/ntp.pp @@ -1,7 +1,7 @@ # manifests/service/ntp.pp class nagios::service::ntp { - nagios::service{ "check_ntp_${hostname}": + nagios::service{ "check_ntp": check_command => "check_ntp_time", host_name => $fqdn, } diff --git a/manifests/service/passive.pp b/manifests/service/passive.pp new file mode 100644 index 0000000..f3df1e8 --- /dev/null +++ b/manifests/service/passive.pp @@ -0,0 +1,18 @@ +define nagios::service::passive( + $ensure = present, + $notification_interval = '', + $notification_period = '', + $notification_options = '', + $contact_groups = '' +) { + + nagios::service { $name: + use => 'passive-service', + check_command => 'check_dummy!0', + notification_interval => $notification_interval, + notification_period => $notification_period, + notification_options => $notification_options, + contact_groups => $contact_groups, + } + +} diff --git a/manifests/service/ping.pp b/manifests/service/ping.pp index 63a5400..c705c68 100644 --- a/manifests/service/ping.pp +++ b/manifests/service/ping.pp @@ -6,7 +6,7 @@ define nagios::service::ping( default => $nagios_ping_rate } - nagios::service{ "check_ping_${hostname}": + nagios::service{ "check_ping": ensure => $ensure, check_command => "check_ping${real_nagios_ping_rate}", } |