The script can be integrated via standalone "check program" statement which was 
added in monit 5.3.

For example:

--8<--
check process myprocess with pidfile /var/run/myprocess
     start program = "/etc/init.d/myprocess start"
     stop program = "/etc/init.d/myprocess stop"

check program myscript with path /usr/bin/my-script
    stop program = "/usr/bin/monit stop myprocess"
    if status == 2 then stop
--8<--


Regards,
Martin



On Dec 2, 2011, at 10:27 PM, Johnny Costello wrote:

> I have a process that I want to monitor .  I have a script that checks to see 
> if the Process is responding or if messages are being queued. Depending on if 
> how many messages are in queue I need to respond differently. Normally I 
> would use Nagios for this check but I want to use Monit’s rule based system 
> to do something depending on output.
>  
> Is it possible to do something like this
>  
> check process my-process with pidfile /var/run/myprocess
>      start program = "/etc/init.d/my-process start"
>      stop program = "/etc/init.d/process stop"
>      if exec “/bin/bash /usr/bin/my-script” == 1 then alert
>      else if exec “/bin/bash /usr/bin/my-script” == 2 then stop
>  
> How can I use the output of my script to start, alert or stop my process?
>  
> Thanks
>  
> JC
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to