summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2010-10-17 19:11:16 -0400
committerMicah Anderson <micah@riseup.net>2010-10-17 19:11:16 -0400
commit5cb689737e367ce751956575b11b0d46bf241f91 (patch)
treec0f9bddd00f66262e8d38ebb31fd74986b95ba1f /manifests
parent0ab822f209fd5b4e703f7608b375ba5780fa5364 (diff)
parent25e0862d29da6b99b1195942cc994780fbbf68ab (diff)
Merge remote branch 'ng/master'
Diffstat (limited to 'manifests')
-rw-r--r--manifests/apache.pp2
-rw-r--r--manifests/base.pp111
-rw-r--r--manifests/debian.pp2
-rw-r--r--manifests/defaults/commands.pp2
-rw-r--r--manifests/defaults/host_templates.pp12
-rw-r--r--manifests/defaults/hostgroups.pp20
-rw-r--r--manifests/defaults/service_templates.pp18
-rw-r--r--manifests/defaults/templates.pp13
-rw-r--r--manifests/defaults/vars.pp10
-rw-r--r--manifests/nsca/client.pp6
-rw-r--r--manifests/nsca/server.pp6
-rw-r--r--manifests/plugin.pp9
12 files changed, 120 insertions, 91 deletions
diff --git a/manifests/apache.pp b/manifests/apache.pp
index 36994f8..c00b1d9 100644
--- a/manifests/apache.pp
+++ b/manifests/apache.pp
@@ -1,4 +1,4 @@
-class nagios::apache {
+class nagios::apache inherits ::apache {
$nagios_httpd = 'apache'
include nagios
}
diff --git a/manifests/base.pp b/manifests/base.pp
index 13e13fd..a32edcf 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -1,4 +1,6 @@
class nagios::base {
+ # include the variables
+ include nagios::defaults::vars
package { 'nagios':
alias => 'nagios',
@@ -14,37 +16,37 @@ class nagios::base {
# this file should contain all the nagios_puppet-paths:
file { 'nagios_main_cfg':
- path => "${nagios_cfgdir}/nagios.cfg",
- source => [ "puppet://$server/modules/site-nagios/configs/${fqdn}/nagios.cfg",
- "puppet://$server/modules/site-nagios/configs/${operatingsystem}/nagios.cfg",
- "puppet://$server/modules/site-nagios/configs/nagios.cfg",
- "puppet://$server/modules/nagios/configs/${operatingsystem}/nagios.cfg",
- "puppet://$server/modules/nagios/configs/nagios.cfg" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/nagios.cfg",
+ source => [ "puppet:///modules/site-nagios/configs/${fqdn}/nagios.cfg",
+ "puppet:///modules/site-nagios/configs/${operatingsystem}/nagios.cfg",
+ "puppet:///modules/site-nagios/configs/nagios.cfg",
+ "puppet:///modules/nagios/configs/${operatingsystem}/nagios.cfg",
+ "puppet:///modules/nagios/configs/nagios.cfg" ],
notify => Service['nagios'],
mode => 0644, owner => root, group => root;
}
file { 'nagios_cgi_cfg':
- path => "${nagios_cfgdir}/cgi.cfg",
- source => [ "puppet://$server/modules/site-nagios/configs/${fqdn}/cgi.cfg",
- "puppet://$server/modules/site-nagios/configs/${operatingsystem}/cgi.cfg",
- "puppet://$server/modules/site-nagios/configs/cgi.cfg",
- "puppet://$server/modules/nagios/configs/${operatingsystem}/cgi.cfg",
- "puppet://$server/modules/nagios/configs/cgi.cfg" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/cgi.cfg",
+ source => [ "puppet:///modules/site-nagios/configs/${fqdn}/cgi.cfg",
+ "puppet:///modules/site-nagios/configs/${operatingsystem}/cgi.cfg",
+ "puppet:///modules/site-nagios/configs/cgi.cfg",
+ "puppet:///modules/nagios/configs/${operatingsystem}/cgi.cfg",
+ "puppet:///modules/nagios/configs/cgi.cfg" ],
mode => '0644', owner => 'root', group => 0,
notify => Service['apache'],
}
file { 'nagios_htpasswd':
- path => "${nagios_cfgdir}/htpasswd.users",
- source => [ "puppet://$server/modules/site-nagios/htpasswd.users",
- "puppet://$server/modules/nagios/htpasswd.users" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/htpasswd.users",
+ source => [ "puppet:///modules/site-nagios/htpasswd.users",
+ "puppet:///modules/nagios/htpasswd.users" ],
mode => 0640, owner => root, group => apache;
}
file { 'nagios_private':
- path => "${nagios_cfgdir}/private/",
- source => "puppet://$server/modules/common/empty",
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/",
+ source => "puppet:///modules/common/empty",
ensure => directory,
purge => true,
recurse => true,
@@ -53,16 +55,16 @@ class nagios::base {
}
file { 'nagios_private_resource_cfg':
- path => "${nagios_cfgdir}/private/resource.cfg",
- source => [ "puppet://$server/modules/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}",
- "puppet://$server/modules/site-nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/resource.cfg",
+ source => [ "puppet:///modules/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}",
+ "puppet:///modules/site-nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}" ],
notify => Service['nagios'],
owner => root, group => nagios, mode => '0640';
}
file { 'nagios_confd':
- path => "${nagios_cfgdir}/conf.d/",
- source => "puppet://$server/modules/common/empty",
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/",
+ source => "puppet:///modules/common/empty",
ensure => directory,
purge => true,
recurse => true,
@@ -84,68 +86,81 @@ class nagios::base {
Nagios_serviceescalation <<||>>
Nagios_serviceextinfo <<||>>
Nagios_timeperiod <<||>>
+ File <<| tag == 'nagios_plugin' |>>
Nagios_command <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_command.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_contact <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_contact.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contact.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_contactgroup <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_contactgroup.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contactgroup.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_host <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_host.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_host.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_hostextinfo <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_hostgroup <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_hostgroup.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroup.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_hostgroupescalation <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_service <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_service.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_servicedependency <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_servicedependency.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicedependency.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_serviceescalation <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_serviceextinfo <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
Nagios_timeperiod <||> {
- target => "${nagios_cfgdir}/conf.d/nagios_timeperiod.cfg",
+ target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_timeperiod.cfg",
+ require => File['nagios_confd'],
notify => Service['nagios'],
}
- file{[ "${nagios_cfgdir}/conf.d/nagios_command.cfg",
- "${nagios_cfgdir}/conf.d/nagios_contact.cfg",
- "${nagios_cfgdir}/conf.d/nagios_contactgroup.cfg",
- "${nagios_cfgdir}/conf.d/nagios_host.cfg",
- "${nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg",
- "${nagios_cfgdir}/conf.d/nagios_hostgroup.cfg",
- "${nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg",
- "${nagios_cfgdir}/conf.d/nagios_service.cfg",
- "${nagios_cfgdir}/conf.d/nagios_servicedependency.cfg",
- "${nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg",
- "${nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
- "${nagios_cfgdir}/conf.d/nagios_timeperiod.cfg" ]:
+ file{[ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contact.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_contactgroup.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_host.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroup.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_servicedependency.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg",
+ "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_timeperiod.cfg" ]:
ensure => file,
replace => false,
notify => Service['nagios'],
@@ -155,8 +170,8 @@ class nagios::base {
# manage nagios cfg files
# must be defined after exported resource overrides and cfg file defs
file { 'nagios_cfgdir':
- path => "${nagios_cfgdir}/",
- source => "puppet://$server/modules/common/empty",
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/",
+ source => "puppet:///modules/common/empty",
ensure => directory,
recurse => true,
purge => true,
diff --git a/manifests/debian.pp b/manifests/debian.pp
index a503324..b9e87ec 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -14,7 +14,7 @@ class nagios::debian inherits nagios::base {
File['nagios_htpasswd', 'nagios_cgi_cfg'] { group => 'www-data' }
- file { "${nagios_cfgdir}/stylesheets":
+ file { "${nagios::defaults::vars::int_nagios_cfgdir}/stylesheets":
ensure => directory,
purge => false,
recurse => true,
diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp
index 05460f5..bbb6ce5 100644
--- a/manifests/defaults/commands.pp
+++ b/manifests/defaults/commands.pp
@@ -49,7 +49,7 @@ class nagios::defaults::commands {
command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e';
check_ssh:
command_line => '$USER1$/check_ssh $HOSTADDRESS$';
- check_ssh_port:
+ ssh_port:
command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
check_http:
command_line => '$USER1$/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$';
diff --git a/manifests/defaults/host_templates.pp b/manifests/defaults/host_templates.pp
index 699b965..0f47324 100644
--- a/manifests/defaults/host_templates.pp
+++ b/manifests/defaults/host_templates.pp
@@ -12,12 +12,12 @@ class nagios::defaults::host_templates {
process_perf_data => '1',
retain_status_information => '1',
retain_nonstatus_information => '1',
- check_command => 'check-host-alive',
- max_check_attempts => '10',
- notification_interval => '0',
- notification_period => '24x7',
- notification_options => 'd,u,r',
- contact_groups => 'admins',
+ check_command => 'check-host-alive',
+ max_check_attempts => '10',
+ notification_interval => '0',
+ notification_period => '24x7',
+ notification_options => 'd,u,r',
+ contact_groups => 'admins',
register => '0',
}
diff --git a/manifests/defaults/hostgroups.pp b/manifests/defaults/hostgroups.pp
index 3a4f4d1..8715ade 100644
--- a/manifests/defaults/hostgroups.pp
+++ b/manifests/defaults/hostgroups.pp
@@ -1,13 +1,11 @@
class nagios::defaults::hostgroups {
-
- nagios_hostgroup {
- 'all':
- alias => 'All Servers',
- members => '*';
- 'debian-servers':
- alias => 'Debian GNU/Linux Servers';
- 'centos-servers':
- alias => 'CentOS GNU/Linux Servers';
- }
-
+ nagios_hostgroup {
+ 'all':
+ alias => 'All Servers',
+ members => '*';
+ 'debian-servers':
+ alias => 'Debian GNU/Linux Servers';
+ 'centos-servers':
+ alias => 'CentOS GNU/Linux Servers';
+ }
}
diff --git a/manifests/defaults/service_templates.pp b/manifests/defaults/service_templates.pp
index 326ce05..84740af 100644
--- a/manifests/defaults/service_templates.pp
+++ b/manifests/defaults/service_templates.pp
@@ -17,15 +17,15 @@ class nagios::defaults::service_templates {
process_perf_data => '1',
retain_status_information => '1',
retain_nonstatus_information => '1',
- notification_interval => '0',
- is_volatile => '0',
- check_period => '24x7',
- normal_check_interval => '5',
- retry_check_interval => '1',
- max_check_attempts => '4',
- notification_period => '24x7',
- notification_options => 'w,u,c,r',
- contact_groups => 'admins',
+ notification_interval => '0',
+ is_volatile => '0',
+ check_period => '24x7',
+ normal_check_interval => '5',
+ retry_check_interval => '1',
+ max_check_attempts => '4',
+ notification_period => '24x7',
+ notification_options => 'w,u,c,r',
+ contact_groups => 'admins',
register => '0',
}
diff --git a/manifests/defaults/templates.pp b/manifests/defaults/templates.pp
index 752ba60..c97eee4 100644
--- a/manifests/defaults/templates.pp
+++ b/manifests/defaults/templates.pp
@@ -1,12 +1,13 @@
class nagios::defaults::templates {
+ include nagios::defaults::vars
file { 'nagios_templates':
- 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",
- "puppet://$server/modules/nagios/configs/${operatingsystem}/nagios_templates.cfg",
- "puppet://$server/modules/nagios/configs/nagios_templates.cfg" ],
+ path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_templates.cfg",
+ source => [ "puppet:///modules/site-nagios/configs/${fqdn}/nagios_templates.cfg",
+ "puppet:///modules/site-nagios/configs/${operatingsystem}/nagios_templates.cfg",
+ "puppet:///modules/site-nagios/configs/nagios_templates.cfg",
+ "puppet:///modules/nagios/configs/${operatingsystem}/nagios_templates.cfg",
+ "puppet:///modules/nagios/configs/nagios_templates.cfg" ],
notify => Service['nagios'],
mode => 0644, owner => root, group => root;
}
diff --git a/manifests/defaults/vars.pp b/manifests/defaults/vars.pp
new file mode 100644
index 0000000..6302f13
--- /dev/null
+++ b/manifests/defaults/vars.pp
@@ -0,0 +1,10 @@
+class nagios::defaults::vars {
+ case $nagios_cfgdir {
+ '': { $int_nagios_cfgdir = $operatingsystem ? {
+ centos => '/etc/nagios/',
+ default => '/etc/nagios3'
+ }
+ }
+ default: { $int_nagios_cfgdir = $nagios_cfgdir }
+ }
+}
diff --git a/manifests/nsca/client.pp b/manifests/nsca/client.pp
index 5314b3d..6e2c472 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}/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" ],
+ source => [ "puppet:///modules/site-nagios/nsca/{$fqdn}/send_nsca.cfg",
+ "puppet:///modules/site-nagios/nsca/send_nsca.cfg",
+ "puppet:///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 e1cb83c..9239f21 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}/modules/site-nagios/nsca/{$fqdn}/nsca.cfg",
- "puppet://${server}/modules/site-nagios/nsca/nsca.cfg",
- "puppet://${server}/modules/nagios/nsca/nsca.cfg" ],
+ source => [ "puppet:///modules/site-nagios/nsca/{$fqdn}/nsca.cfg",
+ "puppet:///modules/site-nagios/nsca/nsca.cfg",
+ "puppet:///modules/nagios/nsca/nsca.cfg" ],
owner => 'nagios',
group => 'nogroup',
mode => '400',
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 4789345..abaa6e5 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -1,13 +1,18 @@
define nagios::plugin(
+ $source = 'absent',
$ensure = present
){
- file{$name:
+ @@file{$name:
path => $hardwaremodel ? {
'x86_64' => "/usr/lib64/nagios/plugins/$name",
default => "/usr/lib/nagios/plugins/$name",
},
ensure => $ensure,
- source => "puppet://$server/modules/nagios/plugins/$name",
+ source => $source ? {
+ 'absent' => "puppet:///modules/nagios/plugins/$name",
+ default => "puppet:///modules/$source"
+ },
+ tag => 'nagios_plugin',
require => Package['nagios-plugins'],
owner => root, group => 0, mode => 0755;
}