Puppet Class: heartbeat

Inherited by:
heartbeat::repo
Defined in:
manifests/init.pp

Summary

Installs and configures heartbeat

Overview

Installs and configures heartbeat

Examples:

Basic configuration with two modules and output to Elasticsearch

class{'heartbeat':
  monitors => [
    {
     'type' => 'icmp',
     'schedule' => '*/5 * * * * * *',
     'hosts' => ['myhost', 'myotherhost'],
    },
  ],
  outputs => {
   'elasticsearch' => {
     'hosts' => ['http://localhost:9200'],
     'index' => 'heartbeat-%{+YYYY.MM.dd}',
   },
  },
}

Parameters:

  • beat_name (String) (defaults to: $::hostname)

    the name of the shipper (defaults to the hostname).

  • fields_under_root (Boolean) (defaults to: false)

    whether to add the custom fields to the root of the document.

  • queue (Hash) (defaults to: { 'mem' => { 'events' => 4096, 'flush' => { 'min_events' => 0, 'timeout' => '0s', }, }, })

    heartbeat’s internal queue.

  • logging (Hash) (defaults to: { 'level' => 'info', 'selectors' => undef, 'to_syslog' => false, 'to_eventlog' => false, 'json' => false, 'to_files' => true, 'files' => { 'path' => '/var/log/heartbeat', 'name' => 'heartbeat', 'keepfiles' => 7, 'rotateeverybytes' => 10485760, 'permissions' => '0600', }, 'metrics' => { 'enabled' => true, 'period' => '30s', }, })

    the heartbeat’s logfile configuration.

  • outputs (Hash) (defaults to: {})

    the mandatory “outputs” section of the configuration file.

  • major_version (Enum['5', '6', '7']) (defaults to: '7')

    the major version of the package to install.

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    whether Puppet should manage heartbeat or not.

  • service_provider (Enum['systemd', 'init']) (defaults to: 'systemd')

    which boot framework to use to install and manage the service.

  • manage_repo (Boolean) (defaults to: true)

    whether to add the elastic upstream repo to the package manager.

  • service_ensure (Enum['enabled', 'running', 'disabled', 'unmanaged']) (defaults to: 'enabled')

    the status of the heartbeat service.

  • package_ensure (String) (defaults to: 'latest')

    the package version to install.

  • config_file_mode (String) (defaults to: '0644')

    the permissions of the main configuration file.

  • disable_configtest (Boolean) (defaults to: false)

    whether to check if the configuration file is valid before running the service.

  • tags (Optional[Array[String]]) (defaults to: undef)

    the tags to add to each document.

  • fields (Optional[Hash]) (defaults to: undef)

    the fields to add to each document.

  • xpack (Optional[Hash]) (defaults to: undef)

    the configuration of x-pack monitoring.

  • monitors (Optional[Array[Hash]]) (defaults to: undef)

    the monitors to watch for example icmp/tcp/http.

  • processors (Optional[Array[Hash]]) (defaults to: undef)

    the optional processors for events enhancement.

  • apt_repo_url (Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]]) (defaults to: undef)
  • yum_repo_url (Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]]) (defaults to: undef)
  • gpg_key_url (Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]]) (defaults to: undef)


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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'manifests/init.pp', line 41

class heartbeat (
  String $beat_name                                                   = $::hostname,
  Boolean $fields_under_root                                          = false,
  Hash $queue                                                         = {
    'mem' => {
      'events' => 4096,
      'flush' => {
        'min_events' => 0,
        'timeout' => '0s',
      },
    },
  },
  Hash $logging                                                       = {
    'level' => 'info',
    'selectors'  => undef,
    'to_syslog' => false,
    'to_eventlog' => false,
    'json' => false,
    'to_files' => true,
    'files' => {
      'path' => '/var/log/heartbeat',
      'name' => 'heartbeat',
      'keepfiles' => 7,
      'rotateeverybytes' => 10485760,
      'permissions' => '0600',
    },
    'metrics' => {
      'enabled' => true,
      'period' => '30s',
    },
  },
  Hash $outputs                                                       = {},
  Enum['5', '6', '7'] $major_version                                  = '7',
  Enum['present', 'absent'] $ensure                                   = 'present',
  Enum['systemd', 'init'] $service_provider                           = 'systemd',
  Boolean $manage_repo                                                = true,
  Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] $apt_repo_url  = undef,
  Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] $yum_repo_url  = undef,
  Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] $gpg_key_url   = undef,
  Enum['enabled', 'running', 'disabled', 'unmanaged'] $service_ensure = 'enabled',
  String $package_ensure                                              = 'latest',
  String $config_file_mode                                            = '0644',
  Boolean $disable_configtest                                         = false,
  Optional[Array[String]] $tags                                       = undef,
  Optional[Hash] $fields                                              = undef,
  Optional[Array[Hash]] $monitors                                     = undef,
  Optional[Array[Hash]] $processors                                   = undef,
  Optional[Hash] $xpack                                               = undef,
) {

  contain heartbeat::repo
  contain heartbeat::install
  contain heartbeat::config
  contain heartbeat::service

  if $manage_repo {
    Class['heartbeat::repo']
    ->Class['heartbeat::install']
  }

  case $ensure {
    'present': {
      Class['heartbeat::install']
      ->Class['heartbeat::config']
      ~>Class['heartbeat::service']
    }
    default: {
      Class['heartbeat::service']
      ->Class['heartbeat::config']
      ->Class['heartbeat::install']
    }
  }
}