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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Eric Pailleau
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
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monit-dev
Reply | Threaded
Open this post in threaded view
|

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

martinp@tildeslash.com
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
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/monit-dev


_______________________________________________
monit-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monit-dev