Hi,
you can use the "check program" statement (available in monit version 5.3+) to
integrate your test scripts with monit and set the action based on the return
value.
Example:
check program mytest with path "/usr/bin/mytest.sh"
if status == 10 then alert
Regards,
Martin
On Aug 23, 2012, at 10:08 AM, Raymond Boswel (RPH) <[email protected]>
wrote:
> Hi All,
>
> I’ve been successfully using monit for about a month. I have however been
> misusing Monit somewhat to run more complex tests while still using Monit’s
> alerts to send out emails.
>
> My (hack) is as follows :
>
> I monitor the monit control file for size, a test which it will fail, every x
> minutes. When this test fails monit calls a perl script which performs an
> input vs output test on an application server, to ensure that the application
> is still in a sane state. If the test fails I stop the offending service from
> the script. Monit then notices that the service is stopped and restarts the
> service and sends out alerts. This works fine, but it would be nice if the
> script could just pass a return value back to monit. Monit can then take the
> appropriate action itself.
>
> I’m also currently working on a second test on this server. When this test
> fails I would like to let Monit simply send out an email. I haven’t figured
> out a simple way to do this yet. I therefore propose that a command line
> action to Monit is added, for example $monit alert <Service> <Message>, which
> then sends out an email in the format as defined in the control file.
>
> I couldn’t find any similar suggestions, so I hope these are useful.
>
> Kind regards,
>
> Raymond Boswel
> Engineer/technologist
> Telkom Development Laboratory
> Tel: +27 12 529 7379
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> This e-mail is subject to the Telkom SA electronic communication legal
> notice, available at : http://www.telkom.co.za/TelkomEMailLegalNotice.PDF
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general