Metricbeat 监控 Nginx 概述
以下详细阐述利用 Metricbeat 实现对 Nginx 运行状态的监控方案,供参考实践。
监控环境与版本信息
一、环境版本确认
os: centos 7.2
nginx: nginx-1.13.9
metricbeat: metricbeat-6.2.4
Metricbeat 安装包下载
二、资源获取
#wget https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-6.2.4-x86_64.rpm
RPM 包安装步骤
三、软件安装
#rpm -ivh metricbeat-6.2.4-x86_64.rpm
Nginx 与 Metricbeat 配置详解
四、参数配置
Metricbeat:
#metricbeat modules enable nginx
nginx.yml
- module: nginx
metricsets: ["stubstatus"]
period: 10s
# Nginx hosts
hosts: ["http://127.0.0.1"]
# Path to server status. Default server-status
server_status_path: "basic_status" #According to the situation,and depending
Nginx: (nginx need to compile install)
requried module: --with-http_stub_status_module
nginx.conf:
location /basic_status {
stub_status;
access_log off;
allow 127.0.0.1;
deny all;
}
启动监控服务
五、服务启动
service metricbeat start
上述即为 Metricbeat 监控 Nginx 的核心操作总结,希望能协助大家顺利搭建监控体系。