All Projects → vozlt → Nginx Module Sysguard

vozlt / Nginx Module Sysguard

Licence: bsd-2-clause
Nginx sysguard module

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Nginx Module Sysguard

Ngx healthcheck module
nginx module for upstream servers health check. support stream and http upstream. 该模块可以为Nginx提供主动式后端服务器健康检查的功能(同时支持四层和七层后端服务器的健康检测)
Stars: ✭ 145 (-74.47%)
Mutual labels:  nginx, nginx-module
Ansible Collection Hardening
This Ansible collection provides battle tested hardening for Linux, SSH, nginx, MySQL
Stars: ✭ 2,543 (+347.71%)
Mutual labels:  protection, nginx
Mod zip
Streaming ZIP archiver for nginx 📦
Stars: ✭ 178 (-68.66%)
Mutual labels:  nginx, nginx-module
Ngx dynamic limit req module
The ngx_dynamic_limit_req_module module is used to dynamically lock IP and release it periodically.
Stars: ✭ 57 (-89.96%)
Mutual labels:  nginx, nginx-module
Ngx php7
ngx_php7 - Embedded php7 scripting language for nginx module. Mainline development version of the ngx_php.
Stars: ✭ 337 (-40.67%)
Mutual labels:  nginx, nginx-module
Nginx Builder
A tool to build deb or rpm package of required Nginx version from the source code, with the ability to connect third-party modules. Nginx parameters are set in the yaml configuration file.
Stars: ✭ 123 (-78.35%)
Mutual labels:  nginx, nginx-module
Nginx Module Vts
Nginx virtual host traffic status module
Stars: ✭ 2,518 (+343.31%)
Mutual labels:  nginx, nginx-module
Zstd Nginx Module
Nginx modules for the Zstandard compression
Stars: ✭ 64 (-88.73%)
Mutual labels:  nginx, nginx-module
Ngx php
ngx_php - Embedded php scripting language for nginx module. All released versions of the code repository.
Stars: ✭ 290 (-48.94%)
Mutual labels:  nginx, nginx-module
Docker Waf
An NGINX and ModSecurity based Web Application Firewall for Docker
Stars: ✭ 181 (-68.13%)
Mutual labels:  protection, nginx
Nginx Nonewlines
This is an nginx module to strip the served HTML of all newlines (\n and \r characters)
Stars: ✭ 17 (-97.01%)
Mutual labels:  nginx, nginx-module
Nginx Tutorial
最全面,最深入的nginx从入门到精通的教程
Stars: ✭ 416 (-26.76%)
Mutual labels:  nginx, nginx-module
Nginx Http Echo Module
A simple Nginx echo module
Stars: ✭ 192 (-66.2%)
Mutual labels:  nginx, nginx-module
Ansible Nginx Hardening
This Ansible role provides secure nginx configurations.
Stars: ✭ 180 (-68.31%)
Mutual labels:  protection, nginx
Nginx Opentracing
NGINX plugin for OpenTracing
Stars: ✭ 341 (-39.96%)
Mutual labels:  nginx, nginx-module
Testcookie Nginx Module
simple robot mitigation module using cookie based challenge/response technique. Not supported any more.
Stars: ✭ 447 (-21.3%)
Mutual labels:  nginx, nginx-module
Tkeed
🌎 High Performance HTTP WebServer
Stars: ✭ 485 (-14.61%)
Mutual labels:  nginx
Centminmod
CentOS Shell menu based Nginx LEMP web stack auto installer (GPLv3 licensed)
Stars: ✭ 519 (-8.63%)
Mutual labels:  nginx
Iptv
一键安装管理 FFmpeg / nginx / openresty / xray / v2ray / armbian / proxmox / cloudflare partner,workers / ibm cloud foundry 脚本
Stars: ✭ 481 (-15.32%)
Mutual labels:  nginx
Nginx Le
Nginx with automatic let's encrypt (docker image)
Stars: ✭ 475 (-16.37%)
Mutual labels:  nginx

Nginx sysguard module

License

Nginx sysguard module

Table of Contents

Version

This document describes nginx-module-sysguard v0.1.0 released on 23 Feb 2017.

Dependencies

  • nginx
  • sysinfo(2) | getloadavg(3)
  • /proc/meminfo

Compatibility

  • 1.11.x (last tested: 1.11.10)

Earlier versions is not tested.

Installation

  1. Clone the git repository.
shell> git clone git://github.com/vozlt/nginx-module-sysguard.git
  1. Add the module to the build configuration by adding
--add-module=/path/to/nginx-module-sysguard
  1. Build the nginx binary.

  2. Install the nginx binary.

Synopsis

