diff options
-rw-r--r-- | README | 14 | ||||
-rw-r--r-- | manifests/service.pp | 13 |
2 files changed, 23 insertions, 4 deletions
@@ -51,9 +51,9 @@ Services Services can be monitored by using the "nagios::service" component. -The simplest form is:: +The simplest form is: - nagios::service { 'check_http': + nagios::service { 'check_http': check_command => 'http_port!80', } @@ -65,6 +65,16 @@ Obviously, the check command must either be defined using nagios_command objects (some are supplied in nagios::defaults::commands) or in the nagios configuration files directly. +NRPE Services +------------- + +NRPE Services can be defines as i.e.: + + nagios::service { 'CPU Usage': use_nrpe => 'true', + check_command => "check_cpu", + nrpe_args => "-t 60" + } + Upgrade Notes ============= diff --git a/manifests/service.pp b/manifests/service.pp index afc8650..6f82279 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -11,16 +11,25 @@ define nagios::service ( $notification_options = '', $contact_groups = '', $use = 'generic-service', - $service_description = 'absent' ) + $service_description = 'absent', + $use_nrpe = '', + $nrpe_args = '' ) { # TODO: this resource should normally accept all nagios_host parameters $real_name = "${hostname}_${name}" + if ($use_nrpe == 'true') { + $real_check_command = "check_nrpe!$check_command!\"$nrpe_args\"" + } + else { + $real_check_command = "$check_command" + } + @@nagios_service { "${real_name}": ensure => $ensure, - check_command => $check_command, + check_command => $real_check_command, host_name => $host_name, use => $use, notify => Service[nagios], |