Forge Home

heartbeat

Module for installing, managing and configuring the Heartbeat lightweight shipper for uptime monitoring by elastic.

106,199 downloads

2,718 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.2.2 (latest)
  • 0.2.1
  • 0.2.0
  • 0.1.2
  • 0.1.0
released Jul 17th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x
  • Puppet >= 5.0.0 < 7.0.0
  • , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'norisnetwork-heartbeat', '0.2.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add norisnetwork-heartbeat
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install norisnetwork-heartbeat --version 0.2.2

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

norisnetwork/heartbeat — version 0.2.2 Jul 17th 2020

norisnetwork-heartbeat

Travis (.org) GitHub license GitHub repo size Puppet Forge version Puppet Forge – PDK version

Table of Contents

  1. Description
  2. Setup - The basics of getting started with heartbeat
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

This is a Puppet module for installing, managing and configuring the Heartbeat lightweight shipper for uptime monitoring by elastic. It has been tested on Puppet 5.x and on the following OSes: Debian 9.1, CentOS 7.3, Ubuntu 16.04

Setup

What heartbeat affects

heartbeat configures the package repository to fetch the software, it installs it, it configures both the application (/etc/heartbeat/heartbeat.yml) and the service (systemd by default, but it is possible to manually switch to init) and it takes care that it is running and enabled.

Setup Requirements

heartbeat needs puppetlabs/stdlib, puppetlabs/apt (for Debian and derivatives), puppetlabs-yumrepo_core (for RedHat or RedHat-like systems), puppet-zypprepo (on SuSE based systems)

Beginning with heartbeat

The module can be installed manually, typing puppet module install norisnetwork-heartbeat, or by means of an environment manager (r10k, librarian-puppet, ...).

heartbeat requires at least the outputs and monitors sections in order to start. Please refer to the software documentation to find out the available monitors and the supported outputs. On the other hand, the sections logging and queue already contains meaningful default values.

A basic setup checking a host by ping/icmp every 5 minutes and writing the results directly in Elasticsearch:

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

The same example using Hiera:

classes:
  include:
    - 'heartbeat'

heartbeat::monitors:
  - type: 'icmp'
    schedule: '*/5 * * * * * *'
    hosts:
      - 'myhost'
      - 'myotherhost'

heartbeat::outputs:
  elasticsearch:
    hosts:
      - 'http://localhost:9200'
    index: "heartbeat-%%{}{+YYYY.MM.dd}"

Usage

The configuration is written to the configuration file /etc/heartbeat/heartbeat.yml in yaml format. The default values follow the upstream (as of the time of writing).

Send data to two Redis servers, loadbalancing between the instances.

class{'heartbeat':
    monitors => [
      {
        'type' => 'icmp',
        'schedule' => '*/5 * * * * * *',
        'hosts' => ['myhost', 'myotherhost'],
      },
    ],
    outputs => {
      'redis' => {
        'hosts' => ['localhost:6379', 'other_redis:6379'],
        'key' => 'heartbeat',
      },
    },

or, using Hiera

classes:
  include:
    - 'heartbeat'

heartbeat::monitors:
  - type: 'icmp'
    schedule: '*/5 * * * * * *'
    hosts:
      - 'myhost'
      - 'myotherhost'

heartbeat::outputs:
  elasticsearch:
    hosts:
      - 'localhost:6379'
      - 'itger:redis:6379'
    index: 'heartbeat'

Reference

Public Classes

Class: heartbeat

Installation and configuration.

Parameters:

  • beat_name: [String] the name of the shipper (default: the hostname).
  • fields_under_root: [Boolean] whether to add the custom fields to the root of the document (default is false).
  • queue: [Hash] heartbeat's internal queue, before the events publication (default is 4096 events in memory with immediate flush).
  • logging: [Hash] the heartbeat's logfile configuration (default: writes to /var/log/heartbeat/heartbeat, maximum 7 files, rotated when bigger than 10 MB).
  • outputs: [Hash] the options of the mandatory outputs section of the configuration file (default: undef).
  • major_version: [Enum] the major version of the package to install (default: '6', the only accepted value. Implemented for future reference).
  • ensure: [Enum 'present', 'absent']: whether Puppet should manage heartbeat or not (default: 'present').
  • service_provider: [Enum 'systemd', 'init'] which boot framework to use to install and manage the service (default: 'systemd').
  • service_ensure: [Enum 'enabled', 'running', 'disabled', 'unmanaged'] the status of the heartbeat service (default 'enabled'). In more details:
    • enabled: service is running and started at every boot;
    • running: service is running but not started at boot time;
    • disabled: service is not running and not started at boot time;
    • unamanged: Puppet does not manage the service.
  • package_ensure: [String] the package version to install. It could be 'latest' (for the newest release) or a specific version number, in the format x.y.z, i.e., 6.6.1 (default: latest).
  • config_file_mode: [String] the octal file mode of the configuration file /etc/heartbeat/heartbeat.yml (default: 0644).
  • disable_configtest: [Boolean] whether to check if the configuration file is valid before attempting to run the service (default: true).
  • tags: [Array[Strings]]: the tags to add to each document (default: undef).
  • fields: [Hash] the fields to add to each document (default: undef).
  • xpack: [Hash] the configuration to export internal metrics to an Elasticsearch monitoring instance (default: undef).
  • monitors: [Array[Hash]] the required monitors to load (default: undef).
  • processors: [Array[Hash]] the optional processors for event enhancement (default: undef).

Private Classes

Class: heartbeat::repo

Configuration of the package repository to fetch heartbeat.

Class: heartbeat::install

Installation of the heartbeat package.

Class: heartbeat::config

Configuration of the heartbeat daemon.

Class: heartbeat::service

Management of the heartbeat service.

Limitations

This module does not load the index template in Elasticsearch nor the heartbeat example dashboards in Kibana. These two tasks should be carried out manually. Please follow the documentation to manually load the index template in Elasticsearch and to import the heartbeat dashboards in Kibana.

The option manage_repo does not work properly on SLES. This means that, even if set to false, the repo file /etc/zypp/repos.d/beats.repo will be created and the corresponding repo will be enabled.

Development

Please feel free to report bugs and to open pull requests for new features or to fix a problem.