Ngx_http_sysguard_module
When the remaining percentage of swap, the load value to the set value, jumps to the URL specified by the action.
server {Sysguard on; sysguard_load load=1.1 action=/loadlimit sysguard_mem swapratio=90% action=/swaplimit/ Loadlimit {return 500} Location/swaplimit}
Note that this module supports the protection based on load and memory information only when the SysInfo function is supported by the system, and when the system supports LOADAVG functions based on load.
Instructions
Syntax:sysguard [on | off]
Default:sysguard off
Context:http, Server
Turn this module on or off
Syntax:sysguard_load Load=number [Action=/url]
Default:none
Context:http, Server
This directive is used to configure a user's request to be protected according to the system's load to protect the system. When the system reaches number in a minute, the incoming request is forwarded to the URL specified by the action. If the action is not configured, it returns a 503 error directly.
Syntax:sysguard_mem swapratio=ratio% [Action=/url]
Default:-
Context:http, Server
This designation is used to configure the system to be protected by restricting user requests based on the memory usage state of the system. Swapratio is used to configure the incoming request to jump to the specified URL when the ratio% of the current swap space is used. If the action is not configured, it returns a 503 error directly. In addition, configuring this designation does not work if the user has disabled the swap interval themselves.
Syntax:sysguard_interval time
Default:sysguard_interval 1s
Context:http, Server
This specifies the cache time used to configure access to system information. The default is 1s, which means that within this 1s, only one system function is invoked to get the current state of the system.
Syntax:sysguard_log_level [INFO | notice | warn | error]
Default:sysguard_log_level Error
Context:http, Server
This directive is used to configure the log level when the log is logged when the operation of the protection system is performed.