summaryrefslogtreecommitdiff
path: root/manifests/nrpe
diff options
context:
space:
mode:
authorGabriel Filion <lelutin@gmail.com>2012-04-09 23:45:16 -0400
committerGabriel Filion <lelutin@gmail.com>2012-04-09 23:45:16 -0400
commit1c36e5c9188636aa7e5d093e2330356b24832ada (patch)
treea87c9dfc861c0d207a455ec03002d678142ae5c3 /manifests/nrpe
parent3ed7a58cc923d52c8664776b534b123d43f8fe5d (diff)
Define a way to configure an NRPE command
We need to be able to configure what NRPE commands are defined on clients. This new method accepts inline contents or a puppet source argument. Signed-off-by: Gabriel Filion <lelutin@gmail.com>
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,
+ }
+ }
+ }
+}