Puppet Class: nagios::check::redis

Defined in:
manifests/check/redis.pp

Overview

Parameters:

  • ensure (Any) (defaults to: undef)
  • package (Any) (defaults to: 'perl-Redis')
  • args (Any) (defaults to: '')
  • database (Any) (defaults to: undef)
  • pass (Any) (defaults to: undef)
  • modes_enabled (Any) (defaults to: [])
  • modes_disabled (Any) (defaults to: [])
  • args_blocked_clients (Any) (defaults to: '')
  • args_connected_slaves (Any) (defaults to: '')
  • args_connected_clients (Any) (defaults to: '')
  • args_evicted_keys (Any) (defaults to: '')
  • args_hitrate (Any) (defaults to: '')
  • args_response_time (Any) (defaults to: '')
  • args_rejected_connections (Any) (defaults to: '')
  • args_uptime_in_seconds (Any) (defaults to: '')
  • check_title (Any) (defaults to: $::nagios::client::host_name)
  • servicegroups (Any) (defaults to: 'redis')
  • 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
# File 'manifests/check/redis.pp', line 1

class nagios::check::redis (
  $ensure                       = undef,
  $package                      = 'perl-Redis',
  # common args for all modes 'as-is' for the check script
  $args                         = '',
  # common args for all modes as individual parameters
  $database                     = undef,
  $pass                         = undef,
  # modes selectively enabled and/or disabled
  $modes_enabled                = [],
  $modes_disabled               = [],
  $args_blocked_clients         = '',
  $args_connected_slaves        = '',
  $args_connected_clients       = '',
  $args_evicted_keys            = '',
  $args_hitrate                 = '',
  $args_response_time           = '',
  $args_rejected_connections    = '',
  $args_uptime_in_seconds       = '',
  # service
  $check_title              = $::nagios::client::host_name,
  $servicegroups            = 'redis',
  $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_redis':
    ensure  => $ensure,
    package => $package,
  }

  # Set options from parameters unless already set inside args
  if $args !~ /-d/ and $database != undef {
    $arg_d = "-d ${database} "
  } else {
    $arg_d = ''
  }
  if $args !~ /-x/ and $pass != undef {
    $arg_p = "-x ${pass} "
  } else {
    $arg_p = ''
  }

  $globalargs = strip("-H localhost ${arg_d}${arg_p}${args}")

  $modes = [
    'blocked_clients',
    'connected_slaves',
    'connected_clients',
    'evicted_keys',
    'hitrate',
    'response_time',
    'rejected_connections',
    'uptime_in_seconds',
  ]
  nagios::check::redis::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,
  }

}