Skip to main content

Metricbeat Setup

Metricbeat

 MetricBeat
Metricbeat is lightweight monitoring application provided in Elastic Stack which could be used to monitor various components like Server, apache, mysql, redis etc. In this article are going to configure Metricbeat to monitor Linux Server Usage and Apache Web Server metrics.

Please use the link to download Metricbeat 7.4

Once you have downloaded the Metricbeat application copy it to the servers that you want to monitor and extract the contents.

In metricbeat there are two items that needs to be configured
  1. Metricbeat configuration to connect to Elasticsearch and Kibana
  2. Modules that needs to be activated for monitoring
1. Metricbeat Configuration: In metricbeat folder you will find metricbeat.yml which hold all the configuration to connect to Elasticsearch and Kibana to send the collected metics.

Use the below setting to establish connectivity.

env: monitoring

setup.kibana:
  host: "kibana-ipaddrss:port"
  protocol: "https"
  ssl.verification_mode: none  #Disabled ssl certificate verification as we are using selfsigned certificate
  setup.dashboards.index: "metricbeat-*"

setup.ilm.enabled: auto
setup.ilm.policy_name: "full_policy"
setup.ilm.rollover_alias: "metricbeat"
setup.ilm.pattern: "{now/d}-000001"
setup.ilm.check_exists: true
setup.ilm.overwrite: false

output.elasticsearch:
  hosts: ["elasticsearch-client-ip:port"]
  protocol: "https"
  username: "elastic"
  password: "elasticsearchpassword" # Password generated during Securing Easticsearch
  ssl.verification_mode: none

logging.level: info
logging.to_files: true
logging.files:
  path: ${path.config}/logs 
  name: output.log
  keepfiles: 1
  logging.files.rotateeverybytes: 5242880
  permissions: 0644

monitoring.enabled: true

Once the above configuration is added to metricbeat.yml we should be able to establish connection.

2. Configure modules for metrics collection: To enable the modules change directory to "modules.d" under Metricbeats base directory and in the directory you will find all the modules that could be used as a part of metricbeats.

As we are monitoring only Linux and Apache we move need to change file extensions from .yml.disabled. The two config files that we need are "system.yml" and apache.yml"

Use below command to make the change.

mv modulesname.yml.disabled modulesname.yml

You can find both config files in Github.

Once you are done with configuration lets start Metricbeat.

1. Lets make metricbeat executable
chmod 775 metricbeat
2. Start Metricbeat
/metricbeat -c metricbeat.yml
3. Once we have metricbeat running we can setup dashboards using below command.
/metricbeat setup

Once you have completed above steps you should be able to see the data getting transfred to elasticsearch, we can now visualize data using Kibana dashboards.

Overview System Dashboard shows all the configured servers. 



Individual Linux server Metrics


Apache Web Server Metrics