All Projects → hnlq715 → Status Nginx Module

hnlq715 / Status Nginx Module

Licence: mit
A http status module for pure nginx, which is in production already.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Status Nginx Module

Nginx Error Pages
Cute Error Pages for your nginx web server
Stars: ✭ 166 (+1560%)
Mutual labels:  status, nginx
Domain Status Checker
Gets ip, http return code and domain name registrar of domains
Stars: ✭ 8 (-20%)
Mutual labels:  status
Docker Php Nginx
Lightwight Docker image for the (latest) PHP-FPM and Nginx based on AlpineLinux
Stars: ✭ 22 (+120%)
Mutual labels:  nginx
Php Interview
PHP后端开发面试指南。
Stars: ✭ 26 (+160%)
Mutual labels:  nginx
The World Is Yours
Nginx L7 DDoS Protection! And many more features 💥 ⚡️
Stars: ✭ 20 (+100%)
Mutual labels:  nginx
Docker Socket Http Proxy
Simple nginx proxy container for the docker socket
Stars: ✭ 7 (-30%)
Mutual labels:  nginx
Zbx nginx
Zabbix monitoring template for nginx
Stars: ✭ 22 (+120%)
Mutual labels:  nginx
Devops Tuts
Meteor Devops on OSX with Docker set for Ubuntu
Stars: ✭ 10 (+0%)
Mutual labels:  nginx
Nginx Tutorial
这是一个 Nginx 极简教程,目的在于帮助新手快速入门 Nginx。
Stars: ✭ 845 (+8350%)
Mutual labels:  nginx
Ngx mruby Package Builder
Package Builder of ngx_mruby with Docker
Stars: ✭ 25 (+150%)
Mutual labels:  nginx
Meteorn
MeteorN - A Simple Tool to Run Meteor App with an Nginx Reverse Proxy
Stars: ✭ 25 (+150%)
Mutual labels:  nginx
Ansible Nginx Drupal
Ansible role to configure Nginx for running Drupal using perusio's configuration
Stars: ✭ 23 (+130%)
Mutual labels:  nginx
Stepic web project
Stars: ✭ 8 (-20%)
Mutual labels:  nginx
React Express Fullstack
Full stack (mostly unopinionated) starter pack with React+Redux and Expressjs
Stars: ✭ 23 (+130%)
Mutual labels:  nginx
Ngx http proxy connect module
A forward proxy module for CONNECT request handling
Stars: ✭ 850 (+8400%)
Mutual labels:  nginx
Nginx Auth Proxy
Authentication for multiple services using nginx
Stars: ✭ 22 (+120%)
Mutual labels:  nginx
Lor
a fast, minimalist web framework for lua based on OpenResty
Stars: ✭ 930 (+9200%)
Mutual labels:  nginx
Gowebsocket
golang基于websocket单台机器支持百万连接分布式聊天(IM)系统
Stars: ✭ 937 (+9270%)
Mutual labels:  nginx
Hack Lang Hhvm Resources
Landscaping With Hack Lang & HHVM Resources
Stars: ✭ 10 (+0%)
Mutual labels:  nginx
Nuxt Ssr Demo
✨ 高仿掘金,整合 vue + nuxt + axios + vuex + vue-router (nuxt 自带 vuex 和 vue-router),一个基于 Nuxt 的服务器端渲染 Demo
Stars: ✭ 856 (+8460%)
Mutual labels:  nginx

status-nginx-module

The req status module for pure nginx. The core source file comes from Tengine, which is developed and maintained by Alibaba.

Description

This module will help monitor running status of Nginx.

  • It can provide running status information of Nginx.
  • The information is divided into different zones, and each zone is independent.
  • The status information is about connections, requests, response status codes, input and output flows, rt, and upstreams.
  • It shows all the results by default, and can be set to show part of them by specifying zones.

Compilation

git clone https://github.com/hnlq715/status-nginx-module
./configure --add-module=/path/to/status-nginx-module
make && make install

Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the --add-dynamic-module=PATH option instead of --add-module=PATH on the ./configure command line above. And then you can explicitly load the module in your nginx.conf via the load_module directive.

Configuration Directives

http_status_zone

syntax: http_status_zone <zone_name> <row_name> <shm_size>
default: no
context: http

Sets up shared memory zone named zone_name for statistics. Statistics are simple table where first column is key and its value is computed by evaluating expression row_name. Remaining columns are collected metrics (see below). shm_size specifies reserved memory for the statistics, each row will consume about 200 bytes of memory (this is rough estimation, see source code for exact value). If request should create new statistics row and there is no more memory in zone, then it is not counted in this zone and appropriate warning is logged.

http_status

syntax: http_status <zone_name> [<zone_name> ...];
default: no
context: http, server, location

Takes list of zones (at least one) where request should be counted.

http_status_bypass

syntax: http_status_bypass <condition> [<condition> ...];
default: no
context: http, server, location

Defines conditions under which request will not be counted in statistics at all. If at least one value of the string parameters is not empty and is not equal to “0” then the request will not be counted.

http_status_show

syntax: http_status_show [<zone_name> [<zone_name> ...]];
default: no
context: location

Renders statistics as a response to the request matching current location. No Content-Type response header is set.

Variables

$upstream_first_addr

This module defines variable $upstream_first_addr which contains address of first upstream that was contacted when handling current request.

Format of statistics output

Statistics are formatted as comma separated values (without quoting, thus you can create more virtual columns by having commas in row_name). No header row is rendered.

  • row_name - value of expression defined by the directive http_status_zone
  • bytesintotal - total number of bytes received from client
  • bytesouttotal - total number of bytes sent to client
  • conn_total - total number of accepted connections
  • req_total - total number of processed requests
  • 2xx - total number of 2xx requests
  • 3xx - total number of 3xx requests
  • 4xx - total number of 4xx requests
  • 5xx - total number of 5xx requests
  • other total - number of other requests
  • rt_total - accumulated request time (miliseconds)
  • upstream_req - total number of requests calling for upstream
  • upstream_rt - accumulated time of upstream calls (miliseconds)
  • upstream_tries - total number of calls for upstream

Example

http {
    # Set up statistics zone named 'host'.
    # ( Name of shared memory zone cannot be used in other
    #   places using named shared memory zones (proxy_cache_path ... keys_zone=..., ). )
    http_status_zone host "$host,$server_addr:$server_port" 10M;

    # Prepare variable for statistics with custom differrentiation.
    # ( We cannot use 'set' in 'http' block, so we use map and set it to "$server_name" by default,
    #   with mapping of server_name '_' to "unnamed_server" );
    map "$server_name" $custom_stat_name {
        default "$server_name";
        _ unnamed_server;
    }
    http_status_zone custom_stats "_CUSTOM,$custom_stat_name" 10M;

    # Count served pages only in zone 'host' by default
    http_status host;


    server {
        server_name _;

        location /all-stats {
            #Display rows from all zones together
            http_status_show;
        }

        location /host-stats {
            #Display rows only from 'host' zone;
            http_status_show host;
        }

        location /all-stats-ex {
            #Display rows from both zones (defined explicitly for configuration demonstration)
            http_status_show host custom_stats;

            #Override custom_stats_name when counting accesses to this location
            set $custom_stat_name "all stats explicit";
        }

        # Count all accesses to this server in both statistics zones.
        http_status host custom_stats;
    }
}

When you call '/all-stats', you will get results like this:

localhost,127.0.0.1:80,162,6242,1,1,1,0,0,0,0,10,1,10,1
_CUSTOM,unnamed_server,6242,1,1,1,0,0,0,0,10,1,10,1
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].