Я хочу настроить предупреждающее сообщение для следующего условия:
if cpu > 75% for 2 cycles then exec "command|mail -s subject test@example.com"
в файл конфигурации monitrc
как я могу добавить эту команду?
check process apache with pidfile /var/run/apache2.pid
start program = "/etc/init.d/apache2 start" with timeout 60 seconds
stop program = "/etc/init.d/apache2 stop"
if cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart # 10minutes
if totalmem > 200.0 MB for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if failed host 192.168.1.200 port 80 protocol http
and request "/monit/token"
then restart
Почему, если я добавлю эту строку, при выполнении условия электронное письмо не будет отправлено? Любые идеи?
Поместите команду в сценарий оболочки
if cpu > 75% for 2 cycles then exec "/full/path/custom_email.sh"
Тогда / full / path / custom email.sh будет содержать что-то вроде
#!/bin/bash
command|mail -s subject test@example.com