본문 바로가기

리눅스

[리눅스] Ubuntu 환경에서 Metricbeat 설치하는 방법

728x90

Ubuntu 환경에서 Metricbeat 설치하는 방법

Metricbeat 설치하기

로컬 저장소 업데이트

sudo apt-get update

Metricbeat 패키지 설치

sudo apt-get install -y metricbeat

구성 파일(metricbeat.yml) 편집

vim /etc/metricbeat/metricbeat.yml

Metricbeat 서비스 시작

systemctl --now enable metricbeat.service

Metricbeat 서비스 상태 확인

systemctl status metricbeat.service

메트릭 수집 모듈 활성화 및 구성

metricbeat modules list
$ metricbeat modules list
Enabled:
system

Disabled:
activemq
aerospike
airflow
...

elasticsearch 모듈 활성화

metricbeat modules enable elasticsearch
$ metricbeat modules enable elasticsearch
Enabled elasticsearch

kibana 모듈 활성화

metricbeat modules enable kibana
$ metricbeat modules enable kibana
Enabled kibana

활성화된 모듈 목록

$ metricbeat modules list
Enabled:
elasticsearch
kibana
system

Disabled:
activemq
aerospike
airflow
...

Metricbeat가 Elasticsearch 호스트에 연결할 수 있도록 설정

구성 파일(metricbeat.yml) 편집

  • setup.ilm.overwrite: true
  • output.elasticsearch:
    • hosts: ["localhost:9200"]
    • protocol: "https"
    • username: "elastic"
    • password: "elastic"
    • ssl.certificate_authorities: ["/etc/elasticsearch/certs/http_ca.crt"]
vim /etc/metricbeat/metricbeat.yml
...
# ================================== General ===================================

# The name of the shipper that publishes the network data. It can be used to group
# all the transactions sent by a single shipper in the web interface.
#name:

# The tags of the shipper are included in their own field with each
# transaction published.
#tags: ["service-X", "web-tier"]

# Optional fields that you can specify to add additional information to the
# output.
#fields:
#  env: staging
setup.ilm.overwrite: true
...
# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]

  # Protocol - either `http` (default) or `https`.
  protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "elastic"
  ssl.certificate_authorities: ["/etc/elasticsearch/certs/http_ca.crt"]
...
metricbeat setup
$ metricbeat setup
Index setup finished.
Loading dashboards (Kibana must be running and reachable)
Loaded dashboards

 

브라우저에서 http://192.168.0.61:5601 주소로 접속

 

728x90