diff options
author | Gabriel Filion <lelutin@gmail.com> | 2010-12-13 19:40:20 -0500 |
---|---|---|
committer | Gabriel Filion <lelutin@gmail.com> | 2010-12-14 00:22:39 -0500 |
commit | 12212a762f3c188fef94f763e3a006e49e3a333b (patch) | |
tree | 22ce00f51ef0ba73c3eb3276758ec55f9e1e62f5 | |
parent | 5d5ec8c28d0fe39359af8db159b14faeae397e1f (diff) |
Make nagios::apache manage the apache config.
Currently, the nagios module purges all files under the Nagios
configuration directory. This has the unwanted effect of removing files
that are added by default by the .deb packages, thus making the Nagios
interface non functional under apache.
To fix the situation, make nagios::apache under Debian manage the apache
config file and link to it in apache's conf.d directory, in the same
manner as the Debian packages do.
Signed-off-by: Gabriel Filion <lelutin@gmail.com>
-rw-r--r-- | files/configs/apache2.conf | 55 | ||||
-rw-r--r-- | manifests/apache.pp | 17 |
2 files changed, 72 insertions, 0 deletions
diff --git a/files/configs/apache2.conf b/files/configs/apache2.conf new file mode 100644 index 0000000..14bb38b --- /dev/null +++ b/files/configs/apache2.conf @@ -0,0 +1,55 @@ +# apache configuration for nagios 3.x +# note to users of nagios 1.x and 2.x: +# throughout this file are commented out sections which preserve +# backwards compatibility with bookmarks/config for older nagios versios. +# simply look for lines following "nagios 1.x:" and "nagios 2.x" comments. + +ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3 +ScriptAlias /nagios3/cgi-bin /usr/lib/cgi-bin/nagios3 +# nagios 1.x: +#ScriptAlias /cgi-bin/nagios /usr/lib/cgi-bin/nagios3 +#ScriptAlias /nagios/cgi-bin /usr/lib/cgi-bin/nagios3 +# nagios 2.x: +#ScriptAlias /cgi-bin/nagios2 /usr/lib/cgi-bin/nagios3 +#ScriptAlias /nagios2/cgi-bin /usr/lib/cgi-bin/nagios3 + +# Where the stylesheets (config files) reside +Alias /nagios3/stylesheets /etc/nagios3/stylesheets +# nagios 1.x: +#Alias /nagios/stylesheets /etc/nagios3/stylesheets +# nagios 2.x: +#Alias /nagios2/stylesheets /etc/nagios3/stylesheets + +# Where the HTML pages live +Alias /nagios3 /usr/share/nagios3/htdocs +# nagios 2.x: +#Alias /nagios2 /usr/share/nagios3/htdocs +# nagios 1.x: +#Alias /nagios /usr/share/nagios3/htdocs + +<DirectoryMatch (/usr/share/nagios3/htdocs|/usr/lib/cgi-bin/nagios3|/etc/nagios3/stylesheets)> + Options FollowSymLinks + + DirectoryIndex index.php index.html + + AllowOverride AuthConfig + Order Allow,Deny + Allow From All + + AuthName "Nagios Access" + AuthType Basic + AuthUserFile /etc/nagios3/htpasswd.users + # nagios 1.x: + #AuthUserFile /etc/nagios/htpasswd.users + require valid-user +</DirectoryMatch> + +# Enable this ScriptAlias if you want to enable the grouplist patch. +# See http://apan.sourceforge.net/download.html for more info +# It allows you to see a clickable list of all hostgroups in the +# left pane of the Nagios web interface +# XXX This is not tested for nagios 2.x use at your own peril +#ScriptAlias /nagios3/side.html /usr/lib/cgi-bin/nagios3/grouplist.cgi +# nagios 1.x: +#ScriptAlias /nagios/side.html /usr/lib/cgi-bin/nagios3/grouplist.cgi + diff --git a/manifests/apache.pp b/manifests/apache.pp index 36994f8..a91fee9 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -1,4 +1,21 @@ class nagios::apache { $nagios_httpd = 'apache' include nagios + + case $operatingsystem { + 'debian': { + file { "${nagios::nagios_cfgdir}/apache2.conf": + ensure => present, + source => ["puppet:///site-nagios/configs/${fqdn}/apache2.conf", + "puppet:///site-nagios/configs/apache2.conf", + "puppet:///nagios/configs/apache2.conf"], + } + + apache::config::global { "nagios3.conf": + ensure => link, + target => "${nagios::nagios_cfgdir}/apache2.conf", + require => File["${nagios::nagios_cfgdir}/apache2.conf"], + } + } + } } |