vozlt/nginx-module-sysguard
FreeNginx sysguard module
FreeFree tier
About vozlt/nginx-module-sysguard
nginx-module-sysguard is an open-source Nginx module that protects servers from overload by monitoring system load, memory usage (swap and free), and request processing times. It is a port of the sysguard module from Tengine, providing similar functionality for pure Nginx. The module allows administrators to define thresholds and configure actions (e.g., redirect to a custom URL or return an error code) when system metrics exceed specified limits. It supports multiple modes (AND/OR) for combining conditions and exposes embedded variables for detailed reporting. Requires the sysinfo(2) or getloadavg(3) system calls and the /proc filesystem for memory data.
Key Features
Monitors system load, memory usage (swap and free), and request processing times
Configurable thresholds with action URLs (e.g., redirect to error page)
Supports AND/OR mode for combining multiple conditions
Exposes embedded variables like $sysguard_load, $sysguard_swapstat, $sysguard_free, $sysguard_rt
Port of Tengine sysguard module for pure Nginx
Interval-based checking with configurable log level
Pros & Cons
Pros
- Lightweight and focused on system-level protection
- Configurable per server or location context
- Supports multiple resource metrics (load, memory, request time)
- Compatible with Tengine sysguard configurations
- Open source and free to use
Cons
- Requires Linux-like system calls (sysinfo/getloadavg) and /proc filesystem
- Not tested on Windows or other non-Linux platforms
- Relatively old release (v0.1.0 from 2017) with limited maintenance
- No built-in alerting or notification mechanisms
- Documentation is brief and lacks advanced usage examples
Best For
Protect Nginx servers from overload due to high system loadPrevent memory exhaustion by monitoring swap usage and free memoryMitigate slow request responses by limiting request processing timeRedirect traffic to maintenance pages when resources are critically lowAdd an extra layer of stability for high-traffic web applications
FAQ
What is nginx-module-sysguard?
It is an Nginx module that monitors system load, memory usage, and request processing times, and can take configurable actions (e.g., redirect to a URL) when thresholds are exceeded. It is a port of the sysguard module from Tengine.
How do I install nginx-module-sysguard?
Clone the repository from GitHub, add the module to the Nginx build configuration using --add-module=/path/to/nginx-module-sysguard, then build and install Nginx.
What dependencies does it require?
It requires the sysinfo(2) or getloadavg(3) system call and the /proc filesystem for memory information.
Which Nginx versions are compatible?
It has been tested with Nginx 1.11.x (last tested 1.11.10). Earlier versions are not tested.
What metrics can it monitor?
It can monitor system load, swap usage ratio, free memory, and average request processing time.