[Top][All Lists]

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

Re: sending a custom email on text-string match

From: Guillaume François
Subject: Re: sending a custom email on text-string match
Date: Thu, 28 Jul 2016 15:20:31 +0200


Best is to put full path to binairies like /bin/echo and /usr/bin/mailx

Best Regards,

2016-07-28 15:04 GMT+02:00 Anthony Griffiths <address@hidden>:
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?

To unsubscribe:

Version: 3.1
GCS/IT d(+) s++:- a C++$ ULC(+)>+++$ !P--- L+>$ !E---? W+++$ !N* !o-- K--? w(+) !O---? !M- !V--? PS+? !PE Y+ PGP++>+++ !t-- !5 !X- R(+)>++* tv-? b(-) DI !D- G(+)>+ e+++ h--() r->$ y?*

reply via email to

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