Puppet Class: icingaweb2::module::elasticsearch

Defined in:
manifests/module/elasticsearch.pp

Summary

The Elasticsearch module displays events from data stored in Elasticsearch.

Overview

Note:

If you want to use ‘git` as `install_method`, the CLI `git` command has to be installed. You can manage it yourself as package resource or declare the package name in icingaweb2 class parameter `extra_packages`.

Examples:

class { 'icingaweb2::module::elasticsearch':
  git_revision => 'v0.9.0',
  instances    => {
    'elastic'  => {
      uri      => 'http://localhost:9200',
      user     => 'foo',
      password => 'bar',
    }
  },
  eventtypes   => {
    'filebeat' => {
      instance => 'elastic',
      index    => 'filebeat-*',
      filter   => 'beat.hostname={host.name}',
      fields   => 'input_type, source, message',
    }
  }
}

Parameters:

  • ensure (Enum['absent', 'present'])

    Enable or disable module.

  • module_dir (Stdlib::Absolutepath) (defaults to: "${icingaweb2::globals::default_module_path}/elasticsearch")

    Target directory of the module.

  • git_repository (Stdlib::HTTPUrl)

    Set a git repository URL.

  • install_method (Enum['git', 'none', 'package'])

    Install methods are ‘git`, `package` and `none` is supported as installation method.

  • package_name (String[1])

    Package name of the module. This setting is only valid in combination with the installation method ‘package`.

  • git_revision (Optional[String[1]]) (defaults to: undef)

    Set either a branch or a tag name, eg. ‘master` or `v1.3.2`.

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

    A hash that configures one or more Elasticsearch instances that this module connects to. The defined type ‘icingaweb2::module::elasticsearch::instance` is used to create the instance configuration.

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

    A hash oft ypes of events that should be displayed. Event types are always connected to instances. The defined type ‘icingaweb2::module::elasticsearch::eventtype` is used to create the event types.



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
# File 'manifests/module/elasticsearch.pp', line 52

class icingaweb2::module::elasticsearch (
  Enum['absent', 'present']      $ensure,
  Stdlib::HTTPUrl                $git_repository,
  Enum['git', 'none', 'package'] $install_method,
  String[1]                      $package_name,
  Stdlib::Absolutepath           $module_dir   = "${icingaweb2::globals::default_module_path}/elasticsearch",
  Optional[String[1]]            $git_revision = undef,
  Optional[Hash]                 $instances    = undef,
  Optional[Hash]                 $eventtypes   = undef,
) {
  require icingaweb2

  if $instances {
    $instances.each |$name, $setting| {
      icingaweb2::module::elasticsearch::instance { $name:
        uri                => $setting['uri'],
        user               => $setting['user'],
        password           => $setting['password'],
        ca                 => $setting['ca'],
        client_certificate => $setting['client_certificate'],
        client_private_key => $setting['client_private_key'],
      }
    }
  }

  if $eventtypes {
    $eventtypes.each |$name, $setting| {
      icingaweb2::module::elasticsearch::eventtype { $name:
        instance => $setting['instance'],
        index    => $setting['index'],
        filter   => $setting['filter'],
        fields   => $setting['fields'],
      }
    }
  }

  icingaweb2::module { 'elasticsearch':
    ensure         => $ensure,
    git_repository => $git_repository,
    git_revision   => $git_revision,
    install_method => $install_method,
    module_dir     => $module_dir,
    package_name   => $package_name,
  }
}