diff options
author | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2009-12-02 17:39:46 -0500 |
---|---|---|
committer | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2009-12-02 17:39:46 -0500 |
commit | fdaba117fb5b58adb73ba20046dada3cf9247161 (patch) | |
tree | b864a737f7d1f2c3e705fe495826850b60a2055e | |
parent | 04cb2af5acc7811596aa0542ec08d39a17459907 (diff) |
move puppet nagios resources down into conf.d
-rw-r--r-- | files/configs/CentOS/nagios.cfg | 45 | ||||
-rw-r--r-- | files/configs/Debian/nagios.cfg | 56 | ||||
-rw-r--r-- | manifests/base.pp | 72 | ||||
-rw-r--r-- | manifests/init.pp | 4 |
4 files changed, 40 insertions, 137 deletions
diff --git a/files/configs/CentOS/nagios.cfg b/files/configs/CentOS/nagios.cfg index f72a344..cddcbf3 100644 --- a/files/configs/CentOS/nagios.cfg +++ b/files/configs/CentOS/nagios.cfg @@ -30,49 +30,8 @@ log_file=/var/log/nagios/nagios.log # This can be very useful if you want to keep command definitions # separate from host and contact definitions... -# all puppet native command paths -cfg_file=/etc/nagios/nagios_command.cfg -cfg_file=/etc/nagios/nagios_contact.cfg -cfg_file=/etc/nagios/nagios_contactgroup.cfg -cfg_file=/etc/nagios/nagios_host.cfg -cfg_file=/etc/nagios/nagios_hostextinfo.cfg -cfg_file=/etc/nagios/nagios_hostgroup.cfg -cfg_file=/etc/nagios/nagios_hostgroupescalation.cfg -cfg_file=/etc/nagios/nagios_service.cfg -cfg_file=/etc/nagios/nagios_servicedependency.cfg -cfg_file=/etc/nagios/nagios_serviceescalation.cfg -cfg_file=/etc/nagios/nagios_serviceextinfo.cfg -cfg_file=/etc/nagios/nagios_timeperdiod.cfg - -# Defaults for CentOS -cfg_dir=/etc/nagios/defaults - -# You can split other types of object definitions across several -# config files if you wish (as done here), or keep them all in a -# single config file. - -#cfg_file=/etc/nagios/contactgroups.cfg -#cfg_file=/etc/nagios/contacts.cfg -#cfg_file=/etc/nagios/dependencies.cfg -#cfg_file=/etc/nagios/escalations.cfg -#cfg_file=/etc/nagios/hostgroups.cfg -#cfg_file=/etc/nagios/hosts.cfg -#cfg_file=/etc/nagios/services.cfg -#cfg_file=/etc/nagios/timeperiods.cfg - -# Extended host/service info definitions are now stored along with -# other object definitions: -#cfg_file=/etc/nagios/hostextinfo.cfg -#cfg_file=/etc/nagios/serviceextinfo.cfg - -# You can also tell Nagios to process all config files (with a .cfg -# extension) in a particular directory by using the cfg_dir -# directive as shown below: - -#cfg_dir=/etc/nagios/servers -#cfg_dir=/etc/nagios/printers -#cfg_dir=/etc/nagios/switches -#cfg_dir=/etc/nagios/routers +# Puppet-managed configuration files +cfg_dir=/etc/nagios3/conf.d diff --git a/files/configs/Debian/nagios.cfg b/files/configs/Debian/nagios.cfg index 46be0d7..377da6b 100644 --- a/files/configs/Debian/nagios.cfg +++ b/files/configs/Debian/nagios.cfg @@ -13,17 +13,7 @@ log_file=/var/log/nagios3/nagios.log -# Commands definitions -#cfg_file=/etc/nagios3/commands.cfg -# Debian also defaults to using the check commands defined by the debian -# nagios-plugins package -cfg_dir=/etc/nagios-plugins/config - -# Debian uses by default a configuration directory where nagios3-common, -# other packages and the local admin can dump or link configuration -# files into. -#cfg_dir=/etc/nagios3/conf.d # OBJECT CONFIGURATION FILE(S) # These are the object configuration files in which you define hosts, @@ -31,48 +21,12 @@ cfg_dir=/etc/nagios-plugins/config # You can split your object definitions across several config files # if you wish (as shown below), or keep them all in a single config file. -# all puppet native command paths -cfg_file=/etc/nagios3/nagios_command.cfg -cfg_file=/etc/nagios3/nagios_contact.cfg -cfg_file=/etc/nagios3/nagios_contactgroup.cfg -cfg_file=/etc/nagios3/nagios_host.cfg -cfg_file=/etc/nagios3/nagios_hostextinfo.cfg -cfg_file=/etc/nagios3/nagios_hostgroup.cfg -cfg_file=/etc/nagios3/nagios_hostgroupescalation.cfg -cfg_file=/etc/nagios3/nagios_service.cfg -cfg_file=/etc/nagios3/nagios_servicedependency.cfg -cfg_file=/etc/nagios3/nagios_serviceescalation.cfg -cfg_file=/etc/nagios3/nagios_serviceextinfo.cfg -cfg_file=/etc/nagios3/nagios_timeperdiod.cfg - -# Defaults for Debian -cfg_dir=/etc/nagios3/defaults - -# You can specify individual object config files as shown below: -#cfg_file=/etc/nagios3/objects/commands.cfg -#cfg_file=/etc/nagios3/objects/contacts.cfg -#cfg_file=/etc/nagios3/objects/timeperiods.cfg -#cfg_file=/etc/nagios3/objects/templates.cfg - -# Definitions for monitoring a Windows machine -#cfg_file=/etc/nagios3/objects/windows.cfg - -# Definitions for monitoring a router/switch -#cfg_file=/etc/nagios3/objects/switch.cfg - -# Definitions for monitoring a network printer -#cfg_file=/etc/nagios3/objects/printer.cfg - - -# You can also tell Nagios to process all config files (with a .cfg -# extension) in a particular directory by using the cfg_dir -# directive as shown below: - -#cfg_dir=/etc/nagios3/servers -#cfg_dir=/etc/nagios3/printers -#cfg_dir=/etc/nagios3/switches -#cfg_dir=/etc/nagios3/routers +# Puppet-managed configuration files +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 diff --git a/manifests/base.pp b/manifests/base.pp index 4ee8097..81cd3cb 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -14,7 +14,7 @@ class nagios::base { # this file should contain all the nagios_puppet-paths: file { 'nagios_main_cfg': - path => "${nagios_cfg_dir}/nagios.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", @@ -25,7 +25,7 @@ class nagios::base { } file { 'nagios_cgi_cfg': - path => "${nagios_cfg_dir}/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", @@ -36,14 +36,14 @@ class nagios::base { } file { 'nagios_htpasswd': - path => "${nagios_cfg_dir}/htpasswd.users", + path => "${nagios_cfgdir}/htpasswd.users", source => [ "puppet://$server/modules/site-nagios/htpasswd.users", "puppet://$server/modules/nagios/htpasswd.users" ], mode => 0640, owner => root, group => apache; } file { 'nagios_private': - path => "${nagios_cfg_dir}/private/", + path => "${nagios_cfgdir}/private/", source => "puppet://$server/modules/common/empty", ensure => directory, purge => true, @@ -53,22 +53,12 @@ class nagios::base { } file { 'nagios_private_resource_cfg': - path => "${nagios_cfg_dir}/private/resource.cfg", + path => "${nagios_cfgdir}/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/modules/common/empty", - ensure => directory, - purge => true, - recurse => true, - notify => Service['nagios'], - mode => '0755', owner => root, group => nagios; - } - Nagios_command <<||>> Nagios_contact <<||>> Nagios_contactgroup <<||>> @@ -83,66 +73,66 @@ class nagios::base { Nagios_timeperiod <<||>> Nagios_command <||> { - target => "${nagios_cfg_dir}/nagios_command.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_command.cfg", notify => Service['nagios'], } Nagios_contact <||> { - target => "${nagios_cfg_dir}/nagios_contact.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_contact.cfg", notify => Service['nagios'], } Nagios_contactgroup <||> { - target => "${nagios_cfg_dir}/nagios_contactgroup.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_contactgroup.cfg", notify => Service['nagios'], } Nagios_host <||> { - target => "${nagios_cfg_dir}/nagios_host.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_host.cfg", notify => Service['nagios'], } Nagios_hostextinfo <||> { - target => "${nagios_cfg_dir}/nagios_hostextinfo.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg", notify => Service['nagios'], } Nagios_hostgroup <||> { - target => "${nagios_cfg_dir}/nagios_hostgroup.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_hostgroup.cfg", notify => Service['nagios'], } Nagios_hostgroupescalation <||> { - target => "${nagios_cfg_dir}/nagios_hostgroupescalation.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", notify => Service['nagios'], } Nagios_service <||> { - target => "${nagios_cfg_dir}/nagios_service.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_service.cfg", notify => Service['nagios'], } Nagios_servicedependency <||> { - target => "${nagios_cfg_dir}/nagios_servicedependency.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_servicedependency.cfg", notify => Service['nagios'], } Nagios_serviceescalation <||> { - target => "${nagios_cfg_dir}/nagios_serviceescalation.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg", notify => Service['nagios'], } Nagios_serviceextinfo <||> { - target => "${nagios_cfg_dir}/nagios_serviceextinfo.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg", notify => Service['nagios'], } Nagios_timeperiod <||> { - target => "${nagios_cfg_dir}/nagios_timeperiod.cfg", + target => "${nagios_cfgdir}/conf.d/nagios_timeperiod.cfg", notify => Service['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" ]: + 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_timeperdiod.cfg" ]: ensure => file, replace => false, notify => Service['nagios'], @@ -151,8 +141,8 @@ class nagios::base { # manage nagios cfg files # must be defined after exported resource overrides and cfg file defs - file { 'nagios_cfg_dir': - path => "${nagios_cfg_dir}/", + file { 'nagios_cfgdir': + path => "${nagios_cfgdir}/", source => "puppet://$server/modules/common/empty", ensure => directory, recurse => true, diff --git a/manifests/init.pp b/manifests/init.pp index 3d40ed6..1aecc3a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -23,11 +23,11 @@ class nagios { } case $operatingsystem { 'centos': { - $nagios_cfg_dir = '/etc/nagios' + $nagios_cfgdir = '/etc/nagios' include nagios::centos } 'debian': { - $nagios_cfg_dir = '/etc/nagios3' + $nagios_cfgdir = '/etc/nagios3' include nagios::debian } default: { fail("No such operatingsystem: $operatingsystem yet defined") } |