monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sending a custom email on text-string match


From: Anthony Griffiths
Subject: sending a custom email on text-string match
Date: Thu, 28 Jul 2016 14:04:09 +0100

I'm running centos 6 server with monit-5.14-1.el6.i686 and I want monit to send a small custom email when it finds a match in a log file, I'm using mailx and having difficulty with the correct syntax. I have this command in monit.conf:

check file <filename> with path /path/to/log/file
      if match "<text string>" then
      echo "<email message body here>"| mailx -s "<email subject line>" <email address here>"

but this doesn't work, when restarting monit I get:

Starting monit: /etc/monit.conf:51: syntax error 'echo'.

I know I could use 'if match "<text string>" then alert' but I'd rather use my own custom message,

I know I could create a little bash script and execute that but it seems a long way round to do such a small thing. Can monit do this and if so what is the correct syntax?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]