summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README67
-rw-r--r--files/configs/Debian/nagios.cfg2
-rw-r--r--manifests/base.pp25
-rw-r--r--manifests/service.pp6
4 files changed, 55 insertions, 45 deletions
diff --git a/README b/README
index 0949071..8a47ddd 100644
--- a/README
+++ b/README
@@ -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"
}
@@ -203,50 +203,51 @@ Examples
Usage example:
+~~~
node nagios {
- include nagios::apache
- include nagios::defaults
-
- # Declare another nagios command
- nagios::command { http_port: command_line
-=> '/usr/lib/nagios/plugins/check_http -p $ARG1$ -H $HOSTADDRESS$ -I
-$HOSTADDRESS$'
-
- # Declare unmanaged hosts
- nagios_host {
- 'router01.mydomain.com':
- alias => 'router01',
- notes => 'MyDomain Gateway',
- address => "10.0.0.1",
- use => 'generic-host';
- "router02.mydomain.com":
- alias => 'router02',
- address => '192.168.0.1',
- parents => 'router01',
- use => 'generic-host';
- }
+ class { 'nagios::apache': } -> class { 'nagios::defaults': }
+
+ # Declare another nagios command
+ nagios::command { http_port:
+ command_line => '/usr/lib/nagios/plugins/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$'
+ }
+
+ # Declare unmanaged hosts
+ nagios_host {
+ 'router01.mydomain.com':
+ alias => 'router01',
+ notes => 'MyDomain Gateway',
+ address => '10.0.0.1',
+ use => 'generic-host';
+ 'router02.mydomain.com':
+ alias => 'router02',
+ address => '192.168.0.1',
+ parents => 'router01',
+ use => 'generic-host';
+ }
}
node target {
- # Monitor this host
- class{'nagios::target':
- parents = 'router01'
- }
+ # Monitor this host
+ class{'nagios::target':
+ parents = 'router01'
+ }
- # monitor a service
- $apache2_port = 8080
- include apache2
+ # monitor a service
+ $apache2_port = 8080
+ include apache2
- # This actually does this somewhere:
- #nagios::service { "http_${apache2_port}":
- # check_command => "http_port!${apache2_port}"
- #}
+ # This actually does this somewhere:
+ #nagios::service { "http_${apache2_port}":
+ # check_command => "http_port!${apache2_port}"
+ #}
}
+~~~
TODO
====
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\""