Merge branch 'arioch-checkplugin_source_inline' into develop
Merged from: https://github.com/Icinga/puppet-icinga2/pull/77 refs#8239: https://dev.icinga.org/issues/8239
This commit is contained in:
commit
235357aad4
2 changed files with 27 additions and 0 deletions
17
README.md
17
README.md
|
@ -296,6 +296,23 @@ icinga2::checkplugin { 'check_diskstats':
|
||||||
}
|
}
|
||||||
````
|
````
|
||||||
|
|
||||||
|
Example 3: Distribute check plugin in a manifest
|
||||||
|
```
|
||||||
|
icinga2::checkplugin { 'check_diskstats':
|
||||||
|
checkplugin_file_distribution_method => 'inline'
|
||||||
|
checkplugin_source_inline => 'command[check_disks]=/usr/lib64/nagios/plugins/check_disk -w 20 -c 10 -p /'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Example 4: Distribute check plugin stored in Hiera(-yaml)
|
||||||
|
```
|
||||||
|
---
|
||||||
|
icinga2::checkplugin:
|
||||||
|
check_diskstats:
|
||||||
|
checkplugin_file_distribution_method: 'inline'
|
||||||
|
checkplugin_source_inline: 'command[check_disks]=/usr/lib64/nagios/plugins/check_disk -w 20 -c 10 -p /'
|
||||||
|
```
|
||||||
|
|
||||||
###[Object type usage](id:object_type_usage)
|
###[Object type usage](id:object_type_usage)
|
||||||
|
|
||||||
This module includes several defined types that can be used to automatically generate Icinga 2 format object definitions. They function in a similar way to [the built-in Nagios types that are included in Puppet](http://docs.puppetlabs.com/guides/exported_resources.html#exported-resources-with-nagios).
|
This module includes several defined types that can be used to automatically generate Icinga 2 format object definitions. They function in a similar way to [the built-in Nagios types that are included in Puppet](http://docs.puppetlabs.com/guides/exported_resources.html#exported-resources-with-nagios).
|
||||||
|
|
|
@ -13,6 +13,7 @@ define icinga2::checkplugin (
|
||||||
$checkplugin_template_module = 'icinga2',
|
$checkplugin_template_module = 'icinga2',
|
||||||
$checkplugin_template = undef,
|
$checkplugin_template = undef,
|
||||||
$checkplugin_source_file = undef,
|
$checkplugin_source_file = undef,
|
||||||
|
$checkplugin_source_inline = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
#Do some validation of the class' parameters:
|
#Do some validation of the class' parameters:
|
||||||
|
@ -41,6 +42,15 @@ define icinga2::checkplugin (
|
||||||
require => Package[$icinga2::params::icinga2_client_packages],
|
require => Package[$icinga2::params::icinga2_client_packages],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elsif $checkplugin_file_distribution_method == 'inline' {
|
||||||
|
file { "${checkplugin_libdir}/${checkplugin_name}":
|
||||||
|
owner => $checkplugin_target_file_owner,
|
||||||
|
group => $checkplugin_target_file_group,
|
||||||
|
mode => $checkplugin_target_file_mode,
|
||||||
|
content => $checkplugin_source_inline,
|
||||||
|
require => Package[$icinga2::params::icinga2_client_packages],
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
notify {'Missing/Incorrect File Distribution Method':
|
notify {'Missing/Incorrect File Distribution Method':
|
||||||
message => 'The parameter checkplugin_file_distribution_method is missing or incorrect. Please set content or source',
|
message => 'The parameter checkplugin_file_distribution_method is missing or incorrect. Please set content or source',
|
||||||
|
|
Loading…
Reference in a new issue