From 6f30dd81e946998a222cc95872a33548e856c7f5 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Fri, 20 Feb 2015 18:06:55 -0500 Subject: Rename nagios flag to manage_nagios This is so that we stay consistent between all shared modules that are using this pattern. --- README | 8 ++++---- manifests/service.pp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README b/README index 32698b3..509650f 100644 --- a/README +++ b/README @@ -55,8 +55,8 @@ stunnel configuration variable (see manifests/server.pp) which will be used to create the /etc/stunnel/${name}.conf file, and then notify the stunnel service so it will restart. -If you pass $use_nagios to this define, it will create a nagios::service entry -for stunnel_${name} which will watch for the appropriate number processes with -that configuration name +If you pass $manage_nagios to this define, it will create a nagios::service +entry for stunnel_${name} which will watch for the appropriate number processes +with that configuration name + - \ No newline at end of file diff --git a/manifests/service.pp b/manifests/service.pp index 666826d..910f714 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -51,7 +51,7 @@ define stunnel::service ( $timeoutconnect = false, $timeoutidle = false, $transparent = false, - $use_nagios = false, + $manage_nagios = false, $verify = false ) { @@ -71,7 +71,7 @@ define stunnel::service ( mode => '0600'; } - if $use_nagios { + if $manage_nagios { nagios::service { "stunnel_${name}": check_command => "nagios-stat-proc!/usr/bin/stunnel4 /etc/stunnel/${name}.conf!6!5!proc"; } -- cgit v1.2.3 From d34962e4125d54e7de30601ca46471a49cd89757 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Fri, 20 Feb 2015 18:14:21 -0500 Subject: Split nagios resources into their own file. This will make it possible to manage nagios resources from a point external to this module in order to have more fine-grained control. --- manifests/service.pp | 4 +--- manifests/service/nagios.pp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 manifests/service/nagios.pp diff --git a/manifests/service.pp b/manifests/service.pp index 910f714..fe36c2f 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -72,8 +72,6 @@ define stunnel::service ( } if $manage_nagios { - nagios::service { "stunnel_${name}": - check_command => "nagios-stat-proc!/usr/bin/stunnel4 /etc/stunnel/${name}.conf!6!5!proc"; - } + stunnel::service::nagios { $name: } } } diff --git a/manifests/service/nagios.pp b/manifests/service/nagios.pp new file mode 100644 index 0000000..578b417 --- /dev/null +++ b/manifests/service/nagios.pp @@ -0,0 +1,12 @@ +# Put a Nagios service check in place for a specific tunnel. +# +# The resource name will be used to point to the corresponding stunnel +# configuration file. +# +define stunnel::service::nagios () { + + nagios::service { "stunnel_${name}": + check_command => "nagios-stat-proc!/usr/bin/stunnel4 /etc/stunnel/${name}.conf!6!5!proc"; + } + +} -- cgit v1.2.3 From 9ee857f480c0f18596cc55a6885d6253e9d4d124 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Fri, 20 Feb 2015 18:21:11 -0500 Subject: README: mention how one could reuse nagios resources with their own logic Some people might want to inject their own logic before including nagios resources. We can explain that since the nagios resources are in their own part of the manifests, they can shortcut the module's automatic handling of it, and call it manually from their own manifests. --- README | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README b/README index 509650f..b6a3124 100644 --- a/README +++ b/README @@ -59,4 +59,19 @@ If you pass $manage_nagios to this define, it will create a nagios::service entry for stunnel_${name} which will watch for the appropriate number processes with that configuration name +Note that if you need to use some specific logic to decide whether or not to +create a nagios service check, you should set $manage_nagios to false, and +use stunnel::service::nagios from within your own manifests. + +stunnel::service::nagios +------------------------ + +This define creates a nagios service check for a specific tunnel. The resource +name should be the name of the tunnel's configuration file without the '.conf' +suffix. For example: + + stunnel::service::nagios { 'carpal': } + +The above example would verify that the tunnel defined in +`/etc/stunnel/carpal.conf'. -- cgit v1.2.3