lean_delivery.metricbeat
Metricbeat Role
Summary
This role:
- installs metricbeat on Ubuntu, Debian, CentOS, Windows
- copies prepared configuration file (log path, connect to elasticsearch, etc.)
Role tasks
- Prepare server (add elastic repo)
- [Optional] Create folder(s) for custom paths
- Install metricbeat
- Copy configuration file
Requirements
- Minimal Version of the ansible for installation: 2.7
- Supported OS:
- EL (RedHat, CentOS)
- 7, 8
- Ubuntu
- 16.04
- 18.04
- Debian
- 8, 9
- Windows Server
- 2016, 2019
- EL (RedHat, CentOS)
Role Variables
You can override any variable below by setting "variable: value" in playbook.
metricbeat_versionIs used to select main Metricbeat branch to be installed (5.x or 6.x current stable versions). Default value is6.metricbeat_last_versionIs used to select specific Metricbeat version to be installed. Default value is6.6.0elastic_gpg_keyGPG-key from elasticsearch repository. Default value ishttps://artifacts.elastic.co/GPG-KEY-elasticsearchmetricbeat_node_nameName of the metricbeat node. Default value is{{ inventory_hostname }}. If this options is not defined, the hostname is used.metricbeat_ssl_enabledTurns on/off SSL connection between metricbeat and logstash/elasticsearch. SSL options should be set by corresponding dict fields like shown below:
ssl:
key: "/etc/pki/tls/private/server.key"
certificate: "/etc/pki/tls/certs/server.crt"
certificate_authorities: "/etc/pki/CA/ca-root.pem"
in case of Windows setup:
ssl:
key: 'c:\tls\private\server.key'
certificate: 'c:\tls\certs\server.pem'
certificate_authorities: 'c:\CA\ca-root.pem'
The path section of the configuration options defines where Metricbeat looks for its files. For example, Metricbeat looks for the Elasticsearch template file in the configuration path and writes log files in the logs path. Metricbeat looks for its registry files in the data path. Default values for Linux host are set up this way:
path:
home: /usr/share/metricbeat
config: /etc/metricbeat
data: /var/lib/metricbeat
logs: /var/log/metricbeat
in case of Windows setup default paths look like:
path:
home: 'c:\program files\metricbeat'
config: 'c:\program files\metricbeat'
data: 'c:\programdata\metricbeat'
logs: 'c:\programdata\metricbeat\logs'
win_download_pathTemp directory for Windows to download and upzip Metricbeat package. Default value is'{{ ansible_env.TEMP }}/metricbeat'(ansible_env.TEMP value solves idempotence issue)input_logpathPath to log files.
Default value for *NIX OS family is "/var/log/*.log"
Default value for WIN OS family is 'c:\windows\*.log'
Output customization:
metricbeat_outputIs used to configure what output to use when sending data (elasticsearchorlogstash). Default value iselasticsearchelasticsearch.hostArray of hosts to connect to. Default value islocalhostelasticsearch.portValue for setting custom port. Default value is9200logstash.hostArray of hosts to connect to. Default value islocalhostlogstash.portValue for setting custom port. Default value is5044
Advanced config parameters:
The metricbeat(systemd)\initd section of the configuration options defines which init script will be used to manage metricbeat service depending on the *nix OS. Custom paths will be taken into account (if configured).
metricbeat_service_nameName of nssm\init script, which manages metricbeat servicemetricbeat_bulk_max_sizeMaximum number of events to bulk in a single Logstash request. Default value is500metricbeat_workerNumber of workers per Elasticsearch host. Default value is1metricbeat_logging_to_syslogSend all logging output to syslog. Default value isfalsemetricbeat_logging_to_filesSend all logging output to rotating files. Default value istruemetricbeat_rotateeverybytesDefines log file size limit. Defalt value is104857600=100MBmetricbeat_keepfilesNumber of log files to keep. Default value is30metricbeat_ignore_olderValue (any time strings like 2h, 5m can be used) above which files will be ignored. Default value is0(disabled)metricbeat_scan_frequencyDefines how often metricbeat checks file updates. Default value is15smetricbeat_harvester_buffer_sizeDefines the buffer size. Default value is65535metricbeat_lognameName of the logging files. Default value is"metricbeat.log"
Dependencies
ca-cert (only for installation with SSL)
Example Playbook
Installing Metricbeat 6.x version:
- name: Install metricbeat
hosts: all
roles:
- role: ansible-role-metricbeat
Installing Metricbeat 6.x version with custom elasticsearch output:
- name: Install metricbeat
hosts: all
roles:
- role: ansible-role-metricbeat
vars:
elasticsearch:
host: elasticsearch.example.com
port: 9200
License
Author Information
authors:
- Lean Delivery Team team@lean-delivery.com
Role for Metricbeat installation
ansible-galaxy install lean_delivery.metricbeat