diff --git a/Modulefile b/Modulefile index c9878690..13399db7 100644 --- a/Modulefile +++ b/Modulefile @@ -6,3 +6,4 @@ license 'Apache 2.0' summary 'Nagios client and server module' description "Install and configure one or more nagios servers to monitor all of your puppet-managed nodes." project_page 'https://github.com/thias/puppet-nagios' +dependency 'puppetlabs/stdlib', '>= 2.0.0' diff --git a/manifests/nrpe_service.pp b/manifests/nrpe_service.pp index 6c9d535a..95c67a2d 100644 --- a/manifests/nrpe_service.pp +++ b/manifests/nrpe_service.pp @@ -31,25 +31,25 @@ # } # define nagios::nrpe_service ( + $ensure = present, $plugin, - $args = undef, - $sudo = false, - $sudo_user = undef, - $ensure = present, + $args = undef, + $sudo = false, + $sudo_user = undef, $depends_on_nrpe = undef, - $use_extra = [], + $use_extra = [], ) { if (' ' in $name) { fail("name ${name} cannot contain spaces") } - $host_name = $nagios::client::host_name + $host_name = $::nagios::client::host_name # FIXME: without nagios::client, applying a manifest with only an # nrpe_service fails because it doesn't find Service['nrpe'] - include nagios::client - include nagios::params + include '::nagios::client' + include '::nagios::params' # client-side definition of nrpe command # goes in /etc/nagios/nrpe.d/nrpe-$name.cfg @@ -66,14 +66,15 @@ nagios_command { "check_nrpe_${name}": ensure => $ensure, # -u turns socket timeout into unknowns - command_line => "${nagios::params::nrpe} -u -c check_${name}" + command_line => "${::nagios::params::nrpe} -u -c check_${name}" } # server-side definition of nagios service to check # we use the nagios client host_name because the service name needs to # be unique over all clients on the server if ($use_extra) { - $use = inline_template('<%= (["nrpe-service"] + @use_extra).join(",") %>') + $use_extra_string = join($user_extra,',') + $use = "nrpe-service,${use_extra_string}" } else { $use = 'nrpe-service' } @@ -98,3 +99,4 @@ } } +