Dragan Zubac wrote:
Anyway,what am I trying to accomplish ?
Have a certain processes which doesn't genereate their own PID's,so
wrote a little wrapper around them,no problem.The problem is how to
configure monit to execute external shell script if some processes was
restarted let's say 5 times in 2 cycles or so ? I don't want the alerts
to be spam each time the process is restarted,but if there was N times
in M cycles,execute some external script which should send me process's
log file with explanation of restart reason ?
You can use the timestamp test on the pidfile which was created by your
wrapper on precess startup/restart:
--8<--
check file myprocpid with path /var/run/myproc.pid
if changed timestamp 2 times within 5 cycles then exec '...'
--8<--
Second ones,is there a possibility to configure multiply mail formats
for different process checks or something similar ? process-N send mail
format-N or ? Or maybe different mail layout for different service tests ?
Yes, you can set the format per recipient (monit also provides macros
for mail format which are expanded to the actual values):
http://www.tildeslash.com/monit/doc/manual.php#setting_a_local_alert_statement
Example:
--8<--
check process proc1 with pidfile /var/run/proc1.pid
alert [EMAIL PROTECTED] with mail-format { subject: HELO }
check process proc2 with pidfile /var/run/proc2.pid
alert [EMAIL PROTECTED] with mail-format { subject: EHLO }
--8<--
Martin
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general