I am beginning to migrate from Sysfence to Monit on a RHEL Linux box and I wonder if it possible to create the following sysfence equivalent in Monit.
Sysfence configuration (partial)
For example, our sysfence.conf file declares the following to check for load average conditions.
rule "high load" {
la1 >= 5.0 and
{
{ la5 > 3.0 }
or
{ la15 > 2.0 }
}
}
run '/bin/high-load.sh'
step 300
Monit configuration (an attempt to simulate the Sysfence load average conditions)
For the monitrc file, I created the following statement which passed the configuration syntax check, but the alert only provides the trapped value of the 15min load average rather than for all conditions. One notable difference is that using "or" in place of the 2nd "and" produces a syntax error on monit startup, so AFAIK "or" logic is not permitted.
check system our.server.tld
if loadavg (1min) > 1 and loadavg (5min) > 0.5 and loadavg (15min) > 0.25 then alert
For the test case, I am using much smaller trigger values to reach the thresholds more quickly on a test box with very little use at the time. When one of the conditions was met (15min loadavg) in this case, I received the following alert with no mention of the 1min and 5min load average even though the other conditions were not met, so it seems that the "and" conditions are ignored.
The actual load average values were: load average: 0.34, 0.47, 0.53. I am testing on a server with very little traffic and ran the find command to drive up the system load. Also, it appears that only one decimal places is allowed, so the 0.25 value for the 15min check was apparently rounded down.
Alert email that was sent from Monit
Resource limit matched Service our.server.tld
Date: Thu, 01 Nov 2012 11:34:58
Action: alert
Host: our.server.tld
Description: loadavg(15min) of 0.5 matches resource limit [loadavg(15min)>0.2]
Your faithful employee,
Monit