http {

    ...

    server {

        ...

        sysguard on;
        sysguard_mode or;

        sysguard_load load=10.5 action=/loadlimit;
        sysguard_mem swapratio=20% action=/swaplimit;
        sysguard_mem free=100M action=/freelimit;
        sysguard_rt rt=0.01 period=5s method=AMM:10 action=/rtlimit;

        location /loadlimit {
            return 503;
        }

        location /swaplimit {
            return 503;
        }

        location /freelimit {
            return 503;
        }

        location /rtlimit {
            return 503;
        }
    }

    ...

    server {

        ...

        location /api {
            sysguard on;
            sysguard_mode or;
            sysguard_load load=20 action=/limit;
            sysguard_mem swapratio=10% action=/limit;
            sysguard_rt rt=2.01 period=5s method=WMA:10 action=/limit;

            ... 

        }

        location /images {
            sysguard on;
            sysguard_mode and;
            sysguard_load load=20 action=/limit;
            sysguard_mem swapratio=10% action=/limit;
            sysguard_rt rt=2.01 period=5s method=WMA:10 action=/limit;

            ...

        }

        location /limit {
            return 503;
        }
    }

}

Description

This module can be used to protect your server in case system load, memory use goes too high or requests are responded too slow. This is a porting version of the sysguard in tengine to the pure NGINX so as to support the same features.

Caveats: Note this module requires the sysinfo(2) system call, or getloadavg(3) function in glibc. It also requires the /proc file system to get memory information.

Embedded Variables

The following embedded variables are provided:

  • $sysguard_load
    • The load of system. If $sysguard_load's value is 100, then load is 0.1(100/1000). (/msec)
  • $sysguard_swapstat
    • The ratio of using swap. (/per)
  • $sysguard_free
    • The real free space of memory. (/byte)
  • $sysguard_rt
    • The average of request processing times. If $sysguard_rt's value is 100, then response time is 0.1sec(100/1000). (/msec)
  • $sysguard_meminfo_totalram
    • The total memory of meminfo. (/byte)
  • $sysguard_meminfo_freeram
    • The free memory of meminfo. (/byte)
  • $sysguard_meminfo_bufferram
    • The buffer memory of meminfo. (/byte)
  • $sysguard_meminfo_cachedram
    • The cached memory of meminfo. (/byte)
  • $sysguard_meminfo_totalswap
    • The total swap of meminfo. (/byte)
  • $sysguard_meminfo_freeswap
    • The free swap of meminfo. (/byte)

Directives

sysguard

- -
Syntax sysguard <on|off>
Default off
Context http, server, location

Description: Enables or disables the module working.

sysguard_load

- -
Syntax sysguard_load load=number [action=/url]
Default -
Context http, server, location

Description: Specify the load threshold. When the system load exceeds this threshold, all subsequent requests will be redirected to the URL specified by the 'action' parameter. It will return 503 if there's no 'action' URL defined. This directive also support using ncpuratio to instead of the fixed threshold, 'ncpu' means the number of cpu's cores, you can use this directive like this: load=ncpu1.5

sysguard_mem

- -
Syntax sysguard_mem swapratio=ratio% free=size [action=/url]
Default -
Context http, server, location

Description: Specify the used swap memory or free memory threshold. When the swap memory use ratio exceeds this threshold or memory free less than the size, all subsequent requests will be redirected to the URL specified by the 'action' parameter. It will return 503 if there's no 'action' URL. Sysguard uses this strategy to calculate memory free: "memfree = free + buffered + cached"

sysguard_rt

- -
Syntax sysguard_rt rt=second period=time [method=<AMM|WMA>:number] [action=/url]
Default -
Context http, server, location

Description: Specify the response time threshold. Parameter rt is used to set a threshold of the average response time, in second. Parameter period is used to specifiy the period of the statistics cycle. If the average response time of the system exceeds the threshold specified by the user, the incoming request will be redirected to a specified url which is defined by parameter 'action'. If no 'action' is presented, the request will be responsed with 503 error directly. The method is a formula that calculate the average of response processing times. The number in method is the number of samples to calculate the average. The default method is set to be method=AMM:period.

sysguard_mode

- -
Syntax sysguard_mode <and|or>
Default or
Context http, server, location

Description: If there are more than one type of monitor, this directive is used to specified the relations among all the monitors which are: 'and' for all matching and 'or' for any matching.

sysguard_interval

- -
Syntax sysguard_interval time
Default 1s
Context http, server, location

Description: Specify the time interval to update your system information. The default value is one second, which means sysguard updates the server status once a second.

sysguard_log_level

- -
Syntax sysguard_log_level <info|notice|warn|error>
Default error
Context http, server, location

Description: Specify the log level of sysguard.

See Also

TODO

Donation

License

Author

  • Copyright (C) 2010-2015 Alibaba Group Holding Limited
  • Copyright (C) 2017, YoungJoo.Kim <[email protected]>
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].