Add support for CentOS 6.5

Change-Id: If20fb41b79c461670c2fdeafd064a49018403677
This commit is contained in:
Swann Croiset 2015-08-25 18:17:04 +02:00
parent 7d3e57ff3f
commit c5a5da226d
9 changed files with 117 additions and 20 deletions

View File

@ -32,7 +32,9 @@ module Puppet::Parser::Functions
result[name] = {
'properties' => {
'address' => ip,
'hostgroups' => hash.select{|k,v| v.count{|n| n[name_key] == name} > 0 }.keys(),
# Note: due to incompatible behavior between ruby 1.8.7 and 1.9.3
# the select method return an Array or a Hash.
'hostgroups' => Hash[hash.select{|k,v| v.count{|n| n[name_key] == name} > 0 }].keys(),
'display_name' => display_name,
'alias' => display_name,
},

View File

@ -52,6 +52,7 @@ class lma_infra_alerting::nagios::hosts (
contact_groups => $lma_infra_alerting::params::nagios_contactgroup,
active_checks_enabled => 1,
passive_checks_enabled => 0,
max_check_attempts => $lma_infra_alerting::params::nagios_default_max_check_attempts_host,
use => $lma_infra_alerting::params::nagios_generic_host_template,
}
}

View File

@ -39,6 +39,7 @@ class lma_infra_alerting::nagios::service_status (
contact_groups => $contact_group,
active_checks_enabled => 1,
passive_checks_enabled => 0,
max_check_attempts => $lma_infra_alerting::params::nagios_default_max_check_attempts_host,
use => $lma_infra_alerting::params::nagios_generic_host_template,
}
}

View File

@ -47,6 +47,9 @@ class lma_infra_alerting::params {
$nagios_debug_level = 0
$nagios_process_performance_data = false
# required parameter for Hosts but not defined in the generic-host with CentOS
$nagios_default_max_check_attempts_host = 3
## Service statutes
#
# Following parameters check and retry intervals are the number of

View File

@ -32,7 +32,7 @@ class nagios::cgi (
default_vhost => false,
# prerequists for Nagios CGI
mpm_module => 'prefork',
default_mods => ['php', 'cgi'],
default_mods => ['php', 'cgi', 'authn_file', 'auth_basic', 'authz_user'],
# allow to use the Puppet user resource later in the manifest
manage_group => false,
manage_user => false,
@ -45,6 +45,7 @@ class nagios::cgi (
content => template("nagios/${nagios::params::apache_vhost_config_tpl}"),
}
$apache_user = $apache::user
case $::osfamily {
'Debian': {
# Nagios CGI is provided by a dedicated package
@ -62,7 +63,6 @@ class nagios::cgi (
# Fix a permission issue with Ubuntu
# to allow using external commands through the web UI
$apache_user = $apache::user
user { $apache_user:
groups => 'nagios',
require => Class[apache],
@ -73,12 +73,6 @@ class nagios::cgi (
require => Package[$package_name],
}
file { $htpasswd_file:
owner => root,
group => $apache_user,
mode => '0640',
require => Htpasswd[$user],
}
}
'Redhat': {
htpasswd { $user:
@ -91,4 +85,12 @@ class nagios::cgi (
fail('OS Familly not supported!')
}
}
# Ensure read right for Apache
file { $htpasswd_file:
owner => root,
group => $apache_user,
mode => '0640',
require => Htpasswd[$user],
}
}

View File

@ -86,6 +86,7 @@ class nagios(
"set check_external_commands ${external_command}",
"set command_check_interval ${command_check_interval}",
],
require => Package[$service_name],
notify => Class['nagios::server_service'],
}
}

View File

@ -13,21 +13,44 @@
# under the License.
#
class nagios::params {
$config_dir = '/etc/nagios3/conf.d'
$main_conf_file = '/etc/nagios3/nagios.cfg'
$nagios_service_name = 'nagios3'
# plugins
$nagios_plugin_package = 'nagios-plugins'
$nagios_plugin_dir = '/usr/lib/nagios/plugins'
case $::osfamily {
'Debian': {
$config_dir = '/etc/nagios3/conf.d'
$main_conf_file = '/etc/nagios3/nagios.cfg'
$nagios_service_name = 'nagios3'
# plugins
$nagios_plugin_package = 'nagios-plugins'
$nagios_plugin_dir = '/usr/lib/nagios/plugins'
# CGI
$nagios_cgi_package = 'nagios3-cgi'
$cgi_htpasswd_file = '/etc/nagios3/htpasswd.users'
$apache_service_name = 'apache2'
$apache_vhost_config_tpl = 'apache_vhost_ubuntu.conf.erb'
}
'RedHat': {
$config_dir = '/etc/nagios/conf.d'
$main_conf_file = '/etc/nagios/nagios.cfg'
$nagios_service_name = 'nagios'
# plugins
$nagios_plugin_package = ['nagios-plugins-ping', 'nagios-plugins-load', 'nagios-plugins-users',
'nagios-plugins-ssh', 'nagios-plugins-swap', 'nagios-plugins-disk',
'nagios-plugins-procs', 'nagios-plugins-http']
$nagios_plugin_dir = '/usr/lib64/nagios/plugins/'
# CGI
$nagios_cgi_package = $nagios_service_name # CGI is provided by the same package
$cgi_htpasswd_file = '/etc/nagios/htpasswd'
$apache_service_name = 'httpd'
$apache_vhost_config_tpl = 'apache_vhost_centos.conf.erb'
}
default: {
fail("${::osfamily} not supported")
}
}
# CGI
$nagios_cgi_package = 'nagios3-cgi'
$cgi_htpasswd_file = '/etc/nagios3/htpasswd.users'
$cgi_user = 'nagiosadmin'
$cgi_password = undef
$cgi_http_port = '80'
$apache_vhost_config_tpl = 'apache_vhost_ubuntu.conf.erb'
# Nagios server configurations
$nagios_debug = false

View File

@ -0,0 +1,36 @@
# ************************************
# Vhost template in module nagios
# Managed by Puppet
# ************************************
<VirtualHost <%= @vhost_listen_ip %>:<%= @http_port %>>
ServerName nagios
DocumentRoot "/usr/share/nagios/html"
# Alias for UI
ScriptAlias /nagios/cgi-bin /usr/lib64/nagios/cgi-bin/
# Alias for HTTP commands
ScriptAlias /cgi-bin /usr/lib64/nagios/cgi-bin/
# Aliases for static content
Alias /nagios /usr/share/nagios/html
<DirectoryMatch (/usr/lib64/nagios/cgi-bin/|/usr/share/nagios/html)>
Options FollowSymLinks
DirectoryIndex index.php index.html
AllowOverride AuthConfig
Order Allow,Deny
Allow From All
AuthName "Nagios Access"
AuthType Basic
AuthUserFile <%= @cgi_htpasswd_file %>
require valid-user
</DirectoryMatch>
<Directory /usr/lib64/nagios/cgi-bin/>
Options +ExecCGI
</Directory>
ErrorLog "/var/log/httpd/nagios_error.log"
ServerSignature Off
CustomLog "/var/log/httpd/nagios_access.log" combined
</VirtualHost>

View File

@ -54,7 +54,35 @@ download_packages \
http://mirrors.kernel.org/ubuntu/pool/main/t/tdb/python-tdb_1.2.12-1_amd64.deb\
http://mirrors.kernel.org/ubuntu/pool/main/s/samba/python-samba_4.1.6+dfsg-1ubuntu2.14.04.7_amd64.deb\
http://mirrors.kernel.org/ubuntu/pool/main/w/whois/whois_5.1.1_amd64.deb\
http://mirrors.kernel.org/ubuntu/pool/universe/h/heirloom-mailx/heirloom-mailx_12.5-4_amd64.deb
http://mirrors.kernel.org/ubuntu/pool/universe/h/heirloom-mailx/heirloom-mailx_12.5-4_amd64.deb\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-3.5.1-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-common-3.5.1-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-bonding-1.4-3.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-cluster-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-dhcp-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-dig-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-disk-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-dns-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-dummy-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-fping-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-http-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-icmp-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-ifstatus-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-load-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-mailq-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-mysql-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-nagios-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-nrpe-2.15-2.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-ntp-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-ping-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-procs-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-smtp-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-snmp-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-ssh-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-tcp-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-swap-2.0.3-1.el6.x86_64.rpm\
http://dl.fedoraproject.org/pub/epel/6/x86_64/nagios-plugins-users-2.0.3-1.el6.x86_64.rpm
rm -rf "${MODULES_DIR:?}"/{openstack,stdlib,htpasswd,apache,concat}