summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/apache.pp34
-rw-r--r--manifests/init.pp6
-rw-r--r--manifests/plugin.pp10
-rw-r--r--manifests/target.pp25
-rw-r--r--manifests/target/fqdn.pp11
5 files changed, 49 insertions, 37 deletions
diff --git a/manifests/apache.pp b/manifests/apache.pp
index 0696723..38026f7 100644
--- a/manifests/apache.pp
+++ b/manifests/apache.pp
@@ -1,22 +1,22 @@
class nagios::apache inherits ::apache {
- class{'nagios':
- httpd => 'apache'
- }
+ class{'nagios':
+ httpd => 'apache'
+ }
- case $::operatingsystem {
- 'debian': {
- file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf":
- ensure => present,
- source => ["puppet:///site_nagios/configs/${::fqdn}/apache2.conf",
- "puppet:///site_nagios/configs/apache2.conf",
- "puppet:///nagios/configs/apache2.conf"],
- }
+ case $::operatingsystem {
+ 'debian': {
+ file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf":
+ ensure => present,
+ source => [ "puppet:///site_nagios/configs/${::fqdn}/apache2.conf",
+ "puppet:///site_nagios/configs/apache2.conf",
+ "puppet:///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"],
- }
- }
+ apache::config::global { "nagios3.conf":
+ ensure => link,
+ target => "${nagios::defaults::vars::int_cfgdir}/apache2.conf",
+ require => File["${nagios::defaults::vars::int_cfgdir}/apache2.conf"],
+ }
}
+ }
}
diff --git a/manifests/init.pp b/manifests/init.pp
index d3a00df..9952cd9 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -20,9 +20,9 @@ class nagios(
) {
case $nagios::httpd {
'absent': { }
- 'lighttpd': { include lighttpd }
- 'apache': { include apache }
- default: { include apache }
+ 'lighttpd': { include ::lighttpd }
+ 'apache': { include ::apache }
+ default: { include ::apache }
}
case $::operatingsystem {
'centos': {
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index c2e7676..d32606b 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -3,14 +3,14 @@ define nagios::plugin(
$ensure = present
){
file{$name:
- path => $hardwaremodel ? {
- 'x86_64' => "/usr/lib64/nagios/plugins/$name",
- default => "/usr/lib/nagios/plugins/$name",
+ path => $::hardwaremodel ? {
+ 'x86_64' => "/usr/lib64/nagios/plugins/${name}",
+ default => "/usr/lib/nagios/plugins/${name}",
},
ensure => $ensure,
source => $source ? {
- 'absent' => "puppet:///modules/nagios/plugins/$name",
- default => "puppet:///modules/$source"
+ 'absent' => "puppet:///modules/nagios/plugins/${name}",
+ default => "puppet:///modules/${source}"
},
tag => 'nagios_plugin',
require => Package['nagios-plugins'],
diff --git a/manifests/target.pp b/manifests/target.pp
index fc39834..9a86c09 100644
--- a/manifests/target.pp
+++ b/manifests/target.pp
@@ -2,16 +2,21 @@
class nagios::target(
$parents = 'absent',
-) {
+ $address = $::ipaddress,
+ $nagios_alias = $::hostname,
+ $hostgroups = 'absent',
+){
+ @@nagios_host { $::fqdn:
+ address => $address,
+ alias => $nagios_alias,
+ use => 'generic-host',
+ }
- @@nagios_host { $::fqdn:
- address => $::ipaddress,
- alias => $::hostname,
- use => 'generic-host',
- }
-
- if ($parents != 'absent') {
- Nagios_host["${::fqdn}"] { parents => $parents }
- }
+ if ($parents != 'absent') {
+ Nagios_host["${::fqdn}"] { parents => $parents }
+ }
+ if ($hostgroups != 'absent') {
+ Nagios_host["${::fqdn}"] { hostgroups => $hostgroups }
+ }
}
diff --git a/manifests/target/fqdn.pp b/manifests/target/fqdn.pp
index 2521533..6bb16c1 100644
--- a/manifests/target/fqdn.pp
+++ b/manifests/target/fqdn.pp
@@ -1,3 +1,10 @@
-class nagios::target::fqdn inherits nagios::target {
- Nagios_host[$::fqdn] { address => $::fqdn }
+class nagios::target::fqdn(
+ $hostgroups = 'absent',
+ $parents = 'absent'
+) {
+ class{'nagios::target':
+ address => $::fqdn,
+ hostgroups => $hostgroups,
+ parents => $parents
+ }
}