nagios-grid CHANGELOG
=====================
+0.2.0
+-----
+- add Nagios4 support.
+
0.1.7
-----
- bug fix.
## >= 2.3
default['nagios']['web']['Require'] = [
'all granted',
+ # Nagios4 default
+ #'ip ::1/128 fc00::/7 fe80::/10 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16',
]
## < 2.3
default['nagios']['web']['Order'] = 'Allow,Deny' # e.g. 'Deny,Allow'
nagios_pkgs = nil
nagios_service = nil
httpd_service = nil
+tpl_ctx = 'nagios3'
case node['platform_family']
when 'debian'
root_cfg_dir = '/etc/nagios3'
+ nagios_service = 'nagios3'
+ if platform == 'ubuntu' && platform_version >= '20.04'
+ root_cfg_dir = '/etc/nagios4'
+ nagios_service = 'nagios4'
+ end
+
nagios_pkgs = [
# Note: PHP is not php5 but php7.0 in Ubuntu 16.04 or later
- 'nagios-plugins',
+ 'nagios-plugins', # virtual package -> monitoring-plugins (>= Ubuntu 20.04)
'nagios-nrpe-plugin',
'nagios-images',
]
nagios_pkgs.push('libapache2-mod-auth-kerb')
end
- nagios_service = 'nagios3'
httpd_service = 'apache2'
httpd_nagios_conf = "#{root_cfg_dir}/apache2.conf"
when 'rhel'
'services-generic.cfg',
].each {|tpl|
template "#{base_cfg_dir}/#{tpl}" do
- source "etc/nagios3/base/#{tpl}"
+ source "etc/#{tpl_ctx}/base/#{tpl}"
owner 'root'
group 'root'
mode '0644'
'checkcommands.cfg',
].each {|cfg_file|
template "#{site_cfg_dir}/#{cfg_file}" do
- source "etc/nagios3/site/#{cfg_file}"
+ source "etc/#{tpl_ctx}/site/#{cfg_file}"
owner 'root'
group 'root'
mode '0644'
# can configure which people get to see a particular service from
# within the nagios configuration.
#
- Require ip ::1/128 fc00::/7 fe80::/10 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16
- <Files "cmd.cgi">
- AuthDigestDomain "Nagios4"
- AuthDigestProvider file
- AuthUserFile "/etc/nagios4/htdigest.users"
- AuthGroupFile "/etc/group"
- AuthName "Nagios4"
- AuthType Digest
- Require all granted
- #Require valid-user
- </Files>
+ <IfVersion < 2.3>
+ Order <%= node['nagios']['web']['Order'] %>
+<% node['nagios']['web']['Deny'].each do |from_where| -%>
+ Deny <%= from_where %>
+<% end -%>
+<% node['nagios']['web']['Allow'].each do |from_where| -%>
+ Allow <%= from_where %>
+<% end -%>
+ </IfVersion>
+
+ <IfVersion >= 2.3>
+ #Require ip ::1/128 fc00::/7 fe80::/10 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16
+<% node['nagios']['web']['Require'].each do |condition| -%>
+ Require <%= condition %>
+<% end -%>
+ </IfVersion>
+
+<%
+case node['nagios']['web']['AuthType']
+ when 'Basic'
+-%>
+ AuthName "Nagios Access"
+ AuthType Basic
+ AuthUserFile <%= node['nagios']['web']['mod_auth_basic']['AuthUserFile'] %>
+ Require valid-user
+<%
+ when 'Kerberos'
+-%>
+ AuthName "Nagios Access"
+ AuthType Kerberos
+ KrbAuthRealms <%= node['nagios']['web']['mod_auth_kerb']['KrbAuthRealms'] %>
+ KrbServiceName <%= node['nagios']['web']['mod_auth_kerb']['KrbServiceName'] %>
+ Krb5Keytab <%= node['nagios']['web']['mod_auth_kerb']['Krb5Keytab'] %>
+ KrbMethodNegotiate <%= node['nagios']['web']['mod_auth_kerb']['KrbMethodNegotiate'] %>
+ KrbMethodK5Passwd <%= node['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd'] %>
+ Require valid-user
+<% end -%>
+ # Note: requires a2enmod auth_digest authz_groupfile
+ # <Files "cmd.cgi">
+ # AuthDigestDomain "Nagios4"
+ # AuthDigestProvider file
+ # AuthUserFile "/etc/nagios4/htdigest.users"
+ # AuthGroupFile "/etc/group"
+ # AuthName "Nagios4"
+ # AuthType Digest
+ # Require all granted
+ # #Require valid-user
+ # </Files>
</DirectoryMatch>
<Directory /usr/share/nagios4/htdocs>
# not use authorization. You may use an asterisk (*) to
# authorize any user who has authenticated to the web server.
-authorized_for_system_information=nagiosadmin
+authorized_for_system_information=<%= node['nagios']['cgi']['authorized_for_system_information'] %>
# an asterisk (*) to authorize any user who has authenticated
# to the web server.
-authorized_for_configuration_information=nagiosadmin
+authorized_for_configuration_information=<%= node['nagios']['cgi']['authorized_for_configuration_information'] %>
# You may use an asterisk (*) to authorize any user who has
# authenticated to the web server.
-authorized_for_system_commands=nagiosadmin
+authorized_for_system_commands=<%= node['nagios']['cgi']['authorized_for_system_commands'] %>
# you choose to not use authorization). You may use an asterisk (*)
# to authorize any user who has authenticated to the web server.
-authorized_for_all_services=nagiosadmin
-authorized_for_all_hosts=nagiosadmin
+authorized_for_all_services=<%= node['nagios']['cgi']['authorized_for_all_services'] %>
+authorized_for_all_hosts=<%= node['nagios']['cgi']['authorized_for_all_hosts'] %>
# authorization). You may use an asterisk (*) to authorize any
# user who has authenticated to the web server.
-authorized_for_all_service_commands=nagiosadmin
-authorized_for_all_host_commands=nagiosadmin
+authorized_for_all_service_commands=<%= node['nagios']['cgi']['authorized_for_all_service_commands'] %>
+authorized_for_all_host_commands=<%= node['nagios']['cgi']['authorized_for_all_host_commands'] %>
# within the UI after the initial page load. Setting this to 0
# will show all results.
-result_limit=100
+result_limit=<%= node['nagios']['cgi']['result_limit'] %>
#cfg_dir=/etc/nagios4/printers
#cfg_dir=/etc/nagios4/switches
#cfg_dir=/etc/nagios4/routers
-
+cfg_dir=/etc/nagios4/<%= node['nagios']['base_cfg_dir'] %>
+cfg_dir=/etc/nagios4/<%= node['nagios']['site_cfg_dir'] %>
# you will have to enable this.
# Values: 0 = disable commands, 1 = enable commands
-check_external_commands=1
+check_external_commands=<%= node['nagios']['check_external_commands'] %>
# performance data.
# Values: 1 = process performance data, 0 = do not process performance data
-process_performance_data=0
-
+<%
+process_performance_data = 0
+if node['nagios']['with_pnp4nagios'] then
+ process_performance_data = 1
+end
+-%>
+process_performance_data=<%= process_performance_data %>
# HOST AND SERVICE PERFORMANCE DATA PROCESSING COMMANDS
# more information on performance data.
#host_perfdata_command=process-host-perfdata
+<% if node['nagios']['with_pnp4nagios'] then -%>
+host_perfdata_command=pnp-synchronous-host
+#host_perfdata_command=pnp-bulk-host
+#host_perfdata_command=pnp-bulknpcd-host
+<% end -%>
#service_perfdata_command=process-service-perfdata
+<% if node['nagios']['with_pnp4nagios'] then -%>
+service_perfdata_command=pnp-synchronous-service
+#service_perfdata_command=pnp-bulk-service
+#service_perfdata_command=pnp-bulknpcd-service
+<% end -%>
+
# group names/descriptions in some fields of various object types.
# Values: 1 = enable regexp matching, 0 = disable regexp matching
-use_regexp_matching=0
+use_regexp_matching=<%= node['nagios']['use_regexp_matching'] %>