Puppet Class: nagios::check::rabbitmq

Defined in:
manifests/check/rabbitmq.pp

Overview

Parameters:

  • ensure (Any) (defaults to: undef)
  • package (Any) (defaults to: 'python-requests')
  • args (Any) (defaults to: '')
  • user (Any) (defaults to: undef)
  • pass (Any) (defaults to: undef)
  • nodename (Any) (defaults to: undef)
  • virtualhost (Any) (defaults to: undef)
  • modes_enabled (Any) (defaults to: [])
  • modes_disabled (Any) (defaults to: [])
  • args_connection_count (Any) (defaults to: '')
  • args_queues_count (Any) (defaults to: '')
  • args_mem_usage (Any) (defaults to: '')
  • args_aliveness (Any) (defaults to: '')
  • args_cluster_status (Any) (defaults to: '')
  • check_title (Any) (defaults to: $::nagios::client::host_name)
  • servicegroups (Any) (defaults to: 'rabbitmq')
  • check_period (Any) (defaults to: $::nagios::client::service_check_period)
  • contact_groups (Any) (defaults to: $::nagios::client::service_contact_groups)
  • first_notification_delay (Any) (defaults to: $::nagios::client::service_first_notification_delay)
  • max_check_attempts (Any) (defaults to: $::nagios::client::service_max_check_attempts)
  • notification_period (Any) (defaults to: $::nagios::client::service_notification_period)
  • use (Any) (defaults to: $::nagios::client::service_use)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'manifests/check/rabbitmq.pp', line 1

class nagios::check::rabbitmq (
  $ensure                       = undef,
  $package                      = 'python-requests',
  # common args for all modes 'as-is' for the check script
  $args                         = '',
  # common args for all modes as individual parameters
  $user                         = undef,
  $pass                         = undef,
  $nodename                     = undef,
  $virtualhost                  = undef,
  # modes selectively enabled and/or disabled
  $modes_enabled                = [],
  $modes_disabled               = [],
  $args_connection_count        = '',
  $args_queues_count            = '',
  $args_mem_usage               = '',
  $args_aliveness               = '',
  $args_cluster_status          = '',
  # service
  $check_title              = $::nagios::client::host_name,
  $servicegroups            = 'rabbitmq',
  $check_period             = $::nagios::client::service_check_period,
  $contact_groups           = $::nagios::client::service_contact_groups,
  $first_notification_delay = $::nagios::client::service_first_notification_delay,
  $max_check_attempts       = $::nagios::client::service_max_check_attempts,
  $notification_period      = $::nagios::client::service_notification_period,
  $use                      = $::nagios::client::service_use,
) {

  nagios::client::nrpe_plugin { 'check_rabbitmq':
    ensure  => $ensure,
    package => $package,
  }

  # Set options from parameters unless already set inside args
  if $args !~ /-u/ and $user != undef {
    $arg_u = "-u ${user} "
  } else {
    $arg_u = ''
  }
  if $args !~ /-p/ and $pass != undef {
    $arg_p = "-p ${pass} "
  } else {
    $arg_p = ''
  }
  if $args !~ /-n/ and $nodename != undef {
    $arg_d = "-n ${nodename} "
  } else {
    $nodename_f = getvar('::nagios_rabbitmq_nodename')
    $arg_d = "-n ${nodename_f}"
  }
  if $args !~ /-v/ and $virtualhost != undef {
    $arg_c = "-v ${virtualhost} "
  } else {
    $arg_c = ''
  }
  $globalargs = strip("${arg_u}${arg_p}${arg_d}${arg_c}${args}")

  $modes = [
    'connection_count',
    'queues_count',
    'mem_usage',
    'aliveness',
    'cluster_status',
  ]
  nagios::check::rabbitmq::mode { $modes:
    ensure                   => $ensure,
    globalargs               => $globalargs,
    modes_enabled            => $modes_enabled,
    modes_disabled           => $modes_disabled,
    # service
    check_title              => $check_title,
    servicegroups            => $servicegroups,
    check_period             => $check_period,
    contact_groups           => $contact_groups,
    first_notification_delay => $first_notification_delay,
    max_check_attempts       => $max_check_attempts,
    notification_period      => $notification_period,
    use                      => $use,
  }

}