summaryrefslogtreecommitdiff
path: root/puppet/modules/site_nagios/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'puppet/modules/site_nagios/manifests')
-rw-r--r--puppet/modules/site_nagios/manifests/init.pp7
-rw-r--r--puppet/modules/site_nagios/manifests/server.pp43
-rw-r--r--puppet/modules/site_nagios/manifests/server/add_contacts.pp4
-rw-r--r--puppet/modules/site_nagios/manifests/server/apache.pp18
-rw-r--r--puppet/modules/site_nagios/manifests/server/contactgroup.pp4
-rw-r--r--puppet/modules/site_nagios/manifests/server/hostgroup.pp6
-rw-r--r--puppet/modules/site_nagios/manifests/server/purge.pp19
7 files changed, 70 insertions, 31 deletions
diff --git a/puppet/modules/site_nagios/manifests/init.pp b/puppet/modules/site_nagios/manifests/init.pp
index eb08cdcb..f91bfc26 100644
--- a/puppet/modules/site_nagios/manifests/init.pp
+++ b/puppet/modules/site_nagios/manifests/init.pp
@@ -1,6 +1,13 @@
+# setup nagios on monitoring node
class site_nagios {
tag 'leap_service'
+
+ include site_config::default
+
Class['site_config::default'] -> Class['site_nagios']
include site_nagios::server
+
+ # remove leftovers on monitoring nodes
+ include site_config::remove::monitoring
}
diff --git a/puppet/modules/site_nagios/manifests/server.pp b/puppet/modules/site_nagios/manifests/server.pp
index cb6c8d95..aa9b956e 100644
--- a/puppet/modules/site_nagios/manifests/server.pp
+++ b/puppet/modules/site_nagios/manifests/server.pp
@@ -1,8 +1,7 @@
# configures nagios on monitoring node
+# lint:ignore:inherits_across_namespaces
class site_nagios::server inherits nagios::base {
-
- # First, purge old nagios config (see #1467)
- class { 'site_nagios::server::purge': }
+# lint:endignore
$nagios_hiera = hiera('nagios')
$nagiosadmin_pw = htpasswd_sha1($nagios_hiera['nagiosadmin_pw'])
@@ -22,17 +21,43 @@ class site_nagios::server inherits nagios::base {
# it in site_apache::common
httpd => 'absent',
allow_external_cmd => true,
- stored_config => false,
+ storeconfigs => false,
+ }
+
+ # Delete nagios config files provided by packages
+ # These don't get parsed by nagios.conf, but are
+ # still irritating duplicates to the real config
+ # files deployed by puppet in /etc/nagios3/
+ file { [
+ '/etc/nagios3/conf.d/contacts_nagios2.cfg',
+ '/etc/nagios3/conf.d/extinfo_nagios2.cfg',
+ '/etc/nagios3/conf.d/generic-host_nagios2.cfg',
+ '/etc/nagios3/conf.d/generic-service_nagios2.cfg',
+ '/etc/nagios3/conf.d/hostgroups_nagios2.cfg',
+ '/etc/nagios3/conf.d/localhost_nagios2.cfg',
+ '/etc/nagios3/conf.d/pnp4nagios.cfg',
+ '/etc/nagios3/conf.d/services_nagios2.cfg',
+ '/etc/nagios3/conf.d/timeperiods_nagios2.cfg' ]:
+ ensure => absent;
}
- file { '/etc/apache2/conf.d/nagios3.conf':
- ensure => link,
- target => '/usr/share/doc/nagios3-common/examples/apache2.conf',
- notify => Service['apache']
+ # deploy apache nagios3 config
+ # until https://gitlab.com/shared-puppet-modules-group/apache/issues/11
+ # is not fixed, we need to manually deploy the config file
+ file {
+ '/etc/apache2/conf-available/nagios3.conf':
+ ensure => present,
+ source => 'puppet:///modules/nagios/configs/apache2.conf',
+ require => [ Package['nagios3'], Package['apache2'] ];
+ '/etc/apache2/conf-enabled/nagios3.conf':
+ ensure => link,
+ target => '/etc/apache2/conf-available/nagios3.conf',
+ require => [ Package['nagios3'], Package['apache2'] ];
}
include site_apache::common
- include site_apache::module::headers
+ include site_webapp::common_vhost
+ include apache::module::headers
File ['nagios_htpasswd'] {
source => undef,
diff --git a/puppet/modules/site_nagios/manifests/server/add_contacts.pp b/puppet/modules/site_nagios/manifests/server/add_contacts.pp
index db507abf..b5c6f0a5 100644
--- a/puppet/modules/site_nagios/manifests/server/add_contacts.pp
+++ b/puppet/modules/site_nagios/manifests/server/add_contacts.pp
@@ -1,3 +1,4 @@
+# configure a nagios_contact
define site_nagios::server::add_contacts ($contact_emails) {
$environment = $name
@@ -11,6 +12,7 @@ define site_nagios::server::add_contacts ($contact_emails) {
host_notification_options => 'd,r',
service_notification_commands => 'notify-service-by-email',
host_notification_commands => 'notify-host-by-email',
- email => join($contact_emails, ', ')
+ email => join($contact_emails, ', '),
+ require => Package['nagios']
}
}
diff --git a/puppet/modules/site_nagios/manifests/server/apache.pp b/puppet/modules/site_nagios/manifests/server/apache.pp
index 8dbc7e9b..82962e89 100644
--- a/puppet/modules/site_nagios/manifests/server/apache.pp
+++ b/puppet/modules/site_nagios/manifests/server/apache.pp
@@ -1,7 +1,25 @@
+# set up apache for nagios
class site_nagios::server::apache {
+
include x509::variables
+
include site_config::x509::commercial::cert
include site_config::x509::commercial::key
include site_config::x509::commercial::ca
+ include apache::module::authn_file
+ # "AuthUserFile"
+ include apache::module::authz_user
+ # "AuthType Basic"
+ include apache::module::auth_basic
+ # "DirectoryIndex"
+ include apache::module::dir
+ include apache::module::php5
+ include apache::module::cgi
+
+ # apache >= 2.4, debian jessie
+ if ( $::lsbdistcodename == 'jessie' ) {
+ include apache::module::authn_core
+ }
+
}
diff --git a/puppet/modules/site_nagios/manifests/server/contactgroup.pp b/puppet/modules/site_nagios/manifests/server/contactgroup.pp
index 188c54f1..5e60dd06 100644
--- a/puppet/modules/site_nagios/manifests/server/contactgroup.pp
+++ b/puppet/modules/site_nagios/manifests/server/contactgroup.pp
@@ -1,6 +1,8 @@
+# configure a contactgroup
define site_nagios::server::contactgroup ($contact_emails) {
nagios_contactgroup { $name:
- members => $name
+ members => $name,
+ require => Package['nagios']
}
}
diff --git a/puppet/modules/site_nagios/manifests/server/hostgroup.pp b/puppet/modules/site_nagios/manifests/server/hostgroup.pp
index 6f85ca6d..0692fced 100644
--- a/puppet/modules/site_nagios/manifests/server/hostgroup.pp
+++ b/puppet/modules/site_nagios/manifests/server/hostgroup.pp
@@ -1,3 +1,7 @@
+# create a nagios hostsgroup
define site_nagios::server::hostgroup ($contact_emails) {
- nagios_hostgroup { $name: }
+ nagios_hostgroup { $name:
+ ensure => present,
+ require => Package['nagios']
+ }
}
diff --git a/puppet/modules/site_nagios/manifests/server/purge.pp b/puppet/modules/site_nagios/manifests/server/purge.pp
deleted file mode 100644
index 6815a703..00000000
--- a/puppet/modules/site_nagios/manifests/server/purge.pp
+++ /dev/null
@@ -1,19 +0,0 @@
-class site_nagios::server::purge inherits nagios::base {
- # we don't want to get /etc/nagios3 and /etc/nagios3/conf.d
- # purged, cause the check-mk-config-nagios3 package
- # places its templates in /etc/nagios3/conf.d/check_mk,
- # and check_mk -O updated it's nagios config in /etc/nagios3/conf.d/check_mk
- File['nagios_cfgdir'] {
- purge => false
- }
- File['nagios_confd'] {
- purge => false
- }
-
- # only purge files in the /etc/nagios3/conf.d/ dir, not in any subdir
- exec {'purge_conf.d':
- command => '/usr/bin/find /etc/nagios3/conf.d/ -maxdepth 1 -type f -exec rm {} \;',
- onlyif => '/usr/bin/find /etc/nagios3/conf.d/ -maxdepth 1 -type f | grep -q "/etc/nagios3/conf.d"',
- require => Package['nagios']
- }
-}