sysguard_mode
The `sysguard_mode` directive determines the logical combination method for multiple sysguard rules to assess system load conditions.
Description
The sysguard_mode directive is utilized within the NGINX sysguard module to specify how different condition checks (like load, memory use, and response times) are combined to determine whether system conditions warrant taking action. This directive accepts two values: or and and. When set to or, the action is triggered if any one of the specified conditions is met, making it easier to respond to less severe system stresses. Conversely, if set to and, all specified conditions must be met before the designated action is taken, enabling stricter control in more accurately assessing critical system states.
This directive is applicable in various contexts, including http, server, and location, allowing for flexible configuration depending on the desired granularity of monitoring and response. The evaluation occurs when a request is processed, and based on the current system metrics measured against the defined thresholds, the appropriate action is taken, such as returning an HTTP error code or limiting service. The behavior is highly customizable and can be adapted to the specific workload requirements of each application served by NGINX.
Config Example
http {
server {
sysguard on;
sysguard_mode and;
sysguard_load load=5.0 action=/limits;
sysguard_mem swapratio=15% action=/limits;
location /limits {
return 503;
}
}
}Ensure that at least one sysguard condition is defined when using this directive; otherwise, it will have no effect.
Using and mode can result in fewer actions being triggered, which might delay response to critical system state changes if all conditions are not met.