- edited description
Multiple poll cycles does not work as expected
Hello Tildeslash,
after switching to Monit 5.28.1 the "every n cycles" statement does not work like expected.
Monit 5.28.1 uptime: 2m
Service Name Status Type
MacBookPro.local Resource limit matched System
sleep Not monitored Process
four.sh Waiting Program
five.sh OK Program
For services with a odd number of cycles the status became "OK" but for an even number of cycles the status is "Waiting" and the command will not execuded.
'MacBookPro.local' exec: '/Users/lutz/Aufheben/monit-5.28.1/env.sh'
'MacBookPro.local' cpu usage check succeeded [current cpu usage = 4.8%]
'MacBookPro.local' loadavg (5min) check succeeded [current loadavg (5min) = 1.0]
'MacBookPro.local' loadavg (1min) check succeeded [current loadavg (1min) = 1.0]
'status.sh' status succeeded (0) -- program test script for status.sh
MONIT_SERVICE=status.sh
'status.sh' program started
'four.sh' test skipped as current cycle (2) < every cycle (4)
'four.sh' test skipped as current cycle (3) < every cycle (4)
'five.sh' test skipped as current cycle (2) < every cycle (5)
'five.sh' test skipped as current cycle (3) < every cycle (5)
'MacBookPro.local' swap usage check succeeded [current swap usage = 0.0%]
'MacBookPro.local' mem usage of 37.9% matches resource limit [mem usage > 35.0%]
'MacBookPro.local' cpu usage of 5.5% matches resource limit [cpu usage > 5.0%]
Sending Resource limit matched notification to lutz@localhost
Mail: No mail servers are defined -- please see the 'set mailserver' statement in the manual
Aborting event
'MacBookPro.local' exec: '/Users/lutz/Aufheben/monit-5.28.1/env.sh'
'MacBookPro.local' cpu usage check succeeded [current cpu usage = 5.5%]
'MacBookPro.local' loadavg (5min) check succeeded [current loadavg (5min) = 1.0]
'MacBookPro.local' loadavg (1min) check succeeded [current loadavg (1min) = 1.0]
'status.sh' status succeeded (0) -- program test script for status.sh
MONIT_SERVICE=status.sh
'status.sh' program started
'four.sh' test skipped as current cycle (1) < every cycle (4)
'five.sh' test skipped as current cycle (4) < every cycle (5)
'five.sh' program started
'MacBookPro.local' swap usage check succeeded [current swap usage = 0.0%]
'MacBookPro.local' mem usage of 37.9% matches resource limit [mem usage > 35.0%]
'MacBookPro.local' cpu usage check succeeded [current cpu usage = 4.9%]
It seems to me the every counter will be increased two times in a cycle, see above. Therefore a even number of cycles will not match.
I append a verbose log to the ticket.
With regards,
Lutz
p.s.
I spent some time to do the test on MacOS, Linux and AIX.
Comments (4)
-
reporter -
Same issue here, I had to rollback to 5.27.2. Some checks I use for example :
check program script with path "/path/to/script" every "6-8 0,8,16 * * *" if status != 1 then exec "/path/to/alert"
check program check with path "/path/to/check" every 4 cycles if status != 0 then exec "/path/to/alert""
-
repo owner - changed status to resolved
Fixed: Issue
#994(Monit 5.28.1 regression): The 'check program' with custom test schedule (using the 'every' statement) doesn't work. The problem was introduced here: https://bitbucket.org/tildeslash/monit/commits/3e554e213d76 . The 'check program' call of _checkSkip() is deferred to the check_program(), as it needs to be always called to collect the child status. The 3e554e213d76 made it call the _checkSkip() twice and broke the schedule.→ <<cset 47e042610940>>
-
reporter Hello Tildeslash,
the "every n cycles" statement seems to work again, with your patch to "validate.c".Thanks for your help,
Lutz - Log in to comment