2014-07-21 02:35:20 +02:00
|
|
|
# Define icinga2::nrpe::command
|
|
|
|
#
|
|
|
|
# This defined type creates NRPE command definitions on machines running NRPE.
|
|
|
|
#
|
|
|
|
# Parameters:
|
|
|
|
# * $command_name = What NRPE will know the command as; this defaults to the title of the resource
|
2014-09-10 09:20:37 +02:00
|
|
|
# * $nrpe_plugin_libdir = The directory where the NRPE plugins themselves live
|
2014-07-21 02:35:20 +02:00
|
|
|
# * $nrpe_plugin_name = The name of the plugin the command will run
|
2014-09-14 04:46:24 +02:00
|
|
|
# * $nrpe_plugin_args = The arguments to pass to the plugin. This may be optional,
|
2014-07-21 02:35:20 +02:00
|
|
|
# depending on the plugin and whether it expects any arguments or parameters
|
|
|
|
|
|
|
|
define icinga2::nrpe::command (
|
|
|
|
$command_name = $name,
|
2014-09-10 09:20:37 +02:00
|
|
|
$nrpe_plugin_libdir = $icinga2::params::nrpe_plugin_libdir,
|
2014-07-21 02:35:20 +02:00
|
|
|
$nrpe_plugin_name = undef,
|
|
|
|
$nrpe_plugin_args = undef,
|
|
|
|
) {
|
|
|
|
|
2014-09-07 03:04:42 +02:00
|
|
|
#Do some validation of the class' parameters:
|
|
|
|
validate_string($command_name)
|
2014-09-10 09:20:37 +02:00
|
|
|
validate_string($nrpe_plugin_libdir)
|
2014-09-07 03:04:42 +02:00
|
|
|
validate_string($nrpe_plugin_name)
|
|
|
|
validate_string($nrpe_plugin_args)
|
|
|
|
|
2014-07-21 02:35:20 +02:00
|
|
|
file { "/etc/nagios/nrpe.d/${command_name}.cfg":
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
2014-09-26 20:44:44 +02:00
|
|
|
mode => '0644',
|
2014-07-21 02:35:20 +02:00
|
|
|
content => template('icinga2/nrpe_command.cfg.erb'),
|
|
|
|
require => Package[$icinga2::params::icinga2_client_packages],
|
|
|
|
notify => Service[$icinga2::params::nrpe_daemon_name]
|
|
|
|
}
|
2014-09-07 03:04:42 +02:00
|
|
|
|
2014-09-10 09:20:37 +02:00
|
|
|
}
|