Analyzer ngx-stats

Name

ngx-stats - Nginx Statistics from nginx_status

This analyzer samples data from ngx-stub-module and calculates key performance metrics for Nginx, OpenResty, and Kong servers. It captures request counts, active connections, and other status information, then computes derived metrics such as requests per second (RPS) and average request processing time. The analyzer outputs structured data visualized as line charts, providing insights into server performance and traffic patterns over time. This helps operators monitor server health and identify performance trends in production environments.

Resource Category

CPU.

Application Type & Technical Stack

  • OpenResty
  • Kong
  • APISIX

Command Line Syntax

The analyzer can be invoked directly on the command-line via the orxray utility from the openresty-xray-cli software package.

Alternatively, the analyzer can also be invoked manually or automatically on the web console UI of OpenResty XRay (like on the Advanced web page).

# PID is the target process PID.
orxray analyzer run ngx-stats -p PID

# trace a shell command directly
orxray analyzer run ngx-stats -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run ngx-stats -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run ngx-stats --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Bar Charts
  • Plain Texts

Output Example

{
  "ver": 1,
  "type": "bar",
  "title": "nginx statistics from ngx_stub_status",
  "series": {
      "data": {
          "accepted connections per second": 172,
          "handled http requests per second": 174,
          "active connections": 5350,
          "reading connections": 0,
          "waiting connections": 148,
          "writing connections": 5202,
          "handled connections per second": 172
      },
      "name": "ngx-stats"
  }
}

Author

The OpenResty Inc. Team.

Copyright (C) by OpenResty Inc. All rights reserved.