summaryrefslogtreecommitdiff
path: root/manifests/service/http.pp
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2009-06-13 15:41:24 +0200
committermh <mh@immerda.ch>2009-06-13 15:41:24 +0200
commit011d5e028f86e9eeba1c05e251063b45004d210e (patch)
treef17baaca735ed3a0e4f2b184da53c04d63435f66 /manifests/service/http.pp
parent783ae21de4cadbd9e8e3cdf62d4b0d6039586d78 (diff)
put everything into its own file
Diffstat (limited to 'manifests/service/http.pp')
-rw-r--r--manifests/service/http.pp41
1 files changed, 41 insertions, 0 deletions
diff --git a/manifests/service/http.pp b/manifests/service/http.pp
new file mode 100644
index 0000000..5c6cda1
--- /dev/null
+++ b/manifests/service/http.pp
@@ -0,0 +1,41 @@
+# ssl_mode:
+# - false: only check http
+# - true: check http and https
+# - force: http is permanent redirect to https
+# - only: check only https
+define nagios::service::http(
+ $ensure = present,
+ $check_domain = 'absent',
+ $check_url = '/',
+ $check_code = 'OK',
+ $ssl_mode = false
+){
+ $real_check_domain = $check_domain ? {
+ 'absent' => $name,
+ default => $check_domain
+ }
+ case $ssl_mode {
+ 'force',true,'only': {
+ nagios::service{"https_${name}_${check_code}_${hostname}":
+ ensure => $ensure,
+ check_command => "check_https_url_regex!${real_check_domain}!${check_url}!'${check_code}'",
+ }
+ case $ssl_mode {
+ 'force': {
+ nagios::service{"httprd_${name}_${hostname}":
+ ensure => $ensure,
+ check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'301'",
+ }
+ }
+ }
+ }
+ }
+ case $ssl_mode {
+ false,true: {
+ nagios::service{"http_${name}_${check_code}_${hostname}":
+ ensure => $ensure,
+ check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'${check_code}'",
+ }
+ }
+ }
+}