summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/base.pp7
-rw-r--r--manifests/centos.pp8
-rw-r--r--manifests/debian.pp19
3 files changed, 27 insertions, 7 deletions
diff --git a/manifests/base.pp b/manifests/base.pp
index 0fb0e89..8cf1774 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -165,11 +165,4 @@ class nagios::base {
include munin::plugins::nagios
}
- if $nagios_allow_external_cmd {
- file { '/var/spool/nagios/cmd':
- ensure => 'directory',
- require => Package['nagios'],
- mode => 2660, owner => apache, group => nagios,
- }
- }
}
diff --git a/manifests/centos.pp b/manifests/centos.pp
index 6581b7a..4d9507b 100644
--- a/manifests/centos.pp
+++ b/manifests/centos.pp
@@ -8,4 +8,12 @@ class nagios::centos inherits nagios::base {
Service[nagios]{
hasstatus => true,
}
+
+ if ($nagios_allow_external_cmd) {
+ file { '/var/spool/nagios/cmd':
+ ensure => 'directory',
+ require => Package['nagios'],
+ mode => 2660, owner => apache, group => nagios,
+ }
+ }
}
diff --git a/manifests/debian.pp b/manifests/debian.pp
index 2d852f5..a503324 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -19,4 +19,23 @@ class nagios::debian inherits nagios::base {
purge => false,
recurse => true,
}
+
+ if ($nagios_allow_external_cmd) {
+ exec { 'nagios_external_cmd_perms_overrides':
+ command => 'dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw && dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3',
+ unless => 'dpkg-statoverride --list nagios www-data 2710 /var/lib/nagios3/rw && dpkg-statoverride --list nagios nagios 751 /var/lib/nagios3',
+ logoutput => false,
+ notify => Service['nagios'],
+ }
+ exec { 'nagios_external_cmd_perms_1':
+ command => 'chmod 0751 /var/lib/nagios3 && chown nagios:nagios /var/lib/nagios3',
+ unless => 'test "`stat -c "%a %U %G" /var/lib/nagios3`" = "751 nagios nagios"',
+ notify => Service['nagios'],
+ }
+ exec { 'nagios_external_cmd_perms_2':
+ command => 'chmod 2751 /var/lib/nagios3/rw && chown nagios:www-data /var/lib/nagios3/rw',
+ unless => 'test "`stat -c "%a %U %G" /var/lib/nagios3/rw`" = "2751 nagios www-data"',
+ notify => Service['nagios'],
+ }
+ }
}