summaryrefslogtreecommitdiff
path: root/manifests/service
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/service')
-rw-r--r--manifests/service/http.pp41
-rw-r--r--manifests/service/ping.pp13
2 files changed, 54 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}'",
+ }
+ }
+ }
+}
diff --git a/manifests/service/ping.pp b/manifests/service/ping.pp
new file mode 100644
index 0000000..63a5400
--- /dev/null
+++ b/manifests/service/ping.pp
@@ -0,0 +1,13 @@
+define nagios::service::ping(
+ $ensure = present
+){
+ $real_nagios_ping_rate = $nagios_ping_rate ? {
+ '' => '!100.0,20%!500.0,60%',
+ default => $nagios_ping_rate
+ }
+
+ nagios::service{ "check_ping_${hostname}":
+ ensure => $ensure,
+ check_command => "check_ping${real_nagios_ping_rate}",
+ }
+}