How to restart and alert if condition matches in Monit

monitmonitoringsystem-monitoring

How can I do multiple things when condition is matched? For example if I want to restart a process and also send alert email. I know I can do it with two separate lines, but can I combine them?

if cpu > 95% for 2 cycles then restart
if cpu > 95% for 2 cycles then alert

Best Answer

Monit will implicitly alert upon process restart. You don't need to specify "then alert".