Metricbeat Role

License Build Status Build Status Galaxy Ansible Ansible

Summary

This role:

  • installs metricbeat on Ubuntu, CentOS
  • copies prepared configuration file (log path, connect to elasticsearch etc.)

Role tasks

  • Prepare server (add elastic repo)
  • Install metricbeat
  • [Optional] Copy configuration file
  • [Optional] Enable modules

Requirements

  • Minimal Version of the ansible for installation: 2.9
  • Supported OS:
    • CentOS
      • 7,8
    • Ubuntu
      • 16.04, 18.04
    • Debian
      • 8, 9

Role Variables


You can override any variable below by setting "variable: value" in playbook.

  • elastic_gpg_key GPG-key from elasticsearch repository. Default value is https://artifacts.elastic.co/GPG-KEY-elasticsearch
  • elastic_gpg_key_redhat GPG-key from elasticsearch repository. Default value is https://packages.elastic.co/GPG-KEY-elasticsearch
  • metricbeat_config Custom config for metricbeat
  • metricbeat_modules Specify which modules will be enabled. By default only system module enabled

Advanced config parameters:

  • metricbeat_service_name Name of nssm\init script, which manages filebeat service

Dependencies


Nothing

Example Playbook

Installing Metricbeat 7.x version:

- name: Install metricbeat
  hosts: all
  roles:
    - role: ansible-role-metricbeat

Installing Metricbeat 7.x version with enabled system and jolokia modules:

- name: Install metricbeat
  hosts: all
  roles:
    - role: ansible-role-metricbeat
  vars:
    metricbeat_modules:
      - system
      - jolokia

Installing Metricbeat 7.x version with custom config:

- name: Install metricbeat
  hosts: all
  roles:
    - role: ansible-role-metricbeat
  vars:
    metricbeat_config: {
      "metricbeat.config.modules": {
        "path": '${path.config}/modules.d/*.yml',
        "reload.enabled": false
        },
       "output.elasticsearch": {
         "hosts": ["localhost:9200"],
         "#username": "elastic",
         "#password": "changeme"
       },
       "#output.logstash": {
         "#hosts": ["localhost:5044"]
       }
      }

Installing Metricbeat 7.x version with custom jolokia module:

- name: Install metricbeat
  hosts: all
  roles:
    - role: ansible-role-metricbeat
  vars:
    metricbeat_modules:
      - system
      - jolokia
    module_config:
      - module: jolokia
        metricsets: ["jmx"]
        period: 10s
        hosts: ["localhost:9999"]
        namespace: "metrics"
        path: "/jolokia/?ignoreErrors=true&canonicalNaming=false"
        http_method: "POST"
        jmx.mappings:
        - mbean: 'java.lang:type=Memory'
          attributes:
            - attr: HeapMemoryUsage
              field: memory.heap_usage
            - attr: NonHeapMemoryUsage
              field: memory.non_heap_usage

License

Apache

Author Information

authors: