diff options
author | varac <varacanero@zeromail.org> | 2013-01-26 22:36:52 +0100 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2016-03-09 17:20:58 +0100 |
commit | bad75052820f221df575a1942417712e35ab1af7 (patch) | |
tree | 83713faf0dc598153e5557b56d2db3859ace314d | |
parent | c0dee4a2393e23b226e123a427898de94b342141 (diff) |
Added $storeconfigs parameter
With this you can disable collection of exported resources.
On masterless setups, this module would otherwise complain.
-rw-r--r-- | README | 12 | ||||
-rw-r--r-- | manifests/apache.pp | 4 | ||||
-rw-r--r-- | manifests/base.pp | 62 | ||||
-rw-r--r-- | manifests/init.pp | 1 | ||||
-rw-r--r-- | manifests/storeconfigs.pp | 61 |
5 files changed, 76 insertions, 64 deletions
@@ -2,7 +2,7 @@ Introduction/Notes ================== This modules was inspired and based on the work of David Schmitt -The immerda project group adapted and improved this module. +The immerda project group adapted and improved this module. Mainly we made it using the new native puppet nagios commands as well we made it more modular to fit for multidistro usage. @@ -12,10 +12,12 @@ In it's current form, this module can be used on CentOS and Debian. Overview ======== -To use the nagios resources, activate storeconfigs on the -puppetmaster. +To use the nagios resources in an puppetmaster setup you need to activate +[storeconfigs](https://docs.puppetlabs.com/puppet/latest/reference/configuration.html#storeconfigs) on the puppetmaster. +You can also use this module in a masterless setup, please set the +`storeconfigs` parameter to `false` when declaring the nafios class. -You need to be running verison 0.25 or later of puppet. +You need to be running version 0.25 or later of puppet. Monitor @@ -193,7 +195,7 @@ Variables Options to change the behavior of the nagios class: - allow_external_cmd: Set to true, if you'd like to ensure that your http - daemon can write to the external command file. You + daemon can write to the external command file. You may also need to flip "check_external_commands" in "nagios.cfg" to enable this functionality. diff --git a/manifests/apache.pp b/manifests/apache.pp index 8da9c11..87fe3d2 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -2,12 +2,14 @@ class nagios::apache( $allow_external_cmd = false, $manage_shorewall = false, - $manage_munin = false + $manage_munin = false, + $storeconfigs = true ) { class{'::nagios': httpd => 'apache', allow_external_cmd => $allow_external_cmd, manage_munin => $manage_munin, manage_shorewall => $manage_shorewall, + storeconfigs => $storeconfigs } } diff --git a/manifests/base.pp b/manifests/base.pp index 4922cdb..1ba0679 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -75,64 +75,6 @@ class nagios::base { } } - Nagios_command <<||>> - Nagios_contactgroup <<||>> - Nagios_contact <<||>> - Nagios_hostdependency <<||>> - Nagios_hostescalation <<||>> - Nagios_hostextinfo <<||>> - Nagios_hostgroup <<||>> - Nagios_host <<||>> - Nagios_servicedependency <<||>> - Nagios_serviceescalation <<||>> - Nagios_servicegroup <<||>> - Nagios_serviceextinfo <<||>> - Nagios_service <<||>> - Nagios_timeperiod <<||>> - - Nagios_command <||> { - notify => Service['nagios'], - } - Nagios_contact <||> { - notify => Service['nagios'], - } - Nagios_contactgroup <||> { - notify => Service['nagios'], - } - Nagios_host <||> { - notify => Service['nagios'], - } - Nagios_hostdependency <||> { - notify => Service['nagios'], - } - Nagios_hostescalation <||> { - notify => Service['nagios'], - } - Nagios_hostextinfo <||> { - notify => Service['nagios'], - } - Nagios_hostgroup <||> { - notify => Service['nagios'], - } - Nagios_service <||> { - notify => Service['nagios'], - } - Nagios_servicegroup <||> { - notify => Service['nagios'], - } - Nagios_servicedependency <||> { - notify => Service['nagios'], - } - Nagios_serviceescalation <||> { - notify => Service['nagios'], - } - Nagios_serviceextinfo <||> { - notify => Service['nagios'], - } - Nagios_timeperiod <||> { - notify => Service['nagios'], - } - file{ [ "${cfg_dir}/nagios_command.cfg", "${cfg_dir}/nagios_contact.cfg", @@ -179,4 +121,8 @@ class nagios::base { purge => true; } } + + if ( $nagios::storeconfigs == true ) { + include ::nagios::storeconfigs + } } diff --git a/manifests/init.pp b/manifests/init.pp index c4d7725..e3421a0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -23,6 +23,7 @@ class nagios( $service_atboot = true, $purge_resources = true, $gpgkey_checks = {}, + $storeconfigs = true ) { case $nagios::httpd { 'absent': { } diff --git a/manifests/storeconfigs.pp b/manifests/storeconfigs.pp new file mode 100644 index 0000000..96c30dd --- /dev/null +++ b/manifests/storeconfigs.pp @@ -0,0 +1,61 @@ +# collect exported resources when using 'storeconfigs => true' +class nagios::storeconfigs { + + Nagios_command <<||>> + Nagios_contactgroup <<||>> + Nagios_contact <<||>> + Nagios_hostdependency <<||>> + Nagios_hostescalation <<||>> + Nagios_hostextinfo <<||>> + Nagios_hostgroup <<||>> + Nagios_host <<||>> + Nagios_servicedependency <<||>> + Nagios_serviceescalation <<||>> + Nagios_servicegroup <<||>> + Nagios_serviceextinfo <<||>> + Nagios_service <<||>> + Nagios_timeperiod <<||>> + + Nagios_command <||> { + notify => Service['nagios'], + } + Nagios_contact <||> { + notify => Service['nagios'], + } + Nagios_contactgroup <||> { + notify => Service['nagios'], + } + Nagios_host <||> { + notify => Service['nagios'], + } + Nagios_hostdependency <||> { + notify => Service['nagios'], + } + Nagios_hostescalation <||> { + notify => Service['nagios'], + } + Nagios_hostextinfo <||> { + notify => Service['nagios'], + } + Nagios_hostgroup <||> { + notify => Service['nagios'], + } + Nagios_service <||> { + notify => Service['nagios'], + } + Nagios_servicegroup <||> { + notify => Service['nagios'], + } + Nagios_servicedependency <||> { + notify => Service['nagios'], + } + Nagios_serviceescalation <||> { + notify => Service['nagios'], + } + Nagios_serviceextinfo <||> { + notify => Service['nagios'], + } + Nagios_timeperiod <||> { + notify => Service['nagios'], + } +} |