Defined Type: nagios::nrpe

Defined in:
manifests/nrpe.pp

Overview

Define: nagios::nrpe

Define an nrpe service which can be monitored by a remote nagios server.

Parameters

command

The command to run

service_description

A description of this nrpe service

notifications_enabled

If nagios should notify when this command fails

notification_period

The notification period of this nrpe service

host_name

The host name which this nagios service can be contacted on.

command_name

The name of the command

use

A nagios service template to use

Requires

  • nagios::client

Authors

Christopher Johnson - cjohn@ceh.ac.uk

Parameters:

  • command (Any)
  • service_description (Any)
  • notifications_enabled (Any) (defaults to: undef)
  • notification_period (Any) (defaults to: $nagios::check::default_notification_period)
  • host_name (Any) (defaults to: $fqdn)
  • command_name (Any) (defaults to: $name)
  • use (Any) (defaults to: 'generic-service')


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'manifests/nrpe.pp', line 22

define nagios::nrpe (
  $command,
  $service_description,
  $notifications_enabled = undef,
  $notification_period   = $nagios::check::default_notification_period,
  $host_name             = $fqdn,
  $command_name          = $name,
  $use                   = 'generic-service'
) {
  if ! defined(Class['::nagios::client']) {
    fail('You must include the nagios::client class before defining a nagios::nrpe')
  }

  concat::fragment { "command ${name} ${nagios::client::nrpe_config}":
    target  => $::nagios::client::nrpe_config,
    content => "command[${name}]=${command}\n",
  }

  @@nagios_service { "${command_name}_${fqdn}" :
    check_command         => "check_nrpe_1arg!${command_name}",
    use                   => $use,
    host_name             => $host_name,
    notification_period   => $notification_period,
    service_description   => $service_description,
    notifications_enabled => $notifications_enabled,
  }
}