使用Metricbeat和Filebeat监控Nginx性能指标和日志

本文介绍了如何使用Metricbeat和Filebeat监控Nginx的性能指标和日志,详细阐述了从安装配置到数据可视化的步骤。包括启用Nginx的stub_status模块,配置Elasticsearch和Kibana连接,以及在Kibana中定制仪表板展示监控数据。
摘要由CSDN通过智能技术生成

使用Metricbeat和Filebeat监控Nginx性能指标和日志

前言

本文描述了通过Metricbeat和Filebeat来分别监控Nginx的性能指标和日志,并将数据存储到Elasticsearch中,再通过Kibana进行可视化数据分析。

前置条件:

  • CentOS7 x86_64

  • Elastic Stack:

    • 已以rpm方式安装Elastichsearch 7.4.0
    • 已以rpm方式安装Kibana 7.4.0

如果还没有安装Elasticsearch和Kibana,可以参考:

目标机器:

  • 已以rpm方式安装Nginx

安装和配置配置Metricbeat

参见:

下载Merticbeat

Metribeat 7.4.0:

Metricbeat 最新版:

下载Metricbeat 7.4.0 rpm和sha512:

# download rpm package
wget https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.4.0-x86_64.rpm

# download sha512
wget https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.4.0-x86_64.rpm.sha512

校验sha512:

sha512sum -c metricbeat-7.4.0-x86_64.rpm.sha512

安装Metricbeat

安装Metricbeat:

rpm -ivh metricbeat-7.4.0-x86_64.rpm

Metricbeat目录

Metricbeat目录:

参见:

配置目录为/etc/metricbeat

  • metricbeat.yml 为Metricbeat主配置文件。
  • modules.d/*.yml 为Meticbeat module配置文件

程序目录为/usr/share/metricbeat:

  • bin 目录为可执行文件目录。

数据目录为/var/lib/metricbeat,日志目录为/var/log/metricbeat

配置连接Elasticsearch和Kibana

如果Metricbeat和Elasticsearch和Kibana安装在同一台机器上,则不需要修改配置。

编辑·/etc/metricbeat/metricbeat.yml,设置Elasticsearch和Kibana的连接。

修改前:

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

  # Optional protocol and basic auth credentials.
  #protocol: "https"
  #username: "elastic"
  #password: "changeme"


setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  #host: "localhost:5601"

  # Kibana Space ID
  # ID of the Ki
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值