diff options
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | files/configs/Debian/nagios.cfg | 2 | ||||
-rw-r--r-- | manifests/base.pp | 25 | ||||
-rw-r--r-- | manifests/service.pp | 6 |
4 files changed, 22 insertions, 13 deletions
@@ -73,7 +73,7 @@ nagios server define a service that will check the NRPE command 'check_cpu' on the current node: nagios::service { 'CPU Usage': - use_nrpe => 'true', + use_nrpe => true, check_command => "check_cpu", nrpe_args => "-t 60" } diff --git a/files/configs/Debian/nagios.cfg b/files/configs/Debian/nagios.cfg index 8eae393..41a2e3c 100644 --- a/files/configs/Debian/nagios.cfg +++ b/files/configs/Debian/nagios.cfg @@ -67,7 +67,7 @@ precached_object_file=/var/lib/nagios3/objects.precache # defined as macros in this file and restrictive permissions (600) # can be placed on this file. -resource_file=/etc/nagios3/private/resource.cfg +resource_file=/etc/nagios3/resource.cfg diff --git a/manifests/base.pp b/manifests/base.pp index 0f8b777..8f99564 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -44,17 +44,26 @@ class nagios::base { mode => 0640, owner => root, group => apache; } - file { 'nagios_private': - path => "${nagios::defaults::vars::int_cfgdir}/private/", - ensure => directory, - purge => true, - recurse => true, - notify => Service['nagios'], - mode => '0750', owner => root, group => nagios; + if $::operatingsystem == 'Centos' { + file { 'nagios_private': + ensure => directory, + path => "${nagios::defaults::vars::int_cfgdir}/private/", + purge => true, + recurse => true, + mode => '0750', + owner => 'root', + group => 'nagios', + notify => Service['nagios'], + } + + $resource_cfg_dir = "${nagios::defaults::vars::int_cfgdir}/private" + } + else { + $resource_cfg_dir = $nagios::defaults::vars::int_cfgdir } file { 'nagios_private_resource_cfg': - path => "${nagios::defaults::vars::int_cfgdir}/private/resource.cfg", + path => "${resource_cfg_dir}/resource.cfg", source => [ "puppet:///modules/site_nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}", "puppet:///modules/nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}" ], notify => Service['nagios'], diff --git a/manifests/service.pp b/manifests/service.pp index 134d1f7..3e8f6c8 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -27,11 +27,11 @@ define nagios::service ( } if $ensure != 'absent' { - if $check_comand == 'absent' { + if $check_command == 'absent' { fail("Must pass a check_command to ${name} if it should be present") } - if ($use_nrpe == 'true') { - include nagios::command::nrpe_timeout + if ($use_nrpe == true) { + include nagios::command::nrpe_timeout if ($nrpe_args != '') { $real_check_command = "check_nrpe_timeout!$nrpe_timeout!$check_command!\"$nrpe_args\"" |