'set alert' is not context aware - continued
I cannot see a way to add comment to 'resolved' issue so opening a new one. Version monit-5.8.1-1:
check process tomcat with pidfile ...
start program = ...
stop program = ...
if cpu > 90% for 5 cycles then restart
if failed host ... port 80 protocol http request "/" content = ".*abcd.*"
then restart
if 3 restarts within 3 cycles then stop
set alert user1@domain1
check file catalina.out with path ...
ignore not match "^java.lang.OutOfMemoryError: Java heap space"
if match "java.lang.OutOfMemoryError" then
exec "/bin/bash -c '...'"
if size > 10 MB then
exec "/bin/bash -c '...'"
set alert user2@domain2
With disabled/missing global 'set alert' and above test whenever I append 'java.lang.OutOfMemoryError' to catalina.out (it fires check file) or I shutdown tomcat (it fires check process) the same emails are sent to both user1@domain and user2@domain:
monit alert -- Content match catalina.out monit alert -- PID changed tomcat monit alert -- Does not exist tomcat monit alert -- Exists tomcat
The 'set alert' does not behave like context sensitive - it just adds any email mentioned wherever in the config to a global recipient list and then sends any alert to this list.
Comments (4)
-
repo owner -
repo owner -
assigned issue to
- changed component to Monit
- marked as task
- marked as trivial
- edited description
-
assigned issue to
-
repo owner - changed status to resolved
Not bug ... configuration issue - note the difference between "set alert x@y.z" (global) and "alert x@y.z" (local).
These statements can be combined (i.e. single "set alert" for user who should receive alerts for all services and local alerts for those who should get only specific services alerts)
-
reporter Forgive me my blindness regarding your original reply and thank you for your patience. Now it works :)
- Log in to comment
The "set alert" is global statement - not contextual for given service only. If you want to add alert in the context of the given service only, your configuration should look like this (note the missing "set" word):