|Subject:||Re: sending a custom email on text-string match|
|Date:||Thu, 28 Jul 2016 15:20:31 +0200|
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/fileif match "<text string>" thenecho "<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?
|[Prev in Thread]||Current Thread||[Next in Thread]|