summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2009-12-01 13:33:36 -0500
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2009-12-01 13:33:36 -0500
commit1e7b51004868a762f577831e686d1b851e2b08c2 (patch)
treea9234a247aa0697635d04e1befbbe5db318ea7cb /manifests
parentc04458174e23b7b21f687cefdf11ac9a8aabf679 (diff)
Add support for Debian; split up package defaults and create new nagios::default resource; add support for lighttpd and headless httpd configurations; move common commands definitions into nagios::commands
Diffstat (limited to 'manifests')
-rw-r--r--manifests/apache.pp4
-rw-r--r--manifests/base.pp158
-rw-r--r--manifests/centos.pp40
-rw-r--r--manifests/commands.pp36
-rw-r--r--manifests/debian.pp14
-rw-r--r--manifests/default.pp14
-rw-r--r--manifests/headless.pp4
-rw-r--r--manifests/init.pp15
-rw-r--r--manifests/lighttpd.pp4
9 files changed, 167 insertions, 122 deletions
diff --git a/manifests/apache.pp b/manifests/apache.pp
new file mode 100644
index 0000000..36994f8
--- /dev/null
+++ b/manifests/apache.pp
@@ -0,0 +1,4 @@
+class nagios::apache {
+ $nagios_httpd = 'apache'
+ include nagios
+}
diff --git a/manifests/base.pp b/manifests/base.pp
index bd55ff9..5c7045e 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -1,111 +1,103 @@
class nagios::base {
- # needs apache to work
- include apache
-
- package { nagios:
- ensure => present,
+ package { 'nagios':
+ alias => 'nagios',
+ ensure => present,
}
- service{nagios:
+ service { 'nagios':
ensure => running,
enable => true,
#hasstatus => true, #fixme!
- require => Package[nagios],
+ require => Package['nagios'],
}
# manage nagios cfg files
- file {nagios_cfg_dir:
- path => '/etc/nagios',
+ file { 'nagios_cfg_dir':
+ path => "${nagios_cfg_dir}/",
source => "puppet://$server/modules/common/empty",
ensure => directory,
recurse => true,
purge => true,
- notify => Service[nagios],
+ notify => Service['nagios'],
mode => 0755, owner => root, group => root;
}
+
# this file should contain all the nagios_puppet-paths:
- file {nagios_main_cfg:
- path => "/etc/nagios/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" ],
- notify => Service[nagios],
+ file { 'nagios_main_cfg':
+ path => "${nagios_cfg_dir}/nagios.cfg",
+ source => [ "puppet://$server/files/nagios/configs/${fqdn}/nagios.cfg",
+ "puppet://$server/files/nagios/configs/${operatingsystem}/nagios.cfg",
+ "puppet://$server/files/nagios/configs/nagios.cfg",
+ "puppet://$server/nagios/configs/${operatingsystem}/nagios.cfg",
+ "puppet://$server/nagios/configs/nagios.cfg" ],
+ notify => Service['nagios'],
mode => 0644, owner => root, group => root;
- }
- file { nagios_cgi_cfg:
- path => "/etc/nagios/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" ],
- owner => 'root',
- group => 0,
- mode => '0644',
+ }
+
+ file { 'nagios_cgi_cfg':
+ path => "${nagios_cfg_dir}/cgi.cfg",
+ source => [ "puppet://$server/files/nagios/configs/${fqdn}/cgi.cfg",
+ "puppet://$server/files/nagios/configs/${operatingsystem}/cgi.cfg",
+ "puppet://$server/files/nagios/configs/cgi.cfg",
+ "puppet://$server/nagios/configs/${operatingsystem}/cgi.cfg",
+ "puppet://$server/nagios/configs/cgi.cfg" ],
+ mode => '0644', owner => 'root', group => 0,
notify => Service['apache'],
}
- file {"/etc/nagios/htpasswd.users":
- source => [
- "puppet://$server/modules/site-nagios/htpasswd.users",
- "puppet://$server/modules/nagios/htpasswd.users" ],
- mode => 0640, owner => root, group => apache;
+ file { 'nagios_htpasswd':
+ path => "${nagios_cfg_dir}/htpasswd.users",
+ source => [ "puppet://$server/files/nagios/htpasswd.users",
+ "puppet://$server/nagios/htpasswd.users" ],
+ mode => 0640, owner => root, group => apache;
+ }
+
+ file { 'nagios_private':
+ path => "${nagios_cfg_dir}/private/",
+ source => "puppet://$server/nagios/empty",
+ ensure => directory,
+ purge => true,
+ recurse => true,
+ notify => Service['nagios'],
+ mode => '0750', owner => root, group => nagios;
}
- file{[ "/etc/nagios/nagios_command.cfg",
- "/etc/nagios/nagios_contact.cfg",
- "/etc/nagios/nagios_contactgroup.cfg",
- "/etc/nagios/nagios_host.cfg",
- "/etc/nagios/nagios_hostextinfo.cfg",
- "/etc/nagios/nagios_hostgroup.cfg",
- "/etc/nagios/nagios_hostgroupescalation.cfg",
- "/etc/nagios/nagios_service.cfg",
- "/etc/nagios/nagios_servicedependency.cfg",
- "/etc/nagios/nagios_serviceescalation.cfg",
- "/etc/nagios/nagios_serviceextinfo.cfg",
- "/etc/nagios/nagios_timeperdiod.cfg" ]:
+
+ file { 'nagios_private_resource_cfg':
+ path => "${nagios_cfg_dir}/private/resource.cfg",
+ source => "puppet://$server/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}",
+ notify => Service['nagios'],
+ owner => root, group => nagios, mode => '0640';
+ }
+
+ file { 'nagios_defaults':
+ path => "${nagios_cfg_dir}/defaults/",
+ source => "puppet://$server/nagios/empty",
+ ensure => directory,
+ purge => true,
+ recurse => true,
+ notify => Service['nagios'],
+ mode => '0755', owner => root, group => nagios;
+ }
+
+ file{[ "${nagios_cfg_dir}/nagios_command.cfg",
+ "${nagios_cfg_dir}/nagios_contact.cfg",
+ "${nagios_cfg_dir}/nagios_contactgroup.cfg",
+ "${nagios_cfg_dir}/nagios_host.cfg",
+ "${nagios_cfg_dir}/nagios_hostextinfo.cfg",
+ "${nagios_cfg_dir}/nagios_hostgroup.cfg",
+ "${nagios_cfg_dir}/nagios_hostgroupescalation.cfg",
+ "${nagios_cfg_dir}/nagios_service.cfg",
+ "${nagios_cfg_dir}/nagios_servicedependency.cfg",
+ "${nagios_cfg_dir}/nagios_serviceescalation.cfg",
+ "${nagios_cfg_dir}/nagios_serviceextinfo.cfg",
+ "${nagios_cfg_dir}/nagios_timeperdiod.cfg" ]:
ensure => file,
replace => false,
- notify => Service[nagios],
+ notify => Service['nagios'],
mode => 0644, owner => root, group => 0;
}
- nagios::plugin{'check_jabber_login': }
-
- nagios::command{
- ssh_port:
- command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
- # from apache2.pp
- http_port:
- command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- # from bind.pp
- check_dig2:
- command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$';
- check_ntp_time:
- command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1';
- 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_https:
- command_line => '$USER1$/check_http -S -H $HOSTADDRESS$';
- 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$';
- check_jabber_login:
- command_line => '$USER1$/check_jabber_login $ARG1$ $ARG2$',
- require => Nagios::Plugin['check_jabber_login'];
- }
-
Nagios_command <<||>>
Nagios_contact <<||>>
Nagios_contactgroup <<||>>
@@ -124,10 +116,10 @@ class nagios::base {
}
if $nagios_allow_external_cmd {
- file{'/var/spool/nagios/cmd':
+ file { '/var/spool/nagios/cmd':
ensure => 'directory',
require => Package['nagios'],
- owner => apache, group => nagios, mode => 2660;
+ mode => 2660, owner => apache, group => nagios,
}
}
}
diff --git a/manifests/centos.pp b/manifests/centos.pp
index 95c8749..6581b7a 100644
--- a/manifests/centos.pp
+++ b/manifests/centos.pp
@@ -1,47 +1,11 @@
class nagios::centos inherits nagios::base {
+
package { [ 'nagios-plugins', 'nagios-plugins-smtp','nagios-plugins-http', 'nagios-plugins-ssh', 'nagios-plugins-udp', 'nagios-plugins-tcp', 'nagios-plugins-dig', 'nagios-plugins-nrpe', 'nagios-plugins-load', 'nagios-plugins-dns', 'nagios-plugins-ping', 'nagios-plugins-procs', 'nagios-plugins-users', 'nagios-plugins-ldap', 'nagios-plugins-disk', 'nagios-plugins-swap', 'nagios-plugins-nagios', 'nagios-plugins-perl', 'nagios-plugins-ntp', 'nagios-plugins-snmp' ]:
ensure => 'present',
- notify => Service[nagios],
+ notify => Service['nagios'],
}
Service[nagios]{
hasstatus => true,
}
-
- # default cmd file from rpm
- # don't forget it to add to the puppet paths
- file { nagios_commands_cfg:
- path => "/etc/nagios/commands.cfg",
- source => [ "puppet://$server/modules/site-nagios/configs/${fqdn}/commands.cfg",
- "puppet://$server/modules/site-nagios/configs/${operatingsystem}/commands.cfg",
- "puppet://$server/modules/nagios/configs/${operatingsystem}/commands.cfg" ],
- owner => 'root',
- group => 0,
- mode => '0644',
- notify => Service[nagios],
- }
- # default file from rpm
- file { nagios_localhost_cfg:
- path => "/etc/nagios/localhost.cfg",
- source => [ "puppet://$server/modules/site-nagios/configs/${fqdn}/localhost.cfg",
- "puppet://$server/modules/site-nagios/configs/${operatingsystem}/localhost.cfg",
- "puppet://$server/modules/nagios/configs/${operatingsystem}/localhost.cfg" ],
- owner => 'root',
- group => 0,
- mode => '0644',
- notify => Service[nagios],
- }
- file{"/etc/nagios/private":
- source => "puppet://$server/modules/common/empty",
- ensure => directory,
- purge => true,
- recurse => true,
- notify => Service[nagios],
- mode => '0750', owner => root, group => nagios;
- }
- file{"/etc/nagios/private/resource.cfg":
- source => "puppet://$server/modules/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}",
- notify => Service[nagios],
- owner => root, group => nagios, mode => '0640';
- }
}
diff --git a/manifests/commands.pp b/manifests/commands.pp
new file mode 100644
index 0000000..a67e6fd
--- /dev/null
+++ b/manifests/commands.pp
@@ -0,0 +1,36 @@
+class nagios::commands {
+
+ # a set of commonly used commands
+ nagios::command{
+ ssh_port:
+ command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
+ # from apache2.pp
+ http_port:
+ command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$';
+ # from bind.pp
+ check_dig2:
+ command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$';
+ check_ntp_time:
+ command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1';
+ 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_https:
+ command_line => '$USER1$/check_http -S -H $HOSTADDRESS$';
+ 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$';
+ check_jabber_login:
+ command_line => '$USER1$/check_jabber_login $ARG1$ $ARG2$',
+ require => Nagios::Plugin['check_jabber_login'];
+ }
+
+}
diff --git a/manifests/debian.pp b/manifests/debian.pp
new file mode 100644
index 0000000..fcc3a3d
--- /dev/null
+++ b/manifests/debian.pp
@@ -0,0 +1,14 @@
+class nagios::debian inherits nagios::base {
+
+ Package['nagios'] { name => 'nagios3' }
+
+ package { [ 'nagios-plugins', 'nagios-plugins-snmp','nagios-nrpe-plugin' ]:
+ ensure => 'present',
+ notify => Service['nagios'],
+ }
+
+ Service['nagios'] {
+ name => 'nagios3',
+ hasstatus => true,
+ }
+}
diff --git a/manifests/default.pp b/manifests/default.pp
new file mode 100644
index 0000000..daae94d
--- /dev/null
+++ b/manifests/default.pp
@@ -0,0 +1,14 @@
+define nagios::default {
+
+ file { "nagios_default_${name}" :
+ path => "${nagios_cfg_dir}/defaults/${name}.cfg",
+ source => [ "puppet://$server/files/nagios/configs/${fqdn}/defaults/${name}.cfg",
+ "puppet://$server/files/nagios/configs/${operatingsystem}/defaults/${name}.cfg",
+ "puppet://$server/files/nagios/configs/${name}.cfg",
+ "puppet://$server/nagios/configs/${operatingsystem}/defaults/${name}.cfg",
+ "puppet://$server/nagios/configs/defaults/${name}.cfg" ],
+ notify => Service['nagios'],
+ mode => 0644, owner => root, group => root;
+ }
+
+}
diff --git a/manifests/headless.pp b/manifests/headless.pp
new file mode 100644
index 0000000..cccfce7
--- /dev/null
+++ b/manifests/headless.pp
@@ -0,0 +1,4 @@
+class nagios::headless {
+ $nagios_httpd = 'absent'
+ include nagios
+}
diff --git a/manifests/init.pp b/manifests/init.pp
index 6eca55f..3d40ed6 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -15,8 +15,21 @@
#
class nagios {
+ case $nagios_httpd {
+ 'absent': { }
+ 'lighttpd': { include lighttpd }
+ 'apache': { include apache }
+ default: { include apache }
+ }
case $operatingsystem {
- centos: { include nagios::centos }
+ 'centos': {
+ $nagios_cfg_dir = '/etc/nagios'
+ include nagios::centos
+ }
+ 'debian': {
+ $nagios_cfg_dir = '/etc/nagios3'
+ include nagios::debian
+ }
default: { fail("No such operatingsystem: $operatingsystem yet defined") }
}
}
diff --git a/manifests/lighttpd.pp b/manifests/lighttpd.pp
new file mode 100644
index 0000000..27aff43
--- /dev/null
+++ b/manifests/lighttpd.pp
@@ -0,0 +1,4 @@
+class nagios::lighttpd {
+ $nagios_httpd = 'lighttpd'
+ include nagios
+}