summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-03-09 17:25:18 +0100
committervarac <varacanero@zeromail.org>2016-03-09 17:25:18 +0100
commit4081c66952614743b60b5031791cb43d23d48fa1 (patch)
tree48a1ec3e7f82e51e906d50fbc4cc60b8d466dc9c
parent53e2db13e5082f09fcee7d34ed83b3dfaef06e52 (diff)
parentbad75052820f221df575a1942417712e35ab1af7 (diff)
Merge remote-tracking branch 'shared/master' into leap_master
-rw-r--r--README24
-rw-r--r--manifests/apache.pp21
-rw-r--r--manifests/base.pp62
-rw-r--r--manifests/init.pp1
-rw-r--r--manifests/storeconfigs.pp61
5 files changed, 76 insertions, 93 deletions
diff --git a/README b/README
index f799090..0c42b4a 100644
--- a/README
+++ b/README
@@ -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,21 +12,13 @@ In it's current form, this module can be used on CentOS and Debian.
Overview
========
-Requirements
-------------
+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.
-To use the nrpe functionality, you will need the perl module installed.
+You need to be running version 0.25 or later of puppet.
-To use the nagios resources, activate storeconfigs on the
-puppetmaster.
-
-You need to be running verison 0.25 or later of puppet.
-
-! Upgrade Notice !
-
- * the irc bot variables changed, they previously had $nagios_ prepended
- but no longer have that. So you will need to change your local config
- to use $nsa_server instead of $nagios_nsa_server, for example.
Monitor
-------
@@ -159,7 +151,7 @@ IRC bot
Notifications can easily be sent to an IRC channel by using a bot. To do so,
simply include 'nagios::irc_bot' on the nagios server and define the right
-$nsa_* variables (see the 'Variables' section below).
+$nagios_nsa_* variables (see the 'Variables' section below).
You can then use the notification commands 'notify-by-irc' and
'host-notify-by-irc' with service and host definitions to make them report
@@ -203,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 8fa9061..87fe3d2 100644
--- a/manifests/apache.pp
+++ b/manifests/apache.pp
@@ -3,30 +3,13 @@ class nagios::apache(
$allow_external_cmd = false,
$manage_shorewall = false,
$manage_munin = false,
- $stored_config = true
+ $storeconfigs = true
) {
class{'::nagios':
httpd => 'apache',
allow_external_cmd => $allow_external_cmd,
manage_munin => $manage_munin,
manage_shorewall => $manage_shorewall,
- stored_config => $stored_config
- }
-
- case $::operatingsystem {
- 'debian': {
- file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf":
- ensure => present,
- source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/apache2.conf",
- "puppet:///modules/site_nagios/configs/apache2.conf",
- "puppet:///modules/nagios/configs/apache2.conf"],
- }
-
- apache::config::global { "nagios3.conf":
- ensure => link,
- target => "${nagios::defaults::vars::int_cfgdir}/apache2.conf",
- require => File["${nagios::defaults::vars::int_cfgdir}/apache2.conf"],
- }
- }
+ 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'],
+ }
+}