aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-20 16:35:53 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-20 16:35:53 -0200
commit345d45b406010c59ec8cfae99f177fbe9df10a78 (patch)
tree365982e13c1a7de45ae015f4d18b112189b39ea2
parenteed6dead26492eaae8b13f66593406cd5a168285 (diff)
downloadpuppet-nodo-345d45b406010c59ec8cfae99f177fbe9df10a78.tar.gz
puppet-nodo-345d45b406010c59ec8cfae99f177fbe9df10a78.tar.bz2
Adding monitor class to wrap around nagios
-rw-r--r--manifests/host.pp12
-rw-r--r--manifests/init.pp1
-rw-r--r--manifests/personal.pp11
-rw-r--r--manifests/subsystems/monitor.pp25
-rw-r--r--manifests/vserver.pp6
5 files changed, 39 insertions, 16 deletions
diff --git a/manifests/host.pp b/manifests/host.pp
index fe1ca61..cae28ce 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -17,14 +17,10 @@ class nodo::host inherits nodo {
$vserver_vdirbase = "/var/vservers"
include vserver::host
- if $use_nagios != false {
- if $use_nagios_fqdn == true {
- include nagios::target::fqdn
- }
- else {
- include nagios::target
- }
- nagios::service::ping { "$fqdn": }
+ # Monitoring
+ class { 'monitor':
+ type => 'host',
+ use_nagios => extlookup('host_use_nagios', 'true'),
}
# Time configuration
diff --git a/manifests/init.pp b/manifests/init.pp
index a3f32bf..2c08011 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -84,6 +84,7 @@ import "subsystems/resolver.pp"
import "subsystems/domain.pp"
import "subsystems/dhclient.pp"
import "subsystems/mount.pp"
+import "subsystems/monitor.pp"
import "subsystems/utils.pp"
import "subsystems/utils/debian.pp"
import "subsystems/utils/desktop.pp"
diff --git a/manifests/personal.pp b/manifests/personal.pp
index 721836b..1626f0c 100644
--- a/manifests/personal.pp
+++ b/manifests/personal.pp
@@ -1,10 +1,5 @@
# personal computer
class nodo::personal {
-
- case $use_nagios {
- '': { $use_nagios = false }
- }
-
include nodo::physical
include utils::personal
include pam
@@ -14,6 +9,12 @@ class nodo::personal {
include gdm
}
+ # Monitoring
+ class { 'monitor':
+ type => 'personal',
+ use_nagios => extlookup('personal_use_nagios', 'false'),
+ }
+
# Currently tor management just works for debian
case $operatingsystem {
debian: {
diff --git a/manifests/subsystems/monitor.pp b/manifests/subsystems/monitor.pp
new file mode 100644
index 0000000..5be3509
--- /dev/null
+++ b/manifests/subsystems/monitor.pp
@@ -0,0 +1,25 @@
+class monitor(
+ $type = 'vserver',
+ $use_nagios = true,
+) {
+
+ if $use_nagios != false {
+
+ if $type == 'vserver' {
+ include nagios::target::fqdn
+ nagios::service::ping { "$fqdn": }
+ }
+
+ if $type == 'host' or $type == 'personal' {
+ if extlookup('use_nagios_fqdn', false) == true {
+ include nagios::target::fqdn
+ }
+ else {
+ include nagios::target
+ }
+ nagios::service::ping { "$fqdn": }
+ }
+
+ }
+
+}
diff --git a/manifests/vserver.pp b/manifests/vserver.pp
index fdd8ed2..21bed26 100644
--- a/manifests/vserver.pp
+++ b/manifests/vserver.pp
@@ -46,9 +46,9 @@ class nodo::vserver inherits nodo {
}
# Nagios configuration
- if $use_nagios != false {
- include nagios::target::fqdn
- nagios::service::ping { "$fqdn": }
+ class { 'monitor':
+ type => 'vserver',
+ use_nagios => extlookup('vserver_use_nagios', 'false'),
}
}
}