summaryrefslogtreecommitdiff
path: root/manifests/nrpe/command.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/nrpe/command.pp')
-rw-r--r--manifests/nrpe/command.pp55
1 files changed, 28 insertions, 27 deletions
diff --git a/manifests/nrpe/command.pp b/manifests/nrpe/command.pp
index e6ebdae..196996c 100644
--- a/manifests/nrpe/command.pp
+++ b/manifests/nrpe/command.pp
@@ -1,33 +1,34 @@
+# manage an nrpe command
define nagios::nrpe::command (
- $ensure = present,
- $command_line = '',
- $source = '' )
-{
- if ($command_line == '' and $source == '') {
- fail ( "Either one of 'command_line' or 'source' must be given to nagios::nrpe::command." )
- }
+ $ensure = present,
+ $command_line = '',
+ $source = '',
+){
+ if ($command_line == '' and $source == '') {
+ fail('Either one of $command_line or $source must be given to nagios::nrpe::command.' )
+ }
- if $nagios_nrpe_cfg_dir == '' {
- $nagios_nrpe_cfgdir = $nagios::nrpe::base::nagios_nrpe_cfgdir
- }
+ $nagios_nrpe_cfgdir = $nagios::nrpe::base::nagios_nrpe_cfgdir
- file { "$nagios_nrpe_cfgdir/nrpe.d/${name}_command.cfg":
- ensure => $ensure,
- mode => 644, owner => root, group => 0,
- notify => Service['nagios-nrpe-server'],
- require => File [ "$nagios_nrpe_cfgdir/nrpe.d" ]
- }
+ file{"${nagios_nrpe_cfgdir}/nrpe.d/${name}_command.cfg":
+ ensure => $ensure,
+ notify => Service['nagios-nrpe-server'],
+ require => File ["${nagios_nrpe_cfgdir}/nrpe.d" ],
+ owner => 'root',
+ group => 0,
+ mode => '0644';
+ }
- case $source {
- '': {
- File["$nagios_nrpe_cfgdir/nrpe.d/${name}_command.cfg"] {
- content => template( "nagios/nrpe/nrpe_command.erb" ),
- }
- }
- default: {
- File["$nagios_nrpe_cfgdir/nrpe.d/${name}_command.cfg"] {
- source => $source,
- }
- }
+ case $source {
+ '': {
+ File["${nagios_nrpe_cfgdir}/nrpe.d/${name}_command.cfg"] {
+ content => template('nagios/nrpe/nrpe_command.erb'),
+ }
+ }
+ default: {
+ File["${nagios_nrpe_cfgdir}/nrpe.d/${name}_command.cfg"] {
+ source => $source,
+ }
}
+ }
}