« Return to Thread: [monit-dev] Is content match result a variable ?

Re: [monit-dev] Is content match result a variable ?

by Martin Pala :: Rate this Message:

| View in Thread

Hi,

monit sets "MONIT_DESCRIPTION" environment variable for the executed program, you may need to wrap it with shell to expand it:

        if match /etc/monit/test.regex then exec  "/bin/bash -c '/path/to/my/script $MONIT_DESCRIPTION'"

Regards,
Martin


On Jul 1, 2011, at 3:32 PM, Eric Pailleau wrote:

> Hi,
>
> I can't find any answer to this question in the documentation.
>
> I'm using content match rule to detect entries in a log, this work perfectly,
> but instead sending alert, it is possible to do an exec with
> content match as variable given as argument to a script ?
>
> [...]
> if match /etc/monit/test.regex then exec  "/path/to/my/script \"$CONTENT\" "
>
> ???
> Regards.
>
> _______________________________________________
> monit-dev mailing list
> monit-dev@...
> https://lists.nongnu.org/mailman/listinfo/monit-dev


_______________________________________________
monit-dev mailing list
monit-dev@...
https://lists.nongnu.org/mailman/listinfo/monit-dev

 « Return to Thread: [monit-dev] Is content match result a variable ?