Christoph Schug пре 23 година
родитељ
комит
ab7ad41dfa
4 измењених фајлова са 150 додато и 0 уклоњено
  1. 16 0
      monit/fsl.monit
  2. 73 0
      monit/monit.patch
  3. 29 0
      monit/monitrc
  4. 32 0
      monit/rc.monit

+ 16 - 0
monit/fsl.monit

@@ -0,0 +1,16 @@
+##
+##  fsl.monit -- OSSP fsl configuration for Monit
+##
+
+ident (monit/.+)/.+ q{
+    prefix(
+        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
+    ) 
+    -> {
+        debug: file(
+            path="@l_prefix@/var/monit/log/monit.log",
+            append=1, perm=0600
+        )
+    }
+};
+

+ 73 - 0
monit/monit.patch

@@ -0,0 +1,73 @@
+--- configure.orig	2003-02-18 15:26:03.000000000 +0100
++++ configure	2003-05-07 10:17:37.000000000 +0200
+@@ -5263,16 +5263,7 @@
+ done
+ 
+ 
+-# Find the right directory to put the root-mode PID file in
+-echo "$as_me:$LINENO: checking pid file location" >&5
+-echo $ECHO_N "checking pid file location... $ECHO_C" >&6
+-if test -d "/var/run"
+-then
+-	piddir="/var/run"
+-elif test -d "/etc"
+-then
+-	piddir="/etc"
+-fi
++piddir="@l_prefix@/var/monit"
+ 
+ 
+ cat >>confdefs.h <<_ACEOF
+--- files.c.orig	2003-02-17 12:42:27.000000000 +0100
++++ files.c	2003-05-07 10:23:58.000000000 +0200
+@@ -143,7 +143,8 @@
+ 
+ /**
+  * Search the system for the monit control file. Try first
+- * ~/.monitrc, if that fails try ./monitrc and finally /etc/monitrc.
++ * ~/.monitrc, if that fails try ./monitrc and finally
++ * @l_prefix@/etc/monit/monitrc.
+  * Exit the application if the control file is not found.
+  * @return The location of monits control file (monitrc)
+  */
+@@ -169,12 +170,12 @@
+   }
+   
+   memset(rcfile, 0, STRLEN);
+-  snprintf(rcfile, STRLEN, "/etc/%s", MONITRC);
++  snprintf(rcfile, STRLEN, "@l_prefix@/etc/monit/%s", MONITRC);
+   
+   if(exist_file(rcfile)) 
+     return (rcfile);
+   
+-  log("%s: Cannot find the control file at ~/.%s, ./%s or at /etc/%s\n",
++  log("%s: Cannot find the control file at ~/.%s, ./%s or at @l_prefix@/etc/monit/%s\n",
+       prog, MONITRC, MONITRC, MONITRC);
+   
+   exit(1);
+--- monit.1.orig	2003-02-18 15:26:01.000000000 +0100
++++ monit.1	2003-05-07 10:52:41.000000000 +0200
+@@ -1803,7 +1803,7 @@
+    contains a \fImonitrc\fR file, this file is used 
+    instead.
+ .PP
+-\&\fI/etc/monitrc\fR
++\&\fI@l_prefix@/etc/monit/monitrc\fR
+    If the control file is not found in either of the
+    previous two locations, and /etc contains a
+    \fImonitrc\fR file, this file will be used instead.
+@@ -1812,13 +1812,9 @@
+    Lock file to help prevent concurrent runs (non-root
+    mode).
+ .PP
+-\&\fI/var/run/monit.pid\fR
++\&\fI@l_prefix@/var/monit/monit.pid\fR
+    Lock file to help prevent concurrent runs (root mode,
+    Linux systems).
+-.PP
+-\&\fI/etc/monit.pid\fR
+-   Lock file to help prevent concurrent runs (root mode,
+-   systems without /var/run).
+ .SH "SIGNALS"
+ .IX Header "SIGNALS"
+ If a monit daemon is running, \s-1SIGUSR1\s0 wakes it up from its sleep

+ 29 - 0
monit/monitrc

@@ -0,0 +1,29 @@
+##
+##  @l_prefix@/etc/monit/monitrc - monit control file
+##
+
+#   run as daemon with polling intervals of n seconds
+set daemon  120
+
+#   startup web interface
+set httpd
+    port 99
+    address 127.0.0.1
+    allow   127.0.0.1
+ssl disable
+
+#   send alerts via following mail server
+set mailserver 127.0.0.1
+set mail-format { from: monit@localhost }
+
+#   log via syslog (fsl) by default
+set logfile syslog
+
+#   example for MySQL 4, see also http://www.tildeslash.com/monit/examples.html
+#check mysql4 with pidfile @l_prefix@/var/mysql4/mysqld.pid
+#   start program = "@l_prefix@/etc/rc.d/rc.mysql4 start"
+#   stop  program = "@l_prefix@/etc/rc.d/rc.mysql4 stop"
+#   host 127.0.0.1 port 3306
+#   timeout(5, 5)
+#   alert root@localhost
+

+ 32 - 0
monit/rc.monit

@@ -0,0 +1,32 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.monit -- Run-Commands for Monit
+##
+
+%config
+    monit_enable="yes"
+
+%start -p 200 -u @l_susr@
+    opServiceEnabled monit || exit 0
+    @l_prefix@/bin/monit
+
+%stop -p 200 -u @l_susr@
+    opServiceEnabled monit || exit 0
+    if [ -f @l_prefix@/var/monit/monit.pid ]; then
+        kill -TERM `cat @l_prefix@/var/monit/monit.pid`
+        rm -f @l_prefix@/var/monit/monit.pid
+    fi
+
+%restart -u @l_susr@
+    opServiceEnabled monit || exit 0
+    if [ -f @l_prefix@/var/monit/monit.pid ]; then
+        kill -TERM `cat @l_prefix@/var/monit/monit.pid`
+        rm -f @l_prefix@/var/monit/monit.pid
+    fi
+    @l_prefix@/bin/monit -d ${monit_interval}
+
+%reload -u @l_susr@
+    opServiceEnabled monit || exit 0
+    if [ -f @l_prefix@/var/monit/monit.pid ]; then
+        kill -HUP `cat @l_prefix@/var/monit/monit.pid`
+    fi