Hi
Wait a while before you start monitoring to solve problems when used in
the init or when there are demons that run after Monit
diff -ruN monit-4.10.1.old/http/cervlet.c monit-4.10.1.old.deadtime/http/cervlet.c
--- monit-4.10.1.old/http/cervlet.c 2007-10-05 17:02:11.000000000 +0200
+++ monit-4.10.1.old.deadtime/http/cervlet.c 2008-08-24 21:11:16.000000000 +0200
@@ -408,6 +408,9 @@
"<tr><td>Poll time</td><td>%d seconds</td></tr>",
Run.polltime);
out_print(res,
+ "<tr><td>Init time</td><td>%d seconds</td></tr>",
+ Run.inittime);
+ out_print(res,
"<tr><td>httpd bind address</td><td>%s</td></tr>",
Run.bind_addr?Run.bind_addr:"Any/All");
out_print(res,
diff -ruN monit-4.10.1.old/l.l monit-4.10.1.old.deadtime/l.l
--- monit-4.10.1.old/l.l 2007-10-05 17:02:10.000000000 +0200
+++ monit-4.10.1.old.deadtime/l.l 2008-08-24 20:55:44.000000000 +0200
@@ -148,6 +148,7 @@
disable { return DISABLE; }
set { return SET; }
daemon { return DAEMON; }
+inittime { return INITTIME; }
logfile { return LOGFILE; }
syslog { return SYSLOG; }
facility { return FACILITY; }
diff -ruN monit-4.10.1.old/monitor.c monit-4.10.1.old.deadtime/monitor.c
--- monit-4.10.1.old/monitor.c 2007-07-29 22:23:26.000000000 +0200
+++ monit-4.10.1.old.deadtime/monitor.c 2008-08-24 20:43:28.000000000 +0200
@@ -485,6 +485,8 @@
Event_post(Run.system, EVENT_INSTANCE, STATE_FAILED,
Run.system->action_MONIT_START, "Monit started");
+ sleep(Run.inittime);
+
while(TRUE) {
validate();
diff -ruN monit-4.10.1.old/monitor.h monit-4.10.1.old.deadtime/monitor.h
--- monit-4.10.1.old/monitor.h 2007-10-16 21:10:43.000000000 +0200
+++ monit-4.10.1.old.deadtime/monitor.h 2008-08-24 21:02:50.000000000 +0200
@@ -737,6 +737,7 @@
int dolog; /**< TRUE if program should log actions, otherwise FALSE */
int isdaemon; /**< TRUE if program should run as a daemon */
int polltime; /**< In deamon mode, the sleeptime (sec) between run */
+ int inittime; /**< the sleeptime (sec) after startup */
int dohttpd; /**< TRUE if monit HTTP server should run */
int httpdssl; /**< TRUE if monit HTTP server uses ssl */
char *httpsslpem; /**< PEM file for the HTTPS server */
diff -ruN monit-4.10.1.old/p.y monit-4.10.1.old.deadtime/p.y
--- monit-4.10.1.old/p.y 2007-10-24 22:23:08.000000000 +0200
+++ monit-4.10.1.old.deadtime/p.y 2008-08-24 20:58:33.000000000 +0200
@@ -246,7 +246,7 @@
}
%token IF ELSE THEN OR FAILED
-%token SET LOGFILE FACILITY DAEMON SYSLOG MAILSERVER HTTPD ALLOW ADDRESS INIT
+%token SET LOGFILE FACILITY DAEMON INITTIME SYSLOG MAILSERVER HTTPD ALLOW ADDRESS INIT
%token READONLY CLEARTEXT MD5HASH SHA1HASH CRYPT
%token PEMFILE ENABLE DISABLE HTTPDSSL CLIENTPEMFILE ALLOWSELFCERTIFICATION
%token STATEFILE SEND EXPECT CYCLE COUNT REMINDER
@@ -290,6 +290,7 @@
statement : setalert
| setdaemon
+ | setinittime
| setlog
| seteventqueue
| setcollectors
@@ -452,6 +453,11 @@
}
;
+setinittime : SET INITTIME NUMBER {
+ Run.inittime= $3;
+ }
+ ;
+
setinit : SET INIT {
Run.init= TRUE;
}
diff -ruN monit-4.10.1.old/util.c monit-4.10.1.old.deadtime/util.c
--- monit-4.10.1.old/util.c 2007-10-16 21:10:44.000000000 +0200
+++ monit-4.10.1.old.deadtime/util.c 2008-08-24 20:48:36.000000000 +0200
@@ -583,6 +583,7 @@
printf(" %-18s = %s\n", "Is Daemon", Run.isdaemon?"True":"False");
printf(" %-18s = %s\n", "Use process engine", Run.doprocess?"True":"False");
printf(" %-18s = %d seconds\n", "Poll time", Run.polltime);
+ printf(" %-18s = %d seconds\n", "Init time", Run.inittime);
if(Run.eventlist_dir) {
char slots[STRLEN];
diff -ruN monit-4.10.1.old/xml.c monit-4.10.1.old.deadtime/xml.c
--- monit-4.10.1.old/xml.c 2007-07-29 22:23:26.000000000 +0200
+++ monit-4.10.1.old.deadtime/xml.c 2008-08-24 20:48:16.000000000 +0200
@@ -132,10 +132,11 @@
"\t\t<version>%s</version>\r\n"
"\t\t<uptime>%ld</uptime>\r\n"
"\t\t<poll>%d</poll>\r\n",
+ "\t\t<inittime>%d</inittime>\r\n",
Run.incarnation,
VERSION,
(long)Util_getProcessUptime(Run.pidfile),
- Run.polltime);
+ Run.polltime,Run.inittime);
if(Run.dohttpd)
{
_______________________________________________
monit-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/monit-dev