The exec action is executed always when the condition matches. You can modify the script which is executed to prevent repated execution when the state remains the same.
Your exec script was named "/pratap/script-monit" with "stop" or "start" arguments => when the argument is "stop", then check for the existence of some flag file - for example "/tmp/script-monit.stop_executed". If this file exists, the script can return immediately, otherwise it can do "touch /tmp/script-monit.stop_executed" (to set the flag) and perform the stop. The "start" argument action can do the similar state handling and remove the "/tmp/script-monit.stop_executed" file, so next time the state changes and stop will be called, it will be performed.
We will most probably change the behavior in the future to behave similarly to the "alert" action implementation which triggers by default only on state changes with optional "reminder" for repeated execution if state persists.
On Nov 4, 2011, at 1:10 PM, Pratap Kumar wrote: Hi Martin,
Thank you very much for your reply.
Now the script working is expected.But,it is trying to fire the same action every 60 secs and writing the logs to log file .
Can we do ,if monit fires the action very first time and in next cycle the status is same,then it should not fire the action.If status changes then next action should fire, not repeatedly.
Thanks Pratap
On Fri, Nov 4, 2011 at 5:04 PM, Martin Pala <address@hidden> wrote:
Please can you stop monit and run it with the -v option + send the output again? The attached monit log excerpt doesn't show any error - the debug will show full trace.
On Nov 4, 2011, at 8:24 AM, Pratap Kumar wrote: 1.) monit log
On Thu, Nov 3, 2011 at 11:35 PM, Martin Pala <address@hidden> wrote:
Pratap,
please can you provide the follwing informations?:
1.) monit log
[IST Nov 4 12:50:28] info : Reinitializing monit daemon
[IST Nov 4 12:50:28] info : Awakened by the SIGHUP signal [IST Nov 4 12:50:28] info : Reinitializing monit - Control file '/etc/monitrc'
[IST Nov 4 12:50:28] info : Shutting down monit HTTP server [IST Nov 4 12:50:29] info : monit HTTP server stopped
[IST Nov 4 12:50:29] info : Starting monit HTTP server at [localhost:2812] [IST Nov 4 12:50:29] info : monit HTTP server started
[IST Nov 4 12:50:29] info : 'system_sm1' Monit reloaded
2.) output of:
ls -l /pratap/Service_mount.py
address@hidden /]# ls -l /pratap/Likewise_mount.py -rwxrwxrwx 1 root root 1544 Nov 4 12:36 /pratap/Likewise_mount.py
address@hidden pratap]# python Likewise_mount.py 1
3.) output of:
/pratap/Service_mount.py
echo $?
address@hidden pratap]# echo $? 1
Regards,
Martin
On Nov 3, 2011, at 3:01 PM, Pratap Kumar wrote:
> Hi,
>
> Monit is not able to check the status of Pyhton script
>
> check program Service_mount with path "/pratap/Service_mount.py"
> if status != 0 then
> EXEC "/pratap/script-monit stop"
> else if succeeded then
> EXEC "/pratap/script-monit start"
>
>
> My script is returning a value 1.
>
>
> Please help me out.Thanks in advance for your precious support.
>
>
>
> Thanks
> Pratap
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general --
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
|