summaryrefslogtreecommitdiff
path: root/manifests/nrpe
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/nrpe')
-rw-r--r--manifests/nrpe/command.pp33
1 files changed, 33 insertions, 0 deletions
diff --git a/manifests/nrpe/command.pp b/manifests/nrpe/command.pp
new file mode 100644
index 0000000..1da73c8
--- /dev/null
+++ b/manifests/nrpe/command.pp
@@ -0,0 +1,33 @@
+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." )
+ }
+
+ if $nagios_nrpe_cfg_dir == '' {
+ $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 => root,
+ notify => Service['nagios-nrpe-server'],
+ require => File [ "$nagios_nrpe_cfgdir/nrpe.d" ]
+ }
+
+ 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,
+ }
+ }
+ }
+}