From 4d4119d3c7b47ed34b7e014b3a9f9ff0bddda76c Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 7 Jun 2015 11:43:49 +0200 Subject: cleanup things a bit and make it possible to set a different fqdn --- manifests/target.pp | 22 +++++++++++++--------- manifests/target/fqdn.pp | 8 +++++--- 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 } } -- cgit v1.2.3