Feature Friday #32: Doing math in policy with eval()
Ever need to do some math during policy evaluation? Sometimes configuration settings are based on available resources. For example, what if you want to calculate the size of shared buffers to be 25% of your available memory? Let’s write some policy. First, we need to figure out how much memory we have. Let’s parse this out from /proc/meminfo: So, we have 65505464 kB of memory in total. Knowing that we can use eval() to calculate what 25% is. eval() can also be used to test truthfulness.