Merge branch 'pr/27/server_check_plugin_defined_type'
Merged in from: https://github.com/Icinga/puppet-icinga2/pull/27
This commit is contained in:
commit
5f2b0ff8da
2 changed files with 52 additions and 0 deletions
49
manifests/checkplugin.pp
Normal file
49
manifests/checkplugin.pp
Normal file
|
@ -0,0 +1,49 @@
|
|||
# == Defined Type: icinga2::checkplugin
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
#
|
||||
define icinga2::checkplugin (
|
||||
$checkplugin_name = $name,
|
||||
$checkplugin_libdir = $icinga2::params::checkplugin_libdir,
|
||||
$checkplugin_target_file_owner = 'root',
|
||||
$checkplugin_target_file_group = 'root',
|
||||
$checkplugin_target_file_mode = '0755',
|
||||
$checkplugin_file_distribution_method = 'content',
|
||||
$checkplugin_template = undef,
|
||||
$checkplugin_source_file = undef,
|
||||
) {
|
||||
|
||||
#Do some validation of the class' parameters:
|
||||
validate_string($name)
|
||||
validate_string($checkplugin_libdir)
|
||||
validate_string($checkplugin_name)
|
||||
validate_string($checkplugin_target_file_owner)
|
||||
validate_string($checkplugin_target_file_group)
|
||||
validate_string($checkplugin_target_file_mode)
|
||||
|
||||
if $checkplugin_file_distribution_method == 'content' {
|
||||
file { "${checkplugin_libdir}/${checkplugin_name}":
|
||||
owner => $checkplugin_target_file_owner,
|
||||
group => $checkplugin_target_file_group,
|
||||
mode => $checkplugin_target_file_mode,
|
||||
content => template("icinga2/${checkplugin_template}"),
|
||||
require => Package[$icinga2::params::icinga2_client_packages],
|
||||
}
|
||||
}
|
||||
elsif $checkplugin_file_distribution_method == 'source' {
|
||||
file { "${checkplugin_libdir}/${checkplugin_name}":
|
||||
owner => $checkplugin_target_file_owner,
|
||||
group => $checkplugin_target_file_group,
|
||||
mode => $checkplugin_target_file_mode,
|
||||
source => $checkplugin_source_file,
|
||||
require => Package[$icinga2::params::icinga2_client_packages],
|
||||
}
|
||||
}
|
||||
else {
|
||||
notify {'Missing/Incorrect File Distribution Method':
|
||||
message => 'The parameter checkplugin_file_distribution_method is missing or incorrect. Please set content or source',
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -302,6 +302,7 @@ class icinga2::params {
|
|||
'CentOS': {
|
||||
$nrpe_config_basedir = '/etc/nagios'
|
||||
$nrpe_plugin_libdir = '/usr/lib64/nagios/plugins'
|
||||
$checkplugin_libdir = '/usr/lib64/nagios/plugins'
|
||||
$nrpe_pid_file_path = '/var/run/nrpe/nrpe.pid'
|
||||
$nrpe_user = 'nrpe'
|
||||
$nrpe_group = 'nrpe'
|
||||
|
@ -310,6 +311,7 @@ class icinga2::params {
|
|||
'Ubuntu': {
|
||||
$nrpe_config_basedir = '/etc/nagios'
|
||||
$nrpe_plugin_libdir = '/usr/lib/nagios/plugins'
|
||||
$checkplugin_libdir = '/usr/lib/nagios/plugins'
|
||||
$nrpe_pid_file_path = '/var/run/nagios/nrpe.pid'
|
||||
$nrpe_user = 'nagios'
|
||||
$nrpe_group = 'nagios'
|
||||
|
@ -318,6 +320,7 @@ class icinga2::params {
|
|||
'Debian': {
|
||||
$nrpe_config_basedir = '/etc/nagios'
|
||||
$nrpe_plugin_libdir = '/usr/lib/nagios/plugins'
|
||||
$checkplugin_libdir = '/usr/lib/nagios/plugins'
|
||||
$nrpe_pid_file_path = '/var/run/nagios/nrpe.pid'
|
||||
$nrpe_user = 'nagios'
|
||||
$nrpe_group = 'nagios'
|
||||
|
|
Loading…
Reference in a new issue