下载安装
tar -zxvf metricbeat-6.5.1-linux-x86_64.tar
配置 metricbeat.yml , 样例如下:
########################## Metricbeat Configuration ###########################
metricbeat.config.modules:
path: ${path.config}/conf.d/*.yml
reload.period: 10s
reload.enabled: true
metricbeat.max_start_delay: 10s
#========================== Modules configuration ============================
metricbeat.modules:
#------------------------------- System Module -------------------------------
- module: system
metricsets:
- cpu # CPU usage
- load # CPU load averages
- memory # Memory usage
- network # Network IO
- process # Per process metrics
- process_summary # Process summary
- uptime # System Uptime
#- core # Per CPU core usage
#- diskio # Disk IO
#- filesystem # File system usage for each mountpoint
#- fsstat # File system summary metrics
#- raid # Raid
#- socket # Sockets and connection info (linux only)
enabled: true
period: 5s
processes: ['.*']
# Configure the metric types that are included by these metricsets.
cpu.metrics: ["percentages"] # The other available options are normalized_percentages and ticks.
core.metrics: ["percentages"] # The other available option is ticks.
#---------------------------- Elasticsearch Module ---------------------------
- module: elasticsearch
metricsets:
- node
- node_stats
#- index
#- index_recovery
#- index_summary
#- shard
#- ml_job
period: 10s
hosts: ["172.18.96.32:9200"]
#username: "elastic"
#password: "changeme"
#ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
# Set to false to fetch all entries
#index_recovery.active_only: true
#------------------------------- Kibana Module -------------------------------
- module: kibana
metricsets: ["status"]
period: 10s
hosts: ["172.18.96.32:8888"]
basepath: ""
enabled: true
#------------------------------ Logstash Module ------------------------------
- module: logstash
metricsets: ["node", "node_stats"]
enabled: true
period: 10s
hosts: ["172.18.96.32:9600"]
#-------------------------------- Redis Module -------------------------------
- module: redis
metricsets: ["info", "keyspace"]
enabled: true
period: 10s
hosts: ["106.15.102.235:8888"]
#================================ Outputs ======================================
#------------------------------- Redis output ----------------------------------
output.redis:
enabled: true
hosts: ["106.15.102.235"]
port: 8888
key: "metricbeat_log_key"
db: 0
datatype: list
setup.dashboards.enabled: true
启动metricbeat
./metricbeat -e -c metricbeat.yml -d "publish"
./metricbeat -c /home/elk/config/demo.yml > metricbeat.log & – 后台启动