[Top][All Lists]

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

Re: Use a Script result for Action

From: Martin Pala
Subject: Re: Use a Script result for Action
Date: Wed, 7 Dec 2011 09:48:59 +0100

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

For example:

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


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?
To unsubscribe:

reply via email to

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