Added support for installing packages on Icinga 2 servers that will make the mail command available. Without it, Icinga 2 can't send out notifications. Also added a parameter to controller whether the packages will get installed; added a note in the README about the parameter.

refs #7212: https://dev.icinga.org/issues/7212
This commit is contained in:
Nick Chappell 2014-09-15 20:23:11 -07:00
parent f083178772
commit e32a5806c3
4 changed files with 25 additions and 0 deletions

View file

@ -114,6 +114,16 @@ class { 'icinga2::server':
This will stop the `icinga2::server` class from trying to install the plugins pacakges, since the `icinga2::nrpe` class will already be installing them and will prevent a resulting duplicate resource error.
If you would like to install packages to make a `mail` command binary available so that Icinga 2 can send out notifications, set the `install_mail_utils_package` parameter to true:
<pre>
class { 'icinga2::server':
...
install_mail_utils_package => true,
...
}
</pre>
###NRPE usage
To install NRPE and allow the local machine and Icinga 2 servers (or Icinga 1 or plain old Nagios servers) with various IP addresess to connect:

View file

@ -41,6 +41,7 @@ class icinga2::params {
#Whether to manage the package repositories
$manage_repos = true
$server_db_type = 'pgsql'
$install_mail_utils_package = false
#Database paramters
$db_name = 'icinga2_data'
@ -64,11 +65,13 @@ class icinga2::params {
#Icinga 2 server package
$icinga2_server_package = 'icinga2'
$icinga2_server_plugin_packages = ["nagios-plugins-nrpe", "nagios-plugins-all", "nagios-plugins-openmanage", "nagios-plugins-check-updates"]
$icinga2_server_mail_package = 'mailx'
}
'7': {
#Icinga 2 server package
$icinga2_server_package = 'icinga2'
$icinga2_server_plugin_packages = ["nagios-plugins-nrpe", "nagios-plugins-all", "nagios-plugins-openmanage", "nagios-plugins-check-updates"]
$icinga2_server_mail_package = 'mailx'
}
#Fail if we're on any other CentOS release:
default: { fail("${::operatingsystemmajrelease} is not a supported CentOS release!") }
@ -82,6 +85,7 @@ class icinga2::params {
'12.04': {
$icinga2_server_package = 'icinga2'
$icinga2_server_plugin_packages = ["nagios-plugins", "nagios-plugins-basic", "nagios-plugins-standard", "nagios-snmp-plugins", "nagios-plugins-extra", "nagios-nrpe-plugin"]
$icinga2_server_mail_package = 'mailutils'
#Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
$server_plugin_package_install_options = '--no-install-recommends'
}
@ -89,6 +93,7 @@ class icinga2::params {
'14.04': {
$icinga2_server_package = 'icinga2'
$icinga2_server_plugin_packages = [ "nagios-plugins", "nagios-plugins-basic", "nagios-plugins-common", "nagios-plugins-standard", "nagios-snmp-plugins", "nagios-plugins-extra", "nagios-plugins-contrib", "nagios-nrpe-plugin"]
$icinga2_server_mail_package = 'mailutils'
#Specify '--no-install-recommends' so we don't inadvertently get Nagios 3 installed; it comes as a recommended package with most of the plugin packages:
$server_plugin_package_install_options = '--no-install-recommends'
}

View file

@ -22,6 +22,7 @@ class icinga2::server (
$package_provider = $icinga2::params::package_provider,
$icinga2_server_package = $icinga2::params::icinga2_server_package,
$server_install_nagios_plugins = $icinga2::params::server_install_nagios_plugins,
$install_mail_utils_package = $icinga2::params::install_mail_utils_package,
) inherits icinga2::params {
#Do some validation of parameters so we know we have the right data types:

View file

@ -80,6 +80,15 @@ class icinga2::server::install::packages inherits icinga2::server {
}
}
if $install_mail_utils_package == true {
#Install the package that has the 'mail' binary in it so we can send notifications:
package {$icinga2_server_mail_package:
ensure => installed,
provider => $package_provider,
install_options => $server_plugin_package_install_options,
}
}
#Pick the right DB lib package name based on the database type the user selected:
case $server_db_type {
#MySQL: