Hi,

first of all I want to say thank you for the great work.

Like some other from the list I need monit to be able to execute a script on a 
timeout.

e.g.
check process something with pidfile /var/run/something.pid
   start program = "/etc/init.d/something start"
   stop program  = "/etc/init.d/something stop"
   if X restarts within Y cycles then exec "some_script.sh"

So I wrote a patch which will apply to current CVS (Feb 08 2007).

Since I am not really into the monit sources I would like you to check this 
please.

It works fine for me with:
uname -a
Linux 2.6.13-15.13-default #1 Tue Nov 28 13:43:50 UTC 2006 x86_64 x86_64 
x86_64 GNU/Linux

if someone can confirm this patch I would be happy to see it in your 
“Contributed” section.

greetings Alec
--- event.c	2007-02-09 11:06:48.000000000 +0100
+++ ../event.c	2007-02-09 11:07:32.000000000 +0100
@@ -816,6 +816,11 @@
       return;
     }
 
+    if((A->id == EVENT_TIMEOUT)) {
+                control_service(s->name, ACTION_UNMONITOR);
+                return;
+    }
+
     control_service(s->name, A->id);
   }
 }
--- p.y	2007-02-09 11:06:49.000000000 +0100
+++ ../p.y	2007-02-09 10:27:38.000000000 +0100
@@ -1022,11 +1022,12 @@
                   }
                 ;
 
-timeout         : IF NUMBER RESTART NUMBER CYCLE THEN TIMEOUT {
+timeout         : IF NUMBER RESTART NUMBER CYCLE THEN action1 recovery {
                    check_timeout($2, $4);
                    current->def_timeout= TRUE;
                    current->to_start= $2;
                    current->to_cycle= $4;
+		   addeventaction(&(current)->action_TIMEOUT, $<number>7,$<number>8);
                  }
                 ;
 
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to