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'