The syntax is incorrect - see monit manual. The alert action doesn't allow to specify the target email on the testing rule directly. The recipients are listed with the standalone 'alert' (local) or 'set alert' (global) statement. The correct syntax thus is:

  check file server.log with path /foo/log/server.log
    if match ".*\s(ERROR|WARN)\s.*" then alert
    alert [EMAIL PROTECTED]

=> you specify the alert target once. The alert action in the rule then sends the alert to the recipient. The advantage of this syntax is obvious if you will add more testing rules, such as:

  check file server.log with path /foo/log/server.log
    if match ".*\s(ERROR|WARN)\s.*" then alert
    if timestamp > 1 hour then alert
    if size > 40 MB the exec "/bin/rotate  /foo/log/server.log"
    alert [EMAIL PROTECTED]

... all these rules generate alert, but you specified the target just once.

Martin


On Oct 2, 2007, at 10:57 AM, Nathan wrote:

Hi,

This will be the first of a few emails describing various problems with
the file content checking:

Problem 1
=========
Local alerts don't work unless there is an exec:

Here is the config:

check file server.log with path /foo/log/server.log
  if match ".*\s(ERROR|WARN)\s.*" then
    alert [EMAIL PROTECTED]


Monit reports "Error: parse error '[EMAIL PROTECTED]'"

If I add an exec line in then it works, i.e.:

check file server.log with path /foo/log/server.log
  if match ".*\s(ERROR|WARN)\s.*" then
    exec "/bin/true"
    alert [EMAIL PROTECTED]


Is this a bug, or something I'm missing.

Thanks in advance,
Nathan


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general



--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to