Writing more complex rules
In addition to numbers and keywords, you can use mathematical and Boolean operators, and you can use user-defined variables to specify rules.
- The keywords of Predefined keywords
- Decimal numbers
- The mathematical operators
- +
- addition
- -
- subtraction
- *
- multiplication
- /
- division
- <
- less than
- >
- greater than
- Parentheses ( and ) to group mathematical expressions
- The Boolean operators
- &
- and
- |
- or
- !
- not
- User-defined variables
You can specify complex calculations as user-defined variables, which can then be used in expressions. User-defined variables are case-sensitive and must not match a pre-defined variable or keyword. In the configuration file, definitions for user-defined variables must precede their use in expressions.
Variable names consist of alphanumeric characters and the underscore (_) character. An individual variable name must not exceed 128 characters. All user-defined variable names and values, in total, must not exceed 4096 characters.
Examples
HOTPLUG = "loadavg > onumcpus + 0.75"
HOTPLUG = "(loadavg > onumcpus + 0.75) & (idle < 10.0)"
-
my_idle_rate = "(cpustat.idle - cpustat.idle[5]) / (cpustat.total_ticks - cpustat.total_ticks[5])" my_idle_percent_total = "my_idle_rate * 100 * onumcpus" ... HOTPLUG = "(loadavg > onumcpus + 0.75) & (my_idle_percent_total < 10.0)"