跳到主要内容
版本:3.7.0

Nginx

收集 Nginx 服务指标上报到 ONE 平台,以监控分析 Nginx 服务的各种异常情况。

前置条件

  • 在环境中已经部署了可用的 SmartGate 探针。
  • Nginx 服务与 ONE 平台能够进行网络通信。

开始使用

ONE平台配置

  • 进入数据集成 -> 数据接入页面,找到 Nginx 接入卡片,点击开始集成。
  • 添加 Nginx 组件并指定采集的 SmartGate,Nginx 监控连接配置以页面展示为准。可参考:https://github.com/nginx/nginx-prometheus-exporter
  • 保存任务配置。
  • 任务创建完成后,默认是未启用状态,需要手动开启进行数据处理。

数据源端配置

  • Nginx需要开启ngx_http_stub_status_module。
  • 在每个NGINX服务器上,在包含其他NGINX配置文件(如/usr/local/nginx/conf/)的目录中创建一个status.conf文件。
server {
listen 81;
server_name localhost;

access_log off;
\# allow 127.0.0.1;
\# deny all;

location /nginx_status {
\# Choose your status module

\# freely available with open source NGINX
stub_status;

\# for open source NGINX < version 1.7.5
\# stub_status on;

\# available only with NGINX Plus
\# status;
}
}
  • 配置nginx.conf文件,在http部分中添加以下配置块。
http {
include /usr/local/nginx/conf/status.conf
}

配置数据流

  • ONE 平台提供开箱即用的默认数据处理流。
  • 也可以根据所需监控场景的需要,手动配置数据流。

验证

  • 观测洞察 -> 数据模型 ->指标 下查看对应的指标注册数据。
  • 观测洞察 -> 数据探索 下查看对应指标数据。