summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README37
-rw-r--r--files/configs/Debian/nagios.cfg2
-rw-r--r--manifests/base.pp3
-rw-r--r--manifests/defaults/commands.pp80
-rw-r--r--manifests/defaults/templates.pp2
-rw-r--r--manifests/nsca/client.pp6
-rw-r--r--manifests/nsca/server.pp6
-rw-r--r--manifests/target/fqdn.pp (renamed from manifests/target/nat.pp)2
8 files changed, 98 insertions, 40 deletions
diff --git a/README b/README
index cdcb5d3..4f84a84 100644
--- a/README
+++ b/README
@@ -12,7 +12,10 @@ In it's current form, this module can be used on CentOS and Debian.
Overview
========
-To use the nagios resources, activate storeconfigs on the puppetmaster.
+To use the nagios resources, activate storeconfigs on the
+puppetmaster.
+
+You need to be running verison 0.25 or later of puppet.
Monitor
@@ -28,8 +31,11 @@ Hosts
-----
On a node which shall be monitored with nagios, include the "nagios::target".
-This just creates a host declaration for this hosts "$fqdn".
-Set the $nagios_parent variable in the node scope for enabling the reachability
+This just creates a host declaration for this host's "$ipaddress" fact. If
+the $ipaddress of your target is not the one you wish to modify, you can use
+"nagios::target::fqdn" instead, which will use the $fqdn fact of the host instead.
+
+Set the $nagios_parents variable in the node scope for enabling the reachability
features of nagios. If a node needs more customisation, use the
native "@@nagios_host" type directly (the double-ampersand declares the object
as an exported resource).
@@ -60,6 +66,25 @@ Obviously, the check command must either be defined using nagios_command objects
files directly.
+Upgrade Notes
+=============
+
+The nagios::target bits have been reworked, the notable changes that
+may affect an upgrade are:
+
+. previous versions had nagios::target::nat which used the $fqdn for
+the address part of nagios::target, this has been renamed to
+nagios::target::fqdn to be more clear. if you were using
+nagios::target::nat then you will need to change those references to
+::fqdn
+
+. previous versions of this module used $fqdn for the nagios::target
+address, now it is using $ipaddress. If you need $fqdn, use
+nagios::target::fqdn instead of nagios::target
+
+. previous versions of nagios_host used the parameter named 'ip', that
+has been changed to 'address'
+
Caveats
=======
@@ -137,8 +162,8 @@ $HOSTADDRESS$'
node target {
- # Monitor this host
- $nagios_parent = 'router01'
+ # Monitor th () is host
+ $nagios_parents = 'router01'
include nagios::target
# monitor a service
@@ -167,3 +192,5 @@ License
Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
See the file LICENSE in the top directory for the full license.
+Copyright (C) 2010 Riseup Networks <micah@riseup.net>
+
diff --git a/files/configs/Debian/nagios.cfg b/files/configs/Debian/nagios.cfg
index a588f55..377da6b 100644
--- a/files/configs/Debian/nagios.cfg
+++ b/files/configs/Debian/nagios.cfg
@@ -26,7 +26,7 @@ cfg_dir=/etc/nagios3/conf.d
# Debian also defaults to using the check commands defined by the debian
# nagios-plugins package
-#cfg_dir=/etc/nagios-plugins/config
+cfg_dir=/etc/nagios-plugins/config
diff --git a/manifests/base.pp b/manifests/base.pp
index 47ef9f3..d609196 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -54,7 +54,8 @@ class nagios::base {
file { 'nagios_private_resource_cfg':
path => "${nagios_cfgdir}/private/resource.cfg",
- source => "puppet://$server/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}",
+ source => [ "puppet://$server/modules/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}",
+ "puppet://$server/modules/site-nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}" ],
notify => Service['nagios'],
owner => root, group => nagios, mode => '0640';
}
diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp
index c3190af..05460f5 100644
--- a/manifests/defaults/commands.pp
+++ b/manifests/defaults/commands.pp
@@ -2,54 +2,84 @@ class nagios::defaults::commands {
# common service commands
- nagios_command {
- check_dummy:
+ case $operatingsystem {
+ debian,ubuntu: {
+ nagios_command {
+ check_dummy:
command_line => '$USER1$/check_dummy $ARG1$';
- check_ping:
+ check_https_cert:
+ command_line => '$USER1$/check_http --ssl -C 20 -H $HOSTADDRESS$ -I $HOSTADDRESS$';
+ check_http_url:
+ command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$';
+ check_http_url_regex:
+ command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$';
+ check_https_url:
+ command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$';
+ check_https_url_regex:
+ command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$';
+ check_mysql_db:
+ command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$';
+ check_ntp_time:
+ command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1';
+ check_silc:
+ command_line => '$USER1$/check_tcp -p 706 -H $ARG1$';
+ check_sobby:
+ command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$';
+ check_jabber:
+ command_line => '$USER1$/check_jabber -H $ARG1$';
+ }
+ }
+ default: {
+ nagios_command {
+ check_dummy:
+ command_line => '$USER1$/check_dummy $ARG1$';
+ check_ping:
command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$';
- check-host-alive:
+ check-host-alive:
command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1';
- check_tcp:
+ check_tcp:
command_line => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$';
- check_udp:
+ check_udp:
command_line => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$';
- check_load:
+ check_load:
command_line => '$USER1$/check_load --warning=$ARG1$,$ARG2$,$ARG3$ --critical=$ARG4$,$ARG5$,$ARG6$';
- check_disk:
+ check_disk:
command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e -p $ARG3$';
- check_all_disks:
+ check_all_disks:
command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e';
- check_ssh:
+ check_ssh:
command_line => '$USER1$/check_ssh $HOSTADDRESS$';
- check_ssh_port:
+ check_ssh_port:
command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
- check_http:
+ check_http:
command_line => '$USER1$/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- check_https:
+ check_https:
command_line => '$USER1$/check_http --ssl -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- check_https_cert:
+ check_https_cert:
command_line => '$USER1$/check_http --ssl -C 20 -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- check_http_url:
+ check_http_url:
command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$';
- check_http_url_regex:
+ check_http_url_regex:
command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$';
- check_https_url:
+ check_https_url:
command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$';
- check_https_url_regex:
+ check_https_url_regex:
command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$';
- check_mysql:
+ check_mysql:
command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$';
- check_mysql_db:
+ check_mysql_db:
command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$';
- check_ntp_time:
+ check_ntp_time:
command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1';
- check_silc:
+ check_silc:
command_line => '$USER1$/check_tcp -p 706 -H $ARG1$';
- check_sobby:
+ check_sobby:
command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$';
- check_jabber:
+ check_jabber:
command_line => '$USER1$/check_jabber -H $ARG1$';
- }
+ }
+ }
+ }
# commands for services defined by other modules
diff --git a/manifests/defaults/templates.pp b/manifests/defaults/templates.pp
index 5a3d23d..752ba60 100644
--- a/manifests/defaults/templates.pp
+++ b/manifests/defaults/templates.pp
@@ -1,7 +1,7 @@
class nagios::defaults::templates {
file { 'nagios_templates':
- path => "${nagios::nagios_cfgdir}/conf.d/nagios_templates.cfg",
+ path => "${nagios_cfgdir}/conf.d/nagios_templates.cfg",
source => [ "puppet://$server/modules/site-nagios/configs/${fqdn}/nagios_templates.cfg",
"puppet://$server/modules/site-nagios/configs/${operatingsystem}/nagios_templates.cfg",
"puppet://$server/modules/site-nagios/configs/nagios_templates.cfg",
diff --git a/manifests/nsca/client.pp b/manifests/nsca/client.pp
index b4ca878..5314b3d 100644
--- a/manifests/nsca/client.pp
+++ b/manifests/nsca/client.pp
@@ -3,9 +3,9 @@ class nagios::nsca::client {
package { 'nsca': ensure => installed }
file { '/etc/send_nsca.cfg':
- source => [ "puppet://${server}/site-nagios/nsca/{$fqdn}/send_nsca.cfg",
- "puppet://${server}/site-nagios/nsca/send_nsca.cfg",
- "puppet://${server}/nagios/nsca/send_nsca.cfg" ],
+ source => [ "puppet://${server}/modules/site-nagios/nsca/{$fqdn}/send_nsca.cfg",
+ "puppet://${server}/modules/site-nagios/nsca/send_nsca.cfg",
+ "puppet://${server}/modules/nagios/nsca/send_nsca.cfg" ],
owner => 'nagios',
group => 'nogroup',
mode => '400',
diff --git a/manifests/nsca/server.pp b/manifests/nsca/server.pp
index c682e24..e1cb83c 100644
--- a/manifests/nsca/server.pp
+++ b/manifests/nsca/server.pp
@@ -9,9 +9,9 @@ class nagios::nsca::server {
}
file { '/etc/nsca.cfg':
- source => [ "puppet://${server}/site-nagios/nsca/{$fqdn}/nsca.cfg",
- "puppet://${server}/site-nagios/nsca/nsca.cfg",
- "puppet://${server}/nagios/nsca/nsca.cfg" ],
+ source => [ "puppet://${server}/modules/site-nagios/nsca/{$fqdn}/nsca.cfg",
+ "puppet://${server}/modules/site-nagios/nsca/nsca.cfg",
+ "puppet://${server}/modules/nagios/nsca/nsca.cfg" ],
owner => 'nagios',
group => 'nogroup',
mode => '400',
diff --git a/manifests/target/nat.pp b/manifests/target/fqdn.pp
index abb0a1e..acac5d6 100644
--- a/manifests/target/nat.pp
+++ b/manifests/target/fqdn.pp
@@ -1,4 +1,4 @@
-class nagios::target::nat inherits nagios::target {
+class nagios::target::fqdn inherits nagios::target {
Nagios_host["${fqdn}"] { address => "${fqdn}" }