summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2015-06-07 11:43:49 +0200
committermh <mh@immerda.ch>2015-06-07 11:43:57 +0200
commit4d4119d3c7b47ed34b7e014b3a9f9ff0bddda76c (patch)
tree4333831a22a5b78445aff49c301a4ace08606d9e
parent60a2b8106a9403d786ca03a759035ad54d5976fc (diff)
cleanup things a bit and make it possible to set a different fqdn
-rw-r--r--manifests/target.pp22
-rw-r--r--manifests/target/fqdn.pp8
2 files changed, 18 insertions, 12 deletions
diff --git a/manifests/target.pp b/manifests/target.pp
index f9b7e13..82cf6a1 100644
--- a/manifests/target.pp
+++ b/manifests/target.pp
@@ -1,22 +1,26 @@
-# manifests/target.pp
-
+# a simple nagios target to monitor
class nagios::target(
- $parents = 'absent',
- $address = $::ipaddress,
+ $parents = 'absent',
+ $address = $::ipaddress,
$nagios_alias = $::hostname,
- $hostgroups = 'absent'
+ $hostgroups = 'absent',
+ $use = 'generic-host',
){
@@nagios_host { $::fqdn:
address => $address,
- alias => $nagios_alias,
- use => 'generic-host',
+ alias => $nagios_alias,
+ use => $use,
}
if ($parents != 'absent') {
- Nagios_host["${::fqdn}"] { parents => $parents }
+ Nagios_host[$::fqdn] {
+ parents => $parents
+ }
}
if ($hostgroups != 'absent') {
- Nagios_host["${::fqdn}"] { hostgroups => $hostgroups }
+ Nagios_host[$::fqdn] {
+ hostgroups => $hostgroups
+ }
}
}
diff --git a/manifests/target/fqdn.pp b/manifests/target/fqdn.pp
index 6bb16c1..31fc4b7 100644
--- a/manifests/target/fqdn.pp
+++ b/manifests/target/fqdn.pp
@@ -1,10 +1,12 @@
+# monitor a host by fqdn
class nagios::target::fqdn(
+ $address = $::fqdn,
$hostgroups = 'absent',
- $parents = 'absent'
+ $parents = 'absent'
) {
class{'nagios::target':
- address => $::fqdn,
+ address => $address,
hostgroups => $hostgroups,
- parents => $parents
+ parents => $parents
}
}