/[monit]/monit/web/monit.html
ViewVC logotype

Diff of /monit/web/monit.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by martinp, Fri Feb 14 08:22:33 2003 UTC revision 1.16 by hauk, Mon Feb 17 14:18:02 2003 UTC
# Line 1  Line 1 
1  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  <HTML>
2  <html xmlns="http://www.w3.org/1999/xhtml">  <HEAD>
3  <head>  <TITLE>monit - system for monitoring programs</TITLE>
4  <title>monit - system for monitoring programs</title>  <LINK REV="made" HREF="mailto:bhcompile@daffy.perf.redhat.com">
5  <link rev="made" href="mailto:root@localhost" />  </HEAD>
 </head>  
6    
7  <body style="background-color: white">  <BODY BGCOLOR="#FFFFFF">
8    
9  <p><a name="__index__"></a></p>  <A NAME="__index__"></A>
10  <!-- INDEX BEGIN -->  <!-- INDEX BEGIN -->
11    
12  <ul>  <UL>
13    
14          <li><a href="#name">NAME</a></li>          <LI><A HREF="#name">NAME</A></LI>
15          <li><a href="#synopsis">SYNOPSIS</a></li>          <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
16          <li><a href="#description">DESCRIPTION</a></li>          <LI><A HREF="#description">DESCRIPTION</A></LI>
17          <li><a href="#general_operation">GENERAL OPERATION</a></li>          <LI><A HREF="#general operation">GENERAL OPERATION</A></LI>
18          <ul>          <UL>
19    
20                  <li><a href="#general_options_and_arguments">General Options and Arguments</a></li>                  <LI><A HREF="#general options and arguments">General Options and Arguments</A></LI>
21          </ul>          </UL>
22    
23          <li><a href="#logging">LOGGING</a></li>          <LI><A HREF="#logging">LOGGING</A></LI>
24          <li><a href="#daemon_mode">DAEMON MODE</a></li>          <LI><A HREF="#daemon mode">DAEMON MODE</A></LI>
25          <ul>          <LI><A HREF="#init support">INIT SUPPORT</A></LI>
26            <LI><A HREF="#group support">GROUP SUPPORT</A></LI>
27                  <li><a href="#monit_lock_file">monit lock file</a></li>          <LI><A HREF="#monitoring mode">MONITORING MODE</A></LI>
28          </ul>          <LI><A HREF="#alert messages">ALERT MESSAGES</A></LI>
29            <UL>
30          <li><a href="#init_support">INIT SUPPORT</a></li>  
31          <li><a href="#group_support">GROUP SUPPORT</a></li>                  <LI><A HREF="#setting a global mail format">Setting a global mail format</A></LI>
32          <li><a href="#monitoring_mode_selection">MONITORING MODE SELECTION</a></li>          </UL>
33          <ul>  
34            <LI><A HREF="#program timeout">PROGRAM TIMEOUT</A></LI>
35                  <li><a href="#monit_with_heartbeat">Monit with Heartbeat</a></li>          <LI><A HREF="#resource testing">RESOURCE TESTING</A></LI>
36          </ul>          <LI><A HREF="#timestamp testing">TIMESTAMP TESTING</A></LI>
37            <LI><A HREF="#connection testing">CONNECTION TESTING</A></LI>
38          <li><a href="#alert_messages">ALERT MESSAGES</a></li>          <LI><A HREF="#monit httpd">MONIT HTTPD</A></LI>
39          <ul>          <UL>
40    
41                  <li><a href="#setting_a_global_mail_format">Setting a global mail format</a></li>                  <LI><A HREF="#monit httpd authentication">Monit HTTPD Authentication</A></LI>
42          </ul>          </UL>
43    
44          <li><a href="#program_timeout">PROGRAM TIMEOUT</a></li>          <LI><A HREF="#md5 checksum">MD5 CHECKSUM</A></LI>
45          <li><a href="#resource_testing">RESOURCE TESTING</a></li>          <LI><A HREF="#dependency checking">DEPENDENCY CHECKING</A></LI>
46          <li><a href="#timestamp_testing">TIMESTAMP TESTING</a></li>          <LI><A HREF="#the run control file">THE RUN CONTROL FILE</A></LI>
47          <li><a href="#connection_testing">CONNECTION TESTING</a></li>          <UL>
48          <li><a href="#monit_httpd">MONIT HTTPD</a></li>  
49          <ul>                  <LI><A HREF="#run control syntax">Run Control Syntax</A></LI>
50                    <LI><A HREF="#configuration examples">CONFIGURATION EXAMPLES</A></LI>
51                  <li><a href="#monit_httpd_authentication">Monit HTTPD Authentication</a></li>                  <LI><A HREF="#monit with heartbeat">Monit with Heartbeat</A></LI>
52          </ul>          </UL>
53    
54          <li><a href="#md5_checksum">MD5 CHECKSUM</a></li>          <LI><A HREF="#files">FILES</A></LI>
55          <li><a href="#dependency_checking">DEPENDENCY CHECKING</a></li>          <LI><A HREF="#signals">SIGNALS</A></LI>
56          <li><a href="#the_run_control_file">THE RUN CONTROL FILE</a></li>          <LI><A HREF="#notes">NOTES</A></LI>
57          <ul>          <LI><A HREF="#authors">AUTHORS</A></LI>
58            <LI><A HREF="#copyright">COPYRIGHT</A></LI>
59                  <li><a href="#run_control_syntax">Run Control Syntax</a></li>          <LI><A HREF="#see also">SEE ALSO</A></LI>
60                  <li><a href="#configuration_examples">CONFIGURATION EXAMPLES</a></li>  </UL>
         </ul>  
   
         <li><a href="#files">FILES</a></li>  
         <li><a href="#signals">SIGNALS</a></li>  
         <li><a href="#notes">NOTES</a></li>  
         <li><a href="#authors">AUTHORS</a></li>  
         <li><a href="#copyright">COPYRIGHT</a></li>  
         <li><a href="#see_also">SEE ALSO</a></li>  
 </ul>  
61  <!-- INDEX END -->  <!-- INDEX END -->
62    
63  <hr />  <HR>
64  <p>  <P>
65  </p>  <H1><A NAME="name">NAME</A></H1>
66  <h1><a name="name">NAME</a></h1>  <P>monit - system for monitoring programs</P>
67  <p>monit - system for monitoring programs</p>  <P>
68  <p>  <HR>
69  </p>  <H1><A NAME="synopsis">SYNOPSIS</A></H1>
70  <hr />  <P><STRONG>monit</STRONG> [options] {arguments}</P>
71  <h1><a name="synopsis">SYNOPSIS</a></h1>  <P>
72  <p><strong>monit</strong> [options] {arguments}</p>  <HR>
73  <p>  <H1><A NAME="description">DESCRIPTION</A></H1>
74  </p>  <P><STRONG>monit</STRONG> is a utility for monitoring and managing daemons or
 <hr />  
 <h1><a name="description">DESCRIPTION</a></h1>  
 <p><strong>monit</strong> is a utility for monitoring and managing daemons or  
75  similar programs running on a Unix system; monit will start  similar programs running on a Unix system; monit will start
76  specified programs if they are not running and restart programs  specified programs if they are not running and restart programs
77  not responding.</p>  not responding.</P>
78  <p>The monit utility can run in a daemon mode to repeatedly poll one  <P>The monit utility can run in a daemon mode to repeatedly poll one
79  or more programs at a specified interval.</p>  or more programs at a specified interval.</P>
80  <p>  <P>
81  </p>  <HR>
82  <hr />  <H1><A NAME="general operation">GENERAL OPERATION</A></H1>
83  <h1><a name="general_operation">GENERAL OPERATION</a></h1>  <P>The behavior of monit is controlled by command-line options
84  <p>The behavior of monit is controlled by command-line options  <EM>and</EM> a run control file, <EM>~/.monitrc</EM>, the syntax of which we
 <em>and</em> a run control file, <em>~/.monitrc</em>, the syntax of which we  
85  describe in a later section. Command-line options override  describe in a later section. Command-line options override
86  <em>.monitrc</em> declarations.</p>  <EM>.monitrc</EM> declarations.</P>
87  <p>The following options are recognized by monit. It's recommended  <P>The following options are recognized by monit. It's recommended
88  that you set the log and daemon options in the control  that you set the log and daemon options in the control
89  <em>.monitrc</em> file.</p>  <EM>.monitrc</EM> file.</P>
90  <p>  <P>
91  </p>  <H2><A NAME="general options and arguments">General Options and Arguments</A></H2>
92  <h2><a name="general_options_and_arguments">General Options and Arguments</a></h2>  <P><STRONG>-c</STRONG> <EM>file</EM>
93  <p><strong>-c</strong> <em>file</em>     Use this control file</P>
94     Use this control file</p>  <P><STRONG>-d</STRONG> <EM>n</EM>
95  <p><strong>-d</strong> <em>n</em>     Run as a daemon once per <EM>n</EM> seconds</P>
96     Run as a daemon once per <em>n</em> seconds</p>  <P><STRONG>-g</STRONG>
97  <p><strong>-g</strong>     Set group name for start, stop, restart and status</P>
98     Set group name for start, stop, restart and status</p>  <P><STRONG>-l</STRONG> <EM>logfile</EM>
99  <p><strong>-l</strong> <em>logfile</em>     Print log information to this file</P>
100     Print log information to this file</p>  <P><STRONG>-p</STRONG> <EM>pidfile</EM>
101  <p><strong>-p</strong> <em>pidfile</em>     Use this lock file in daemon mode</P>
102     Use this lock file in daemon mode</p>  <P><STRONG>-i</STRONG>
103  <p><strong>-i</strong>     Validate mode, startup in validate mode</P>
104     Validate mode, startup in validate mode</p>  <P><STRONG>-I</STRONG>
105  <p><strong>-I</strong>     Run from init (do not run in background)</P>
106     Run from init (do not run in background)</p>  <P><STRONG>-t</STRONG>
107  <p><strong>-t</strong>     Configuration syntax testing mode</P>
108     Configuration syntax testing mode</p>  <P><STRONG>-v</STRONG>
109  <p><strong>-v</strong>     Verbose mode, work noisy (diagnostic output)</P>
110     Verbose mode, work noisy (diagnostic output)</p>  <P><STRONG>-V</STRONG>
111  <p><strong>-V</strong>     Print version number and patchlevel</P>
112     Print version number and patchlevel</p>  <P><STRONG>-h</STRONG>
113  <p><strong>-h</strong>     Print a help text</P>
114     Print a help text</p>  <P>In addition to the options above, monit can be started with one
 <p>In addition to the options above, monit can be started with one  
115  of the following action arguments; monit will then execute the  of the following action arguments; monit will then execute the
116  action and exit without transforming itself to a deamon.</p>  action and exit without transforming itself to a deamon.</P>
117  <p><strong>start</strong>  <P><STRONG>start</STRONG>
118      Start all programs listed in the control file. If      Start all programs listed in the control file. If
119      the group option is set, only start the programs in      the group option is set, only start the programs in
120      the named group.</p>      the named group.</P>
121  <p><strong>start name</strong>  <P><STRONG>start name</STRONG>
122      Start the named program. The name must exist in the      Start the named program. The name must exist in the
123      monitrc file, after a <em>check</em> keyword. See also      monitrc file, after a <EM>check</EM> keyword. See also
124      the MONIT HTTPD section below.</p>      the MONIT HTTPD section below.</P>
125  <p><strong>stop</strong>      <P><STRONG>stop</STRONG>    
126      Stop all programs listed in the control file. If      Stop all programs listed in the control file. If
127      the group option is set, only stop the programs in      the group option is set, only stop the programs in
128      the named group.</p>      the named group.</P>
129  <p><strong>stop name</strong>  <P><STRONG>stop name</STRONG>
130      Stop the named program. The name must exist in the      Stop the named program. The name must exist in the
131      monitrc file, after a <em>check</em> keyword. See also      monitrc file, after a <EM>check</EM> keyword. See also
132      the MONIT HTTPD section below.</p>      the MONIT HTTPD section below.</P>
133  <p><strong>reload</strong>  <P><STRONG>reload</STRONG>
134      Will reinitialize running monit daemon, specifically      Reinitialize a running monit daemon, the daemon will
135      it will reread its configuration, close and reopen      reread its configuration, close and reopen log files.</P>
136      log files.</p>  <P><STRONG>restart</STRONG>
137  <p><strong>restart</strong>      Stop and start <EM>all</EM> programs. If the group option is
138      Stop and start all programs. If the group option is      set, only restart the programs in the named group.</P>
139      set, only restart the programs in the named group.</p>  <P><STRONG>restart name</STRONG>
 <p><strong>restart name</strong>  
140      Restart the named program. The name must exist in      Restart the named program. The name must exist in
141      the monitrc file, after a <em>check</em> keyword. also      the monitrc file, after a <EM>check</EM> keyword. also
142      the MONIT HTTPD section below.</p>      the MONIT HTTPD section below.</P>
143  <p><strong>status</strong>  <P><STRONG>status</STRONG>
144      Print status information for each program. If the      Print status information for each program. If the
145      group option is set, only print the status for the      group option is set, only print the status for the
146      named group.</p>      named group.</P>
147  <p><strong>quit</strong>  <P><STRONG>quit</STRONG>
148      Kill monit daemon process</p>      Kill monit daemon process</P>
149  <p><strong>validate</strong>  <P><STRONG>validate</STRONG>
150      Check all programs and start the ones not running.      Check all programs and start the ones not running.
151      Also if a program indicates (in the control file)      Also if a program indicates (in the control file)
152      that it's listening on a port number, although      that it's listening on a port number, although
153      monit cannot connect to the port, then restart the      monit cannot connect to the port, then restart the
154      program. This action is also the default      program. This action is also the default
155      behavior when monit runs in daemon mode.</p>      behavior when monit runs in daemon mode.</P>
156  <p>  <P>
157  </p>  <HR>
158  <hr />  <H1><A NAME="logging">LOGGING</A></H1>
159  <h1><a name="logging">LOGGING</a></h1>  <P>monit will log status and error messages to a log file. If
160  <p>monit will log status and error messages to a log file. If  <STRONG>syslog</STRONG> is given as a value for the <EM>-l</EM> option (or the
161  <strong>syslog</strong> is given as a value for the <em>-l</em> option (or the  keyword <EM>set logfile syslog</EM> is found in the control file) monit
162  keyword <em>set logfile syslog</em> is found in the control file) monit  will use the <STRONG>syslog</STRONG> system daemon for logging messages. To
 will use the <strong>syslog</strong> system daemon for logging messages. To  
163  turn off logging, simply do not set the logfile in the control  turn off logging, simply do not set the logfile in the control
164  file (and of course, do not use the -l switch)</p>  file (and of course, do not use the -l switch)</P>
165  <p>  <P>
166  </p>  <HR>
167  <hr />  <H1><A NAME="daemon mode">DAEMON MODE</A></H1>
168  <h1><a name="daemon_mode">DAEMON MODE</a></h1>  <P>The <EM>-d interval</EM> option runs monit in daemon mode. You must
 <p>The <em>-d interval</em> option runs monit in daemon mode. You must  
169  specify a numeric argument which is a polling interval in  specify a numeric argument which is a polling interval in
170  seconds.</p>  seconds.</P>
171  <p>In daemon mode, monit puts itself in the background and runs  <P>In daemon mode, monit puts itself in the background and runs
172  continously, monitoring each specified program and then sleeping  continously, monitoring each specified program and then sleeping
173  for the given polling interval.</p>  for the given polling interval.</P>
174  <pre>  <PRE>
175         Simply invoking</pre>         Simply invoking</PRE>
176  <pre>  <PRE>
177                monit -d 300</pre>                monit -d 300</PRE>
178  <p>will poll all programs described in your <em>~/.monitrc</em> file every  <P>will poll all programs described in your <EM>~/.monitrc</EM> file every
179  5 minutes.</p>  5 minutes.</P>
180  <p>It is possible to set a polling interval in your ~/.monitrc file  <P>It is possible to set a polling interval in your ~/.monitrc file
181  by saying 'set daemon <strong>n</strong>', where <strong>n</strong> is an integer number of  by saying 'set daemon <STRONG>n</STRONG>', where <STRONG>n</STRONG> is an integer number of
182  seconds.  If you do this, monit will always start in daemon mode  seconds.  If you do this, monit will always start in daemon mode
183  (as long as no action arguments are given).</p>  (as long as no action arguments are given).</P>
184  <p>Only one daemon process is permitted per user; in daemon mode,  <P>Only one daemon process is permitted per user; in daemon mode,
185  monit makes a per-user lockfile to guarantee this.</p>  monit makes a per-user lockfile to guarantee this.</P>
186  <p>Calling monit with a daemon in the background sends a wakeup  <P>Calling monit with a daemon in the background sends a wakeup
187  signal to the daemon, forcing it to check programs immediately.</p>  signal to the daemon, forcing it to check programs immediately.</P>
188  <p>The <em>quit</em> argument will kill a running daemon process instead  <P>The <EM>quit</EM> argument will kill a running daemon process instead
189  of waking it up.</p>  of waking it up.</P>
190  <p>  <P>
191  </p>  <HR>
192  <h2><a name="monit_lock_file">monit lock file</a></h2>  <H1><A NAME="init support">INIT SUPPORT</A></H1>
193  <p>monit utilize a lock file to prevent concurrent runs in daemon  <P>Monit can be run and controlled from <EM>init</EM>. In case monit
194  mode. That is, only one monit daemon is permitted per user. The  crashes init will respawn a new monit process.</P>
195  lock file contains the process id (pid) from the current running  <P>You can use either the 'set init' statement in monit's
 monit daemon. If monit is run by the root user the location of  
 the lock file is either <em>/var/run/monit.pid</em> or  
 <em>/etc/monit.pid</em> depending on the operating system. For a  
 non-root user the location of the lock file is  
 <em>$HOME/.monit.pid</em>. The lock file is removed when a monit daemon  
 is stopped.</p>  
 <p>Normally it's not necessary to consider the location of the lock  
 file but in certain very special situations, you may need to  
 control the location. For instance if you run monit as root on  
 two different machines but with the same file system you will  
 need to change the location of the monit lock file via the <em>-p</em>  
 option.  You can also set the location of the lock file on a more  
 permanent basis via this global set-statement in a monitrc  
 control file: (keywords are in capital)</p>  
 <pre>  
    SET PIDFILE {pidfile}</pre>  
 <p>For instance, <em>set pidfile /run/monit.pid</em>.</p>  
 <p>  
 </p>  
 <hr />  
 <h1><a name="init_support">INIT SUPPORT</a></h1>  
 <p>Monit can be run and controlled from <em>init</em>. In case monit  
 crashes init will respawn a new monit process.</p>  
 <p>You can use either the 'set init' statement in monit's  
196  configuration file or use the -I option from the command line.  configuration file or use the -I option from the command line.
197  Here's a sample /etc/inittab entry for monit:</p>  Here's a sample /etc/inittab entry for monit:</P>
198  <pre>  <PRE>
199    # Run monit in standard runlevels    # Run monit in standard runlevels
200    mo:2345:respawn:/usr/local/sbin/monit -Ic /etc/monitrc</pre>    mo:2345:respawn:/usr/local/sbin/monit -Ic /etc/monitrc</PRE>
201  <p>After you have modified init's configuration file, you can run  <P>After you have modified init's configuration file, you can run
202  the following command to re-examine /etc/inittab and start monit:</p>  the following command to re-examine /etc/inittab and start monit:</P>
203  <pre>  <PRE>
204    telinit q    telinit q
205      </PRE>
206  For systems without telinit:</pre>  <PRE>
207  <pre>  
208    kill -1 1</pre>  For systems without telinit:</PRE>
209  <p>Make sure that if you run monit from init, that you do not start  <PRE>
210  monit in your startup scripts as well.</p>    kill -1 1</PRE>
211  <p>  <P>Make sure that if you run monit from init, that you do not start
212  </p>  monit in your startup scripts as well.</P>
213  <hr />  <P>
214  <h1><a name="group_support">GROUP SUPPORT</a></h1>  <HR>
215  <p>Program entries in the control file, <em>monitrc</em>, can be grouped  <H1><A NAME="group support">GROUP SUPPORT</A></H1>
216  together by the <em>group</em> statement. The syntax is simply (keyword  <P>Program entries in the control file, <EM>monitrc</EM>, can be grouped
217  in capital):</p>  together by the <EM>group</EM> statement. The syntax is simply (keyword
218  <pre>  in capital):</P>
219    GROUP groupname</pre>  <PRE>
220  <p>With this statement it is possible to group similar program    GROUP groupname</PRE>
221    <P>With this statement it is possible to group similar program
222  entries together and manage them as a whole. Monit provides  entries together and manage them as a whole. Monit provides
223  functions to start, stop and restart a group of programs, like  functions to start, stop and restart a group of programs, like
224  so:</p>  so:</P>
225  <p>To start a group of programs:</p>  <P>To start a group of programs:</P>
226  <pre>  <PRE>
227    monit -g &lt;groupname&gt; start</pre>    monit -g &lt;groupname&gt; start</PRE>
228  <p>To stop a group of programs:</p>  <P>To stop a group of programs:</P>
229  <pre>  <PRE>
230    monit -g &lt;groupname&gt; stop</pre>    monit -g &lt;groupname&gt; stop</PRE>
231  <p>To restart a group of programs:</p>  <P>To restart a group of programs:</P>
232  <pre>  <PRE>
233    monit -g &lt;groupname&gt; restart</pre>    monit -g &lt;groupname&gt; restart</PRE>
234  <p>Show the status of a program group:</p>  <P>Show the status of a program group:</P>
235  <pre>  <PRE>
236    monit -g &lt;groupname&gt; status</pre>    monit -g &lt;groupname&gt; status</PRE>
237  <p>  <P>
238  </p>  <HR>
239  <hr />  <H1><A NAME="monitoring mode">MONITORING MODE</A></H1>
240  <h1><a name="monitoring_mode_selection">MONITORING MODE SELECTION</a></h1>  <P>Monit supports three monitoring modes per service: active,
 <p>Monit supports three monitoring modes per service: active,  
241  passive and manual. See also the example section below for usage  passive and manual. See also the example section below for usage
242  of the mode statement.</p>  of the mode statement.</P>
243  <p>In <em>active</em> mode, monit will monitor a service and in case of  <P>In <EM>active</EM> mode, monit will monitor a service and in case of
244  problems monit will act and raise alerts, start, stop or restart  problems monit will act and raise alerts, start, stop or restart
245  the service. Active mode is the default mode.</p>  the service. Active mode is the default mode.</P>
246  <p>In <em>passive</em> mode, monit will passively monitor a service and  <P>In <EM>passive</EM> mode, monit will passively monitor a service and
247  specifically <strong>not</strong> try to fix a problem, but it will still raise  specifically <STRONG>not</STRONG> try to fix a problem, but it will still raise
248  alerts in case of a problem.</p>  alerts in case of a problem.</P>
249  <p>For clustered environments there is also a <em>manual</em> mode. In  <P>For use in clustered environments there is also a <EM>manual</EM>
250  this mode, monit will enter <em>active</em> mode only if a service was  mode. In this mode, monit will enter <EM>active</EM> mode <STRONG>only</STRONG> if a
251  started under monit's control, for example by:</p>  service was started under monit's control, for example by:</P>
252  <pre>  <PRE>
253    monit start sybase</pre>    monit start sybase</PRE>
254  <p>or</p>  <P>or</P>
255  <pre>  <PRE>
256    monit -g database start (for service group)</pre>    monit -g database start (for service group)</PRE>
257  <p>If the service wasn't started by monit or was stopped for example  <P>If the service wasn't started by monit or was stopped for example
258  by:</p>  by:</P>
259  <pre>  <PRE>
260    monit stop sybase</pre>    monit stop sybase</PRE>
261  <p>or</p>  <P>or</P>
262  <pre>  <PRE>
263    monit -g database stop (for service group)</pre>    monit -g database stop (for service group)</PRE>
264  <p>monit will not monitor the service at all. This allows for having  <P>monit will not monitor the service at all. This allows for having
265  services configured in monitrc and start it with monit only if it  services configured in monitrc and start it with monit only if it
266  should run. This could be used for building simple failsafe  should run. This can be used to build simple failsafe clusters.
267  clusters. For instance, using the <em>heartbeat</em> system  You can read more about how you can setup a cluster with monit
268  (http://linux-ha.org/) to watch the health of nodes and in the  using the <EM>heartbeat</EM> system in the examples sections below.</P>
269  case of one machine failure start services on a secondary node.  <P>
270  See section bellow for more informations.</p>  <HR>
271  <p>  <H1><A NAME="alert messages">ALERT MESSAGES</A></H1>
272  </p>  <P>monit will raise an email alert if:</P>
273  <h2><a name="monit_with_heartbeat">Monit with Heartbeat</a></h2>  <PRE>
 <p>The first thing you have to do is install and configure  
 <em>heartbeat</em> (http://www.linux-ha.org/downloads) .  
 The Getting Started Guide is very usefull for this task  
 (http://www.linux-ha.org/download/GettingStarted.html).</p>  
 <p><strong>Starting up a Node</strong></p>  
 <p>This is the normal start sequence for a cluster-node.  
 With this sequence, there should be no error-case, which is not  
 handled either by heartbeat or monit. For example, if monit  
 dies, initd restart it. If heatbeat dies, monit restart it. If  
 the node dies, heartbeat on the other node dedect it and restart  
 the services there.</p>  
 <pre>  
  1) initd starts monit with group local  
  2) monit starts heartbeat in local group  
  3) heartbeat requests monit to start the node group  
  4) monit starts the node group</pre>  
 <p><strong>Monit <em>/etc/monitrc</em></strong></p>  
 <p>This sample describe a cluster with 2 nodes.  
 Services running on Node 1 are in group <em>node1</em>, Node 2 services  
 are in <em>node2</em>.</p>  
 <p>The local group entries are mode <em>active</em>, the node group  
 entries are mode <em>manual</em> and controlled by heartbeat</p>  
 <pre>  
  #  
  # local services on every host  
  #  
  #  
  check heartbeat with pidfile /var/run/heartbeat.pid  
        start program = &quot;/etc/init.d/heartbeat start&quot;  
        stop  program = &quot;/etc/init.d/heartbeat start&quot;  
        mode  active  
        alert foo@bar  
        group local  
  #  
  #  
  check postfix with pidfile /var/spool/postfix/pid/master.pid  
        start program = &quot;/etc/init.d/postfix start&quot;  
        stop program  = &quot;/etc/init.d/postfix stop&quot;  
        mode  active  
        alert foo@bar  
        group local  
  #  
  # node1 services  
  #  
  check apache with pidfile /var/apache/logs/httpd.pid  
        start program = &quot;/etc/init.d/apache start&quot;  
        stop program  = &quot;/etc/init.d/apache stop&quot;  
        depends named  
        alert foo@bar  
        mode  manual  
        group node1  
  #  
  #  
  check named with pidfile /var/tmp/named.pid  
        start program = &quot;/etc/init.d/named start&quot;  
        stop program  = &quot;/etc/init.d/named stop&quot;  
        alert foo@bar  
        mode  manual  
        group node1  
  #  
  # node2 services  
  #  
  check named-slave with pidfile /var/tmp/named-slave.pid  
        start program = &quot;/etc/init.d/named-slave start&quot;  
        stop program  = &quot;/etc/init.d/named-slave stop&quot;  
        mode  manual  
        alert foo@bar  
        group node2  
  #  
  #  
  check squid with pidfile /var/squid/logs/squid.pid  
        start program = &quot;/etc/init.d/squid start&quot;  
        stop program  = &quot;/etc/init.d/squid stop&quot;  
        depends named-slave  
        alert foo@bar  
        mode  manual  
        group node2</pre>  
 <p><strong>initd  <em>/etc/inittab</em></strong></p>  
 <p>Monit is started on both nodes with initd. You have to add a  
 entry in <em>/etc/inittab</em>  starting monit with the local group,  
 where heartbeat is member of.</p>  
 <pre>  
  #/etc/inittab  
  mo:2345:respawn:/usr/local/bin/monit -i -d 10 -c /etc/monitrc -g local</pre>  
 <p><strong>heartbeat  <em>/etc/ha.d/haresources</em></strong></p>  
 <p>When heartbeat starts, heartbeat lookup for the node entry and  
 start the script <em>/etc/init.d/monit-node1</em> or  
 <em>/etc/init.d/monit-node2</em>.  The script calls monit  
 to start the node specific group.</p>  
 <pre>  
  # /etc/ha.d/haresources  
  node1 IPaddr::172.16.100.1  monit-node1  
  node2 IPaddr::172.16.100.2  monit-node2</pre>  
 <p><strong><em>/etc/init.d/monit-node1</em></strong></p>  
 <pre>  
  #!/bin/bash  
  #  
  # sample script for starting/stopping all services for node1  
  #  
  prog=&quot;/usr/local/bin/monit -g node1&quot;  
  start()  
  {  
        echo -n $&quot;Starting $prog:&quot;  
        $prog start  
        echo  
  }</pre>  
 <pre>  
  stop()  
  {  
        echo -n $&quot;Stopping $prog:&quot;  
        $prog stop&gt;  
        echo  
  }  
   
  case &quot;$1&quot; in  
        start)  
             start;;  
        stop)  
             stop;;  
        *)  
             echo $&quot;Usage: $0 {start|stop}&quot;  
             RETVAL=1  
  esac  
  exit $RETVAL</pre>  
 <p>  
 </p>  
 <hr />  
 <h1><a name="alert_messages">ALERT MESSAGES</a></h1>  
 <p>monit will raise an email alert if:</p>  
 <pre>  
274   o A program timed out   o A program timed out
275   o A program was restarted   o A program was restarted
276   o A program was stopped   o A program was stopped
# Line 450  to start the node specific group.</p> Line 278  to start the node specific group.</p>
278   o A resource statement match (see also the section RESOURCE   o A resource statement match (see also the section RESOURCE
279     TESTING below)     TESTING below)
280   o A checksum error occurred (see also the section MD5 CHECKSUM   o A checksum error occurred (see also the section MD5 CHECKSUM
281     below)</pre>     below)</PRE>
282  <p>More than one alert statement can be used in a process entry.  <P>More than one alert statement can be used in a process entry.
283  This means that you can send different emails to different  This means that you can send different emails to different
284  addresses. The full syntax for the alert statement is as  addresses. The full syntax for the alert statement is as
285  follows (keywords are in capital):</p>  follows (keywords are in capital):</P>
286  <pre>  <PRE>
287   ALERT mail-address [{events}] [MAIL-FORMAT {mail-format}]</pre>   ALERT mail-address [{events}] [MAIL-FORMAT {mail-format}]</PRE>
288  <p>Simply using:</p>  <P>Simply using:</P>
289  <pre>  <PRE>
290   alert foo@bar</pre>   alert foo@bar</PRE>
291  <p>will send a default email alert to the address foo@bar whenever a  <P>will send a default email alert to the address foo@bar whenever a
292  timeout, restart, checksum, resource, stop or timestamp error  timeout, restart, checksum, resource, stop or timestamp error
293  occurs.</p>  occurs.</P>
294  <p>If you only want an alert message sent when a certain event  <P>If you only want an alert message sent when a certain event
295  occurs for example a timeout or when a program is restarted,  occurs for example a timeout or when a program is restarted,
296  postfix the alert-statement respectively</p>  postfix the alert-statement respectively</P>
297  <pre>  <PRE>
298   alert foo@bar only on { timeout } or   alert foo@bar only on { timeout } or
299   alert foo@bar { timeout }</pre>   alert foo@bar { timeout }</PRE>
300  <p>(<em>only</em> and <em>on</em> are noise keywords, ignored by monit)</p>  <P>(<EM>only</EM> and <EM>on</EM> are noise keywords, ignored by monit)</P>
301  <p>or</p>  <P>or</P>
302  <pre>  <PRE>
303   alert foo@bar { restart }</pre>   alert foo@bar { restart }</PRE>
304  <p>The same applies for a checksum error</p>  <P>The same applies for a checksum error</P>
305  <pre>  <PRE>
306   alert foo@bar { checksum }</pre>   alert foo@bar { checksum }</PRE>
307  <p>It is also possible to combine events and send mail to different  <P>It is also possible to combine events and send mail to different
308  email addresses like:</p>  email addresses like:</P>
309  <pre>  <PRE>
310   alert foo@bar { restart, timeout, resource }   alert foo@bar { restart, timeout, resource }
311   alert security@bar on { checksum, stop }   alert security@bar on { checksum, stop }
312   alert manager@bar</pre>   alert manager@bar</PRE>
313  <p>This will send an alert message to foo@bar when a timeout,  <P>This will send an alert message to foo@bar when a timeout,
314  resource or restart occurs and a message to security@bar if a  resource or restart occurs and a message to security@bar if a
315  checksum error or stop occurs. And finally, a message to  checksum error or stop occurs. And finally, a message to
316  manager@bar whenever any error event occurs.  manager@bar whenever any error event occurs.
317  </p>  </P>
318  <pre>  <PRE>
319    
320  The following alert-statement:</pre>  The following alert-statement:</PRE>
321  <pre>  <PRE>
322    
323   alert foo@bar { timeout   alert foo@bar { timeout
324                   restart                   restart
325                   checksum                   checksum
326                   resource                   resource
327                   stop                   stop
328                   timestamp }</pre>                   timestamp }</PRE>
329  <p>is equivalent to:</p>  <P>is equivalent to:</P>
330  <pre>  <PRE>
331   alert foo@bar</pre>   alert foo@bar</PRE>
332  <p>which as stated above, will send a message when a timeout, a  <P>which as stated above, will send a message when a timeout, a
333  restart, checksum, resource, stop or timestamp error occurs.  (If  restart, checksum, resource, stop or timestamp error occurs.  (If
334  the postfix variant is used, then note that the parenthesis are  the postfix variant is used, then note that the parenthesis are
335  <em>mandatory</em>).</p>  <EM>mandatory</EM>).</P>
336  <p>A restart alert is also sent <em>if monit fails to execute</em> a start  <P>A restart alert is also sent <EM>if monit fails to execute</EM> a start
337  or stop program for an entry. <strong>It is therefor strongly advised</strong>  or stop program for an entry. <STRONG>It is therefor strongly advised</STRONG>
338  that at least one alert statement register interest for restart  that at least one alert statement register interest for restart
339  alerts.</p>  alerts.</P>
340  <p>monit will provide a default mail message layout that is short  <P>monit will provide a default mail message layout that is short
341  and to the point. Here's an example of a standard alert mail sent  and to the point. Here's an example of a standard alert mail sent
342  by monit:</p>  by monit:</P>
343  <pre>  <PRE>
344   From: monit@tildeslash.com   From: monit@tildeslash.com
345   Subject: monit alert -- apache restarted   Subject: monit alert -- apache restarted
346   To: hauk@tildeslash.com   To: hauk@tildeslash.com
347   Date: Tue, 28 May 2002 20:42:30 +0200</pre>   Date: Tue, 28 May 2002 20:42:30 +0200</PRE>
348  <pre>  <PRE>
349   Program apache restarted</pre>   Program apache restarted</PRE>
350  <pre>  <PRE>
351          Date: Tue May 28 20:42:30 2002          Date: Tue May 28 20:42:30 2002
352          Host: www.tildeslash.com</pre>          Host: www.tildeslash.com</PRE>
353  <pre>  <PRE>
354   Your faithful employee,   Your faithful employee,
355   monit</pre>   monit</PRE>
356  <p>If you want to, you can change the format of this message with  <P>If you want to, you can change the format of this message with
357  the optional <em>mail-format</em> statement. The syntax for this  the optional <EM>mail-format</EM> statement. The syntax for this
358  statement is as follows:</p>  statement is as follows:</P>
359  <pre>  <PRE>
360   mail-format {   mail-format {
361        from: monit@localhost        from: monit@localhost
362     subject: apache $EVENT at $DATE     subject: apache $EVENT at $DATE
363     message: Monit restarted $PROGRAM at $DATE on $HOST.     message: Monit restarted $PROGRAM at $DATE on $HOST.
364       Your joke for today is:              Yours sincerely,
365       Things You Do Not Want Your System Administrator to Say:              monit
366          * Ooops.   }</PRE>
367          * Wow!! Look at this ...  <P>Where the keyword <EM>from:</EM> is the email address monit should
         * Hey!! The Suns don't do this.  
         * Terminated??!  
         * What software license?  
         * Well, it's doing something ...  
         * Wow! ... That seemed fast ...  
         * Where's the DIR command?  
         * Why is my &quot;rm&quot; taking so long?  
         * System coming down in 0 min ...  
  }</pre>  
 <p>Where the keyword <em>from:</em> is the email address monit should  
368  pretend it is sending from. It does not have to be a real mail  pretend it is sending from. It does not have to be a real mail
369  address, but must be a proper formated mail address, on the form;  address, but must be a proper formated mail address, on the form;
370  name@domain. The keyword <em>subject:</em> is for the email subject  name@domain. The keyword <EM>subject:</EM> is for the email subject
371  line. The subject must be on only <em>one</em> line. The <em>message:</em>  line. The subject must be on only <EM>one</EM> line. The <EM>message:</EM>
372  keyword denotes the mail body. If used, this keyword should  keyword denotes the mail body. If used, this keyword should
373  always be the last in a mail-format statement.  The mail body can  always be the last in a mail-format statement.  The mail body can
374  be as long as you want and must <strong>not</strong> contain the '}' character.</p>  be as long as you want and must <STRONG>not</STRONG> contain the '}' character.</P>
375  <p>All of these format keywords are optional but you must provide at  <P>All of these format keywords are optional but you must provide at
376  least one. Thus if you only want to change the from address monit  least one. Thus if you only want to change the from address monit
377  is using you can do:</p>  is using you can do:</P>
378  <pre>  <PRE>
379   alert foo@bar with mail-format { from: bofh@xyzzy.no }</pre>   alert foo@bar with mail-format { from: bofh@xyzzy.no }</PRE>
380  <p>From the previous example you will notice that 4 special  <P>From the previous example you will notice that 4 special
381  variables was used. If used they will be substituted into the  variables was used. If used they will be substituted into the
382  text with a special value:</p>  text with a special value:</P>
383  <p><em>$EVENT</em> A string describing the event that occured. The values  <P><EM>$EVENT</EM> A string describing the event that occured. The values
384  are fixed and are, ``restarted'', ``timed out'', ``stopped and  are fixed and are, ``restarted'', ``timed out'', ``stopped and
385  ''checksum error``</p>  ''checksum error``</P>
386  <p><em>$PROGRAM</em> The program entry name in monitrc</p>  <P><EM>$PROGRAM</EM> The program entry name in monitrc</P>
387  <p><em>$DATE</em> The current time and date (C time style).</p>  <P><EM>$DATE</EM> The current time and date (C time style).</P>
388  <p><em>$HOST</em> The name of the host monit is running on</p>  <P><EM>$HOST</EM> The name of the host monit is running on</P>
389  <p>  <P>
390  </p>  <H2><A NAME="setting a global mail format">Setting a global mail format</A></H2>
391  <h2><a name="setting_a_global_mail_format">Setting a global mail format</a></h2>  <P>Finally, it is possible to set a standard mail format with the
 <p>Finally, it is possible to set a standard mail format with the  
392  following global set-statement (keywords are in capital):  following global set-statement (keywords are in capital):
393  </p>  </P>
394  <pre>  <PRE>
395    
396   SET MAIL-FORMAT {mail-format}</pre>   SET MAIL-FORMAT {mail-format}</PRE>
397  <p>Format set with this statement will apply to every alert  <P>Format set with this statement will apply to every alert
398  statement that does <em>not</em> have its own specified mail-format.  statement that does <EM>not</EM> have its own specified mail-format.
399  This statement is most usefull for setting a default from address  This statement is most usefull for setting a default from address
400  for messages sent by monit, like so:</p>  for messages sent by monit, like so:</P>
401  <pre>  <PRE>
402   set mail-format { from: monit@foo.bar.no }</pre>   set mail-format { from: monit@foo.bar.no }</PRE>
403  <p>  <P>
404  </p>  <HR>
405  <hr />  <H1><A NAME="program timeout">PROGRAM TIMEOUT</A></H1>
406  <h1><a name="program_timeout">PROGRAM TIMEOUT</a></h1>  <P><STRONG>monit</STRONG> provides a program timeout mechanism for situations
 <p><strong>monit</strong> provides a program timeout mechanism for situations  
407  where a program simply refuses to start or respond over a longer  where a program simply refuses to start or respond over a longer
408  period. In cases like this, and particularly if monits poll-cycle  period. In cases like this, and particularly if monits poll-cycle
409  is low, monit will simply increase the machine load by trying to  is low, monit will simply increase the machine load by trying to
410  restart the program.</p>  restart the program.</P>
411  <p>The timeout mechanism monit provides is based on two variables,  <P>The timeout mechanism monit provides is based on two variables,
412  i.e. the number the program has been started and the number of  i.e. the number the program has been started and the number of
413  poll-cycles. For example, if a program had <em>x</em> restarts within  poll-cycles. For example, if a program had <EM>x</EM> restarts within
414  <em>y</em> poll-cycles (where <em>x</em> &lt;= <em>y</em>) then monit will timeout and  <EM>y</EM> poll-cycles (where <EM>x</EM> &lt;= <EM>y</EM>) then monit will timeout and
415  not (re)start the program on the next cycle. It's a good idea to  not (re)start the program on the next cycle. It's a good idea to
416  use the alert statement in conjunction with timeout, so if a  use the alert statement in conjunction with timeout, so if a
417  timeout occurs monit will send an alert notification. A legal  timeout occurs monit will send an alert notification. A legal
418  (but verbose) way to write a timeout statement for a program  (but verbose) way to write a timeout statement for a program
419  entry in the control file is:</p>  entry in the control file is:</P>
420  <pre>  <PRE>
421   timeout if 3 restarts within 3 cycles</pre>   timeout if 3 restarts within 3 cycles</PRE>
422  <p>The shorthand version is:</p>  <P>The shorthand version is:</P>
423  <pre>  <PRE>
424   timeout(3,3)</pre>   timeout(3,3)</PRE>
425  <p>Where the first digit is the number of program restarts, the  <P>Where the first digit is the number of program restarts, the
426  second is the number of poll-cycles. If the number of cycles was  second is the number of poll-cycles. If the number of cycles was
427  reached without a timeout, the program start-counter is reset to  reached without a timeout, the program start-counter is reset to
428  zero. This provides some granularity to catch expectional cases  zero. This provides some granularity to catch expectional cases
429  and do a program timeout, but to let occasional program restarts  and do a program timeout, but to let occasional program restarts
430  happen without having an accumulated timeout.</p>  happen without having an accumulated timeout.</P>
431  <p>If you use timeout (it's optional), then be sure to add an alert  <P>If you use timeout (it's optional), then be sure to add an alert
432  statement to notify the responsible administrator. Such as:  statement to notify the responsible administrator. Such as:
433  </p>  </P>
434  <pre>  <PRE>
435    
436   timeout(3, 5) and alert bofh@foo.bar on { timeout }</pre>   timeout(3, 5) and alert bofh@foo.bar on { timeout }</PRE>
437  <p>To have monit check the program again after a timeout, run 'monit  <P>To have monit check the program again after a timeout, run 'monit
438  start program' from the command line. This will remove the  start program' from the command line. This will remove the
439  timeout lock in the daemon and make the daemon start and check  timeout lock in the daemon and make the daemon start and check
440  the program again.</p>  the program again.</P>
441  <p>  <P>
442  </p>  <HR>
443  <hr />  <H1><A NAME="resource testing">RESOURCE TESTING</A></H1>
444  <h1><a name="resource_testing">RESOURCE TESTING</a></h1>  <P>Monit can examine how much system resources a service or the
445  <p>Monit can examine how much system resources a service or the  system is using.</P>
446  system is using.</p>  <P>Depending on this indicator services can be stopped or restarted
 <p>Depending on this indicator services can be stopped or restarted  
447  and alerts can be generated.  Thus it is possible to utilize  and alerts can be generated.  Thus it is possible to utilize
448  systems which are idle and to spare system under high load.</p>  systems which are idle and to spare system under high load.</P>
449  <p>The full syntax for the resource-statements used for resource  <P>The full syntax for the resource-statements used for resource
450  testing is as follows (keywords are in capital and optional  testing is as follows (keywords are in capital and optional
451  statements in [brackets]),</p>  statements in [brackets]),</P>
452  <pre>  <PRE>
453   resource operator value [cycles] action</pre>   resource operator value [cycles] action</PRE>
454  <p><em>resource</em> is a choice of ``CPUUSAGE'', ``MEMUSAGE'', ``MEMKBYTE'',  <P><EM>resource</EM> is a choice of ``CPUUSAGE'', ``MEMUSAGE'', ``MEMKBYTE'',
455  ``LOADAVG([1min|5min|15min])'':</p>  ``LOADAVG([1min|5min|15min])'':</P>
456  <p>CPUUSAGE is the CPU usage of the process and it's children in  <P>CPUUSAGE is the CPU usage of the process and it's children in
457  parts of hundred (percent). This resource <em>value</em> is a floating  parts of hundred (percent). This resource <EM>value</EM> is a floating
458  point number. For instance, 60.0.</p>  point number. For instance, 60.0.</P>
459  <p>MEMUSAGE is the memory usage of the process in parts of hundred  <P>MEMUSAGE is the memory usage of the process in parts of hundred
460  (percent). This resource <em>value</em> is also a floating point  (percent). This resource <EM>value</EM> is also a floating point
461  number.</p>  number.</P>
462  <p>MEMKBYTE is the memory amount of the process in KiB (1024  <P>MEMKBYTE is the memory amount of the process in KiB (1024
463  byte). This resource <em>value</em> is an integer number.</p>  byte). This resource <EM>value</EM> is an integer number.</P>
464  <p><code>LOADAVG([1min|5min|15min])</code> refers to the system's load average.  <P><CODE>LOADAVG([1min|5min|15min])</CODE> refers to the system's load average.
465  The load average is the number of processes in the system run  The load average is the number of processes in the system run
466  queue averaged over the specified time period. This resource  queue averaged over the specified time period. This resource
467  <em>value</em> is again a floating point number.</p>  <EM>value</EM> is again a floating point number.</P>
468  <p><em>operator</em> is a choice of ``&lt;'',``&gt;'',``!='',``=='' in c notation, ``gt'',  <P><EM>operator</EM> is a choice of ``&lt;'',``&gt;'',``!='',``=='' in c notation, ``gt'',
469  ``lt'', ``eq'', ``ne'' in shell sh notation and ``greater'', ``less'',  ``lt'', ``eq'', ``ne'' in shell sh notation and ``greater'', ``less'',
470  ``equal'', ``notequal'' in human readable form (if not specified,  ``equal'', ``notequal'' in human readable form (if not specified,
471  default is EQUAL).</p>  default is EQUAL).</P>
472  <p><em>cycles</em> is the maximum number of cycles the expression above  <P><EM>cycles</EM> is the maximum number of cycles the expression above
473  has to be true in order to start an action.  If <em>cycles</em> is  has to be true in order to start an action.  If <EM>cycles</EM> is
474  omitted then it is set to one.</p>  omitted then it is set to one.</P>
475  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``STOP'':</p>  <P><EM>action</EM> is a choice of ``ALERT'', ``RESTART'', ``STOP'':</P>
476  <p>ALERT sends the user a resource alert in case the maximum number  <P>ALERT sends the user a resource alert in case the maximum number
477  of cycles has been reached.</p>  of cycles has been reached.</P>
478  <p>RESTART restarts the service in case the maximum number of cycles  <P>RESTART restarts the service in case the maximum number of cycles
479  has been reached.</p>  has been reached.</P>
480  <p>STOP stops the service in case the maximum number of cycles has  <P>STOP stops the service in case the maximum number of cycles has
481  been reached. If monit stops a service it will not be checked by  been reached. If monit stops a service it will not be checked by
482  monit anymore nor restarted again later. You must explicit start  monit anymore nor restarted again later. You must explicit start
483  it again from the web interface or from the console, like: 'monit  it again from the web interface or from the console, like: 'monit
484  start apache' if you want the monit daemon to monitor the service  start apache' if you want the monit daemon to monitor the service
485  again.</p>  again.</P>
486  <p>To calculate the cycles, a counter is raised whenever the  <P>To calculate the cycles, a counter is raised whenever the
487  expression above is true and it is lowered whenever it is false  expression above is true and it is lowered whenever it is false
488  (but not below 0).  All counters are reseted in case of a  (but not below 0).  All counters are reseted in case of a
489  restart.</p>  restart.</P>
490  <p>In order to check that the CPU usage of a service is not going  <P>In order to check that the CPU usage of a service is not going
491  beyond 50% for five cycles before restarting it, the following  beyond 50% for five cycles before restarting it, the following
492  expression could be used:</p>  expression could be used:</P>
493  <pre>  <PRE>
494   if cpuusage is greater than 50.0 for 5 cycles then restart</pre>   if cpuusage is greater than 50.0 for 5 cycles then restart</PRE>
495  <p>Or the short version without noise keywords:</p>  <P>Or the short version without noise keywords:</P>
496  <pre>  <PRE>
497   cpuusage &gt; 50.0 5 restart</pre>   cpuusage &gt; 50.0 5 restart</PRE>
498  <p>See also the example section below.</p>  <P>See also the example section below.</P>
499  <p>  <P>
500  </p>  <HR>
501  <hr />  <H1><A NAME="timestamp testing">TIMESTAMP TESTING</A></H1>
502  <h1><a name="timestamp_testing">TIMESTAMP TESTING</a></h1>  <P>Monit can watch the timestamp of any file or directory associated
503  <p>Monit can watch the timestamp of any file or directory associated  with a program.</P>
504  with a program.</p>  <P>The full syntax for the timestamp statement is as follows
505  <p>The full syntax for the timestamp statement is as follows  (keywords are in capital and optional statements in [brackets]):</P>
506  (keywords are in capital and optional statements in [brackets]):</p>  <PRE>
507  <pre>   TIMESTAMP object [operator] value [unit] action</PRE>
508   TIMESTAMP object [operator] value [unit] action</pre>  <P><EM>object</EM> is a path to the associated file or directory to watch.</P>
509  <p><em>object</em> is a path to the associated file or directory to watch.</p>  <P><EM>operator</EM> is a choice of ``&lt;'',``&gt;'',``!='',``=='' in c notation, ``GT'',
 <p><em>operator</em> is a choice of ``&lt;'',``&gt;'',``!='',``=='' in c notation, ``GT'',  
510  ``LT'', ``EQ'', ``NE'' in shell sh notation and ``GREATER'', ``LESS'',  ``LT'', ``EQ'', ``NE'' in shell sh notation and ``GREATER'', ``LESS'',
511  ``EQUAL'', ``NOTEQUAL'' in human readable form (if not specified,  ``EQUAL'', ``NOTEQUAL'' in human readable form (if not specified,
512  default is EQUAL).</p>  default is EQUAL).</P>
513  <p><em>value</em> is a time watermark.</p>  <P><EM>value</EM> is a time watermark.</P>
514  <p><em>unit</em> is either ``SECOND'', ``MINUTE'', ``HOUR'' or ``DAY'' (it is also  <P><EM>unit</EM> is either ``SECOND'', ``MINUTE'', ``HOUR'' or ``DAY'' (it is also
515  possible to use ``SECONDS'', ``MINUTES'', ``HOURS'', or ``DAYS'').</p>  possible to use ``SECONDS'', ``MINUTES'', ``HOURS'', or ``DAYS'').</P>
516  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``STOP'':</p>  <P><EM>action</EM> is a choice of ``ALERT'', ``RESTART'', ``STOP'':</P>
517  <pre>  <PRE>
518   o ALERT sends the user a timestamp alert.</pre>   o ALERT sends the user a timestamp alert.</PRE>
519  <pre>  <PRE>
520   o RESTART restarts the service.</pre>   o RESTART restarts the service.</PRE>
521  <pre>  <PRE>
522   o STOP stops the service. If monit stops a service it will not   o STOP stops the service. If monit stops a service it will not
523     be checked by monit anymore nor restarted again later. You     be checked by monit anymore nor restarted again later. You
524     must explicit start it again from the web interface or from     must explicit start it again from the web interface or from
525     the console, like: 'monit start apache' if you want the monit     the console, like: 'monit start apache' if you want the monit
526     daemon to monitor the service again.</pre>     daemon to monitor the service again.</PRE>
527  <p>The timestamp statement is useful for monitoring systems, that  <P>The timestamp statement is useful for monitoring systems, that
528  are able to report its state by changing the timestamp of certain  are able to report its state by changing the timestamp of certain
529  state files. For instance the <em>iPlanet Messaging server stored  state files. For instance the <EM>iPlanet Messaging server stored
530  process</em> system update the timestamp of:</p>  process</EM> system update the timestamp of:</P>
531  <pre>  <PRE>
532   o stored.ckp   o stored.ckp
533   o stored.lcu   o stored.lcu
534   o stored.per</pre>   o stored.per</PRE>
535  <p>whenever it runs tasks and if a task failed, the system keeps the  <P>whenever it runs tasks and if a task failed, the system keeps the
536  timestamp.</p>  timestamp.</P>
537  <p>To report stored problems you can use following statements:</p>  <P>To report stored problems you can use following statements:</P>
538  <pre>  <PRE>
539   if timestamp &quot;/msg-foo/config/stored.ckp&quot; &gt; 1 minute then alert   if timestamp &quot;/msg-foo/config/stored.ckp&quot; &gt; 1 minute then alert
540   if timestamp &quot;/msg-foo/config/stored.lcu&quot; &gt; 5 minutes then alert   if timestamp &quot;/msg-foo/config/stored.lcu&quot; &gt; 5 minutes then alert
541   if timestamp &quot;/msg-foo/config/stored.per&quot; &gt; 1 hour then alert</pre>   if timestamp &quot;/msg-foo/config/stored.per&quot; &gt; 1 hour then alert</PRE>
542  <p>or the equivalent less verbose form:</p>  <P>or the equivalent less verbose form:</P>
543  <pre>  <PRE>
544   timestamp &quot;/msg-foo/config/stored.ckp&quot; &gt; 60 alert   timestamp &quot;/msg-foo/config/stored.ckp&quot; &gt; 60 alert
545   timestamp &quot;/msg-foo/config/stored.lcu&quot; &gt; 300 alert   timestamp &quot;/msg-foo/config/stored.lcu&quot; &gt; 300 alert
546   timestamp &quot;/msg-foo/config/stored.per&quot; &gt; 3600 alert</pre>   timestamp &quot;/msg-foo/config/stored.per&quot; &gt; 3600 alert</PRE>
547  <p>As mentioned above, you can also use the timestamp statement for  <P>As mentioned above, you can also use the timestamp statement for
548  monitoring directories for changes. If files are added or removed  monitoring directories for changes. If files are added or removed
549  to/from a directory, its timestamp is changed:</p>  to/from a directory, its timestamp is changed:</P>
550  <pre>  <PRE>
551   if timestamp &quot;/foo/directory&quot; &gt; 1 hour then alert</pre>   if timestamp &quot;/foo/directory&quot; &gt; 1 hour then alert</PRE>
552  <p>or</p>  <P>or</P>
553  <pre>  <PRE>
554   if timestamp &quot;/foo/secure/directory&quot; &lt; 1 hour then alert</pre>   if timestamp &quot;/foo/secure/directory&quot; &lt; 1 hour then alert</PRE>
555  <p>The following example is a neat trick for restarting a process  <P>The following example is a neat trick for restarting a process
556  after a certain time. Sometimes this is a necessary workaround  after a certain time. Sometimes this is a necessary workaround
557  for some products, until the vendor fix a problem:</p>  for some products, until the vendor fix a problem:</P>
558  <pre>  <PRE>
559   if timestamp &quot;/var/run/crappy_program.pid&quot; &gt; 7 days then restart</pre>   if timestamp &quot;/var/run/crappy_program.pid&quot; &gt; 7 days then restart</PRE>
560  <p>  <P>
561  </p>  <HR>
562  <hr />  <H1><A NAME="connection testing">CONNECTION TESTING</A></H1>
563  <h1><a name="connection_testing">CONNECTION TESTING</a></h1>  <P>Monit is able to perfom connection testing via networked ports
564  <p>Monit is able to perfom connection testing via networked ports  and via unix sockets.</P>
565  and via unix sockets.</p>  <P>If a program listens on one or more sockets, monit can connect to
 <p>If a program listens on one or more sockets, monit can connect to  
566  the port (using either tcp or udp) and verify that the program  the port (using either tcp or udp) and verify that the program
567  will accept a connection and that it is possible to read and  will accept a connection and that it is possible to read and
568  write to the socket. If a connection is not accepted or if there  write to the socket. If a connection is not accepted or if there
569  is a problem with the socket i|o, monit will assume that  is a problem with the socket i|o, monit will assume that
570  something is wrong and restart the program.  Additionally, if  something is wrong and restart the program.  Additionally, if
571  monit is compiled with openssl support ssl forged network  monit is compiled with openssl support ssl forged network
572  services can be tested, too.</p>  services can be tested, too.</P>
573  <p>The full syntax for the port-statement used for connection  <P>The full syntax for the port-statement used for connection
574  testing is as follows (keywords are in capital and optional  testing is as follows (keywords are in capital and optional
575  statements in [brackets]) for networked ports,</p>  statements in [brackets]) for networked ports,</P>
576  <pre>  <PRE>
577   [HOST hostname] PORT number   [HOST hostname] PORT number
578           [TYPE {TCP|UDP|TCPSSL [SSLAUTO|SSLV2|SSLV3|TLSV1]           [TYPE {TCP|UDP|TCPSSL [SSLAUTO|SSLV2|SSLV3|TLSV1]
579                                 [CERTMD5 md5sum]                                 [CERTMD5 md5sum]
580                 }]                 }]
581           [PROTO(COL) {name} [REQUEST {&quot;/path&quot;}]]</pre>           [PROTO(COL) {name} [REQUEST {&quot;/path&quot;}]]</PRE>
582  <p>or for unix sockets,</p>  <P>or for unix sockets,</P>
583  <pre>  <PRE>
584   UNIX(SOCKET) path [TYPE {TCP|UDP}] [PROTO(COL) {name}   UNIX(SOCKET) path [TYPE {TCP|UDP}] [PROTO(COL) {name}
585    [REQUEST {&quot;/path&quot;}]]</pre>    [REQUEST {&quot;/path&quot;}]]</PRE>
586  <p>To have monit check a port connection use the following statement:</p>  <P>To have monit check a port connection use the following statement:</P>
587  <pre>  <PRE>
588    port 80</pre>    port 80</PRE>
589  <p>In this case the machine in question is assumed to be  <P>In this case the machine in question is assumed to be
590  <em>localhost</em> and monit will issue a tcp connection to localhost  <EM>localhost</EM> and monit will issue a tcp connection to localhost
591  at port 80. Monit will use tcp by default, if you want to connect  at port 80. Monit will use tcp by default, if you want to connect
592  with udp, you can specify this after the port-statement;</p>  with udp, you can specify this after the port-statement;</P>
593  <pre>  <PRE>
594   port 53 use type udp ('use' is a noise keyword)</pre>   port 53 use type udp ('use' is a noise keyword)</PRE>
595  <p>The <em>TCPSSL</em> statement accepts optionally the md5 sum of the  <P>The <EM>TCPSSL</EM> statement accepts optionally the md5 sum of the
596  server's certificate.  The md5 sum is matched against the one  server's certificate.  The md5 sum is matched against the one
597  delivered by the server.  In case they do not match the  delivered by the server.  In case they do not match the
598  connection test fails.  In case the ssl version independant  connection test fails.  In case the ssl version independant
599  handshake is not working properly you can force a specific ssl  handshake is not working properly you can force a specific ssl
600  version, too.</p>  version, too.</P>
601  <p>In case a server is listening to a unix socket called  <P>In case a server is listening to a unix socket called
602  /var/run/mysocket, the following statement can be used:</p>  /var/run/mysocket, the following statement can be used:</P>
603  <pre>  <PRE>
604   unix /var/run/mysocket</pre>   unix /var/run/mysocket</PRE>
605  <p>If your machine answers for several virtual hosts you can prefix  <P>If your machine answers for several virtual hosts you can prefix
606  the port statement with a host-statement like so:</p>  the port statement with a host-statement like so:</P>
607  <pre>  <PRE>
608   host www.sol.no     port 80   host www.sol.no     port 80
609   host shop.sol.no    port 443   host shop.sol.no    port 443
610   host kvasir.sol.no  port 80   host kvasir.sol.no  port 80
611   host 10.2.3.4       port 80</pre>   host 10.2.3.4       port 80</PRE>
612  <p>And as mentioned above, if you do not specify a host-statement,  <P>And as mentioned above, if you do not specify a host-statement,
613  <em>localhost</em> is assumed.</p>  <EM>localhost</EM> is assumed.</P>
614  <p>Finally, monit also knows how to speak some of the more popular  <P>Finally, monit also knows how to speak some of the more popular
615  Internet protocols. So, besides testing for connections, monit  Internet protocols. So, besides testing for connections, monit
616  can also speak with the server in question to verify that the  can also speak with the server in question to verify that the
617  server works. For example, the following is used to test a http  server works. For example, the following is used to test a http
618  server:  server:
619  </p>  </P>
620  <pre>  <PRE>
621    
622   host www.tildeslash.com port 80 protocol http</pre>   host www.tildeslash.com port 80 protocol http</PRE>
623  <p>At the moment monit knows how to speak <em>HTTP</em>, <em>SMTP</em>, <em>FTP</em>,  <P>At the moment monit knows how to speak <EM>HTTP</EM>, <EM>SMTP</EM>, <EM>FTP</EM>,
624  <em>POP</em>, <em>IMAP</em>, <em>NNTP</em>, <em>SSH</em>, <em>DWP</em>, <em>LDAP2</em> and <em>LDAP3</em>.  <EM>POP</EM>, <EM>IMAP</EM>, <EM>NNTP</EM>, <EM>SSH</EM>, <EM>DWP</EM>, <EM>LDAP2</EM> and <EM>LDAP3</EM>.
625  If you have compiled monit with ssl support, monit can also speak  If you have compiled monit with ssl support, monit can also speak
626  <em>HTTPS</em>, <em>FTPS</em>, <em>POPS</em> and <em>IMAPS</em>.</p>  <EM>HTTPS</EM>, <EM>FTPS</EM>, <EM>POPS</EM> and <EM>IMAPS</EM>.</P>
627  <p>Some protocols also support a request statement. This statement  <P>Some protocols also support a request statement. This statement
628  can be used to ask the server for a special document entity.</p>  can be used to ask the server for a special document entity.</P>
629  <p>Currently <strong>only</strong> the <em>HTTP</em> protocol module supports the  <P>Currently <STRONG>only</STRONG> the <EM>HTTP</EM> protocol module supports the
630  request statement, such as:</p>  request statement, such as:</P>
631  <pre>  <PRE>
632   host www.myhost.com port 80 protocol http   host www.myhost.com port 80 protocol http
633     request &quot;/data/show.php?a=b&amp;c=d&quot;</pre>     request &quot;/data/show.php?a=b&amp;c=d&quot;</PRE>
634  <p>The request should contain an URI string specifying a document  <P>The request should contain an URI string specifying a document
635  from the http server. The string will be url encoded by monit  from the http server. The string will be url encoded by monit
636  before it sends the request to the http server, so it's okay to  before it sends the request to the http server, so it's okay to
637  use url unsafe characters in the request.</p>  use url unsafe characters in the request.</P>
638  <p>If the request statement isn't specified, the default web server  <P>If the request statement isn't specified, the default web server
639  page will be requested.</p>  page will be requested.</P>
640  <p>It is of course possible to mix networked ports and unix sockets  <P>It is of course possible to mix networked ports and unix sockets
641  checks for a service.</p>  checks for a service.</P>
642  <p>See also the example section below.</p>  <P>See also the example section below.</P>
643  <p>  <P>
644  </p>  <HR>
645  <hr />  <H1><A NAME="monit httpd">MONIT HTTPD</A></H1>
646  <h1><a name="monit_httpd">MONIT HTTPD</a></h1>  <P>If specified in the control file, monit will start a monit daemon
 <p>If specified in the control file, monit will start a monit daemon  
647  with http support. From a Browser you can then start and stop  with http support. From a Browser you can then start and stop
648  programs as well as view the status of each program. Also, if  programs as well as view the status of each program. Also, if
649  monit logs to its own file, you can view the content of this  monit logs to its own file, you can view the content of this
650  logfile in a Browser.</p>  logfile in a Browser.</P>
651  <p>The control file statement for starting a monit daemon with http  <P>The control file statement for starting a monit daemon with http
652  support is a global set-statement:</p>  support is a global set-statement:</P>
653  <pre>  <PRE>
654    set httpd port 2812</pre>    set httpd port 2812</PRE>
655  <p>And you can use this URL, <em><a href="http://localhost:2812/">http://localhost:2812/</a></em>, to access  <P>And you can use this URL, <EM><A HREF="http://localhost:2812/">http://localhost:2812/</A></EM>, to access
656  the daemon from a browser.</p>  the daemon from a browser.</P>
657  <p>The port number, in this case 2812, can be any number that you  <P>The port number, in this case 2812, can be any number that you
658  are allowed to bind to.</p>  are allowed to bind to.</P>
659  <p>If you have compiled monit with openssl support, you can also  <P>If you have compiled monit with openssl support, you can also
660  start the httpd server with ssl support, using the following  start the httpd server with ssl support, using the following
661  expression:</p>  expression:</P>
662  <pre>  <PRE>
663    set httpd port 2812    set httpd port 2812
664          ssl enable          ssl enable
665          pemfile /etc/certs/monit.pem</pre>          pemfile /etc/certs/monit.pem</PRE>
666  <p>And you can use this URL, <em><a href="https://localhost:2812/">https://localhost:2812/</a></em>, to access  <P>And you can use this URL, <EM><A HREF="https://localhost:2812/">https://localhost:2812/</A></EM>, to access
667  the monit web server over an ssl encrypted connection.</p>  the monit web server over an ssl encrypted connection.</P>
668  <p>The pemfile, in the example above, holds the private key and the  <P>The pemfile, in the example above, holds the private key and the
669  certificate. This file should be stored on a safe place on the  certificate. This file should be stored on a safe place on the
670  filesystem and should have strict permissions, that is, no more  filesystem and should have strict permissions, that is, no more
671  than 0700. For more information on how to generate this file,  than 0700. For more information on how to generate this file,
672  please consult README.ssl</p>  please consult README.ssl</P>
673  <p>In addition, if you want to check for client certificates you can  <P>In addition, if you want to check for client certificates you can
674  use the CLIENTPEMFILE statement.  In that case a connecting  use the CLIENTPEMFILE statement.  In that case a connecting
675  client has to have a sufficient key and certificate in order to  client has to have a sufficient key and certificate in order to
676  connect.  This file also needs to have all necessary CA  connect.  This file also needs to have all necessary CA
677  certificates. A configuration could look like:  certificates. A configuration could look like:
678  </p>  </P>
679  <pre>  <PRE>
680    
681    set httpd port 2812    set httpd port 2812
682          ssl enable          ssl enable
683          pemfile /etc/certs/monit.pem          pemfile /etc/certs/monit.pem
684          clientpemfile /etc/certs/monit-client.pem</pre>          clientpemfile /etc/certs/monit-client.pem</PRE>
685  <p>By default self signed certificates are not allowed.  In case you need  <P>By default self signed certificates are not allowed.  In case you need
686  to use them it has to be allowed explicitly with the  to use them it has to be allowed explicitly with the
687  ALLOWSELFCERTIFICATION statement.</p>  ALLOWSELFCERTIFICATION statement.</P>
688  <p>If you only want the http server to accept connect requests to  <P>If you only want the http server to accept connect requests to
689  one host addresses you can specify the bind address either as an  one host addresses you can specify the bind address either as an
690  IP number string or as a hostname. In the following example we  IP number string or as a hostname. In the following example we
691  bind the http server to the loopback device. In other words the  bind the http server to the loopback device. In other words the
692  http server will only be reachable from localhost:</p>  http server will only be reachable from localhost:</P>
693  <pre>  <PRE>
694    set httpd port 2812 and use the address 127.0.0.1</pre>    set httpd port 2812 and use the address 127.0.0.1</PRE>
695  <p>or</p>  <P>or</P>
696  <pre>  <PRE>
697    set httpd port 2812 and use the address localhost</pre>    set httpd port 2812 and use the address localhost</PRE>
698  <p>or with ssl</p>  <P>or with ssl</P>
699  <pre>  <PRE>
700    set httpd port 2812    set httpd port 2812
701        ssl enable        ssl enable
702        address localhost        address localhost
703        pemfile /var/certs/monit.pem</pre>        pemfile /var/certs/monit.pem</PRE>
704  <p>If you do not use the ADDRESS statement the http server will  <P>If you do not use the ADDRESS statement the http server will
705  accept connections on any/all local addresses.</p>  accept connections on any/all local addresses.</P>
706  <p>If you remove the httpd statement from the config file, monit will  <P>If you remove the httpd statement from the config file, monit will
707  stop the httpd server on its next cycle. Likewise if you change  stop the httpd server on its next cycle. Likewise if you change
708  the port number, monit will restart the http server using the new  the port number, monit will restart the http server using the new
709  specified port number.</p>  specified port number.</P>
710  <p>The status page displayed by the monit web server is  <P>The status page displayed by the monit web server is
711  automatically refreshed with the same poll time set for the monit  automatically refreshed with the same poll time set for the monit
712  daemon.</p>  daemon.</P>
713  <p><strong>Note:</strong></p>  <P><STRONG>Note:</STRONG></P>
714  <p>You <em>must</em> start a monit daemon with http support if you want to  <P>You <EM>must</EM> start a monit daemon with http support if you want to
715  be able to use the following console commands.</p>  be able to use the following console commands.</P>
716  <pre>  <PRE>
717   'monit stop'   'monit stop'
718   'monit start program'   'monit start program'
719   'monit stop program'   'monit stop program'
720   'monit restart program'   'monit restart program'
721   'monit -g groupname start'   'monit -g groupname start'
722   'monit -g groupname stop'   'monit -g groupname stop'
723   'monit -g groupname restart'</pre>   'monit -g groupname restart'</PRE>
724  <p>If a monit daemon is running in the background we will ask the  <P>If a monit daemon is running in the background we will ask the
725  deamon (via the HTTP protocol) to execute the above commands.  deamon (via the HTTP protocol) to execute the above commands.
726  That is, the daemon is requested to start and stop the programs.  That is, the daemon is requested to start and stop the programs.
727  This ensures that a daemon will not restart a program that you  This ensures that a daemon will not restart a program that you
728  requested to stop and that (any) timeout lock will be removed  requested to stop and that (any) timeout lock will be removed
729  from a program when you start it.</p>  from a program when you start it.</P>
730  <p>  <P>
731  </p>  <H2><A NAME="monit httpd authentication">Monit HTTPD Authentication</A></H2>
732  <h2><a name="monit_httpd_authentication">Monit HTTPD Authentication</a></h2>  <P>monit supports two types of autenthication schemas for connecting
 <p>monit supports two types of autenthication schemas for connecting  
733  to the httpd server. Both schemas can be used together or by  to the httpd server. Both schemas can be used together or by
734  itself.  You <strong>must</strong> choose at least one.</p>  itself.  You <STRONG>must</STRONG> choose at least one.</P>
735  <p><strong>Host allow list</strong></p>  <P><STRONG>Host allow list</STRONG></P>
736  <p>The http server maintains an access-control list of hosts allowed  <P>The http server maintains an access-control list of hosts allowed
737  to connect to the server. You can add as many hosts as you want  to connect to the server. You can add as many hosts as you want
738  to, but only hosts with a valid domain name or its IP address are  to, but only hosts with a valid domain name or its IP address are
739  allowed. If you specify a host that does not resolve, monit will  allowed. If you specify a host that does not resolve, monit will
740  write an error message in the console and not start.</p>  write an error message in the console and not start.</P>
741  <p>The http server will query a nameserver to check any hosts  <P>The http server will query a nameserver to check any hosts
742  connecting to the server. If a host (client) is trying to connect  connecting to the server. If a host (client) is trying to connect
743  to the server, but cannot be found in the access list or cannot  to the server, but cannot be found in the access list or cannot
744  be resolved, the server will shutdown the connection to the  be resolved, the server will shutdown the connection to the
745  client promptly.</p>  client promptly.</P>
746  <p>Control file example:</p>  <P>Control file example:</P>
747  <pre>  <PRE>
748    set httpd port 2812    set httpd port 2812
749        allow localhost        allow localhost
750        allow my.other.work.machine.com        allow my.other.work.machine.com
751        allow 10.1.1.1</pre>        allow 10.1.1.1</PRE>
752  <p><strong>Basic Authentication</strong></p>  <P><STRONG>Basic Authentication</STRONG></P>
753  <p>This authentication schema is HTTP specific and described in more  <P>This authentication schema is HTTP specific and described in more
754  detail in RFC 2617.</p>  detail in RFC 2617.</P>
755  <p>In short; a server challenge a client (e.g. a Browser) to send  <P>In short; a server challenge a client (e.g. a Browser) to send
756  authentication information (username and password) and if  authentication information (username and password) and if
757  accepted, the server will allow the client access to the  accepted, the server will allow the client access to the
758  requested document.</p>  requested document.</P>
759  <p>The biggest weakness with Basic Authentication is that the  <P>The biggest weakness with Basic Authentication is that the
760  username and password is sent in clear-text (i.e. base64 encoded)  username and password is sent in clear-text (i.e. base64 encoded)
761  over the network. It is therefor recommended that you do not use  over the network. It is therefor recommended that you do not use
762  this authentication method unless you run the monit http server  this authentication method unless you run the monit http server
763  with <em>ssl</em> support. With ssl support it is completely safe to  with <EM>ssl</EM> support. With ssl support it is completely safe to
764  use Basic Authentication since <strong>all</strong> http data, including Basic  use Basic Authentication since <STRONG>all</STRONG> http data, including Basic
765  Authentication headers will be encrypted.</p>  Authentication headers will be encrypted.</P>
766  <p>monit will use Basic Authentication if an allow statement contains  <P>monit will use Basic Authentication if an allow statement contains
767  a username and password separated with a single ':' character,  a username and password separated with a single ':' character,
768  like so; <em>allow username:password</em>. The username and password  like so; <EM>allow username:password</EM>. The username and password
769  must be written in clear-text. Only one username and password  must be written in clear-text. Only one username and password
770  pair is supported.</p>  pair is supported.</P>
771  <p>If you use this method together with a host list, then only  <P>If you use this method together with a host list, then only
772  clients from the listed hosts will be allowed to connect to the  clients from the listed hosts will be allowed to connect to the
773  monit http server and each client will be asked to provide a  monit http server and each client will be asked to provide a
774  username and password.</p>  username and password.</P>
775  <p>Example:</p>  <P>Example:</P>
776  <pre>  <PRE>
777    set httpd port 2812    set httpd port 2812
778        allow localhost        allow localhost
779        allow my.other.work.machine.com        allow my.other.work.machine.com
780        allow 10.1.1.1        allow 10.1.1.1
781        allow hauk:monit</pre>        allow hauk:monit</PRE>
782  <p>If you only want to use Basic Authentication, then just provide  <P>If you only want to use Basic Authentication, then just provide
783  the one line with username and password, like:</p>  the one line with username and password, like:</P>
784  <pre>  <PRE>
785    set httpd port 2812    set httpd port 2812
786        allow hauk:monit</pre>        allow hauk:monit</PRE>
787  <p>If you use Basic Authentication it is a good idea to set the  <P>If you use Basic Authentication it is a good idea to set the
788  access permission for the control file (~/.monitrc) to only  access permission for the control file (~/.monitrc) to only
789  readable and writeable for the user running monit, because the  readable and writeable for the user running monit, because the
790  password is written in clear-text. (Use this command, /bin/chmod  password is written in clear-text. (Use this command, /bin/chmod
791  600 ~/.monitrc). In fact, since monit <strong>version 3.0</strong>, monit will  600 ~/.monitrc). In fact, since monit <STRONG>version 3.0</STRONG>, monit will
792  complain and exit if the control file is readable by others.</p>  complain and exit if the control file is readable by others.</P>
793  <p>  <P>
794  </p>  <HR>
795  <hr />  <H1><A NAME="md5 checksum">MD5 CHECKSUM</A></H1>
796  <h1><a name="md5_checksum">MD5 CHECKSUM</a></h1>  <P>If specified in the control file, monit will compute a md5
 <p>If specified in the control file, monit will compute a md5  
797  checksum for programs. The checksum is used to verify that a  checksum for programs. The checksum is used to verify that a
798  program does not change. If a program was changed, monit will  program does not change. If a program was changed, monit will
799  send an (optional) alert notification, log an alert message and  send an (optional) alert notification, log an alert message and
800  not check the process anymore. The web interface will also show a  not check the process anymore. The web interface will also show a
801  checksum warning.</p>  checksum warning.</P>
802  <p>The rationale for this feature is security and that monit does  <P>The rationale for this feature is security and that monit does
803  not start a possible cracked program or script.</p>  not start a possible cracked program or script.</P>
804  <p>The full syntax for the checksum-statement is as follows:  <P>The full syntax for the checksum-statement is as follows:
805  (keywords are in capital)</p>  (keywords are in capital)</P>
806  <pre>  <PRE>
807   CHECKSUM [file [EXPECT checksum] ]+</pre>   CHECKSUM [file [EXPECT checksum] ]+</PRE>
808  <p>A legal (but verbose) way to write a checksum statement for a  <P>A legal (but verbose) way to write a checksum statement for a
809  process entry in the control file is:</p>  process entry in the control file is:</P>
810  <pre>  <PRE>
811   checksum the /usr/bin/httpd program</pre>   checksum the /usr/bin/httpd program</PRE>
812  <p>The shorthand version is just:</p>  <P>The shorthand version is just:</P>
813  <pre>  <PRE>
814   checksum /usr/bin/httpd</pre>   checksum /usr/bin/httpd</PRE>
815  <p>Several files can be used in a checksum statement:</p>  <P>Several files can be used in a checksum statement:</P>
816  <pre>  <PRE>
817   checksum /usr/apache/bin/httpd /usr/apache-ssl/bin/httpsd</pre>   checksum /usr/apache/bin/httpd /usr/apache-ssl/bin/httpsd</PRE>
818  <p>or on a line by itself:</p>  <P>or on a line by itself:</P>
819  <pre>  <PRE>
820   checksum /usr/apache/bin/httpd   checksum /usr/apache/bin/httpd
821   checksum /usr/apache-ssl/bin/httpsd</pre>   checksum /usr/apache-ssl/bin/httpsd</PRE>
822  <p>You can add as many 'checksum file' statements as you want. Like  <P>You can add as many 'checksum file' statements as you want. Like
823  described above, if the checksum for a file changes, monit will  described above, if the checksum for a file changes, monit will
824  log a warning, issue an alert message and not check the  log a warning, issue an alert message and not check the
825  associated process anymore.</p>  associated process anymore.</P>
826  <p>The <em>expect</em> statement is optional and used to specify a md5  <P>The <EM>expect</EM> statement is optional and used to specify a md5
827  string monit should expect when testing a file's checksum. If  string monit should expect when testing a file's checksum. If
828  this statement is used monit will not compute an initial checksum  this statement is used monit will not compute an initial checksum
829  for the file, as in the examples above, but instead use the  for the file, as in the examples above, but instead use the
830  string you submit. For example:</p>  string you submit. For example:</P>
831  <pre>  <PRE>
832   checksum /usr/bin/httpd expect 8f7f419955cefa0b33a2ba316cba3659</pre>   checksum /usr/bin/httpd expect 8f7f419955cefa0b33a2ba316cba3659</PRE>
833  <p>or verbose style;</p>  <P>or verbose style;</P>
834  <pre>  <PRE>
835   checksum /usr/bin/httpd and   checksum /usr/bin/httpd and
836     expect the sum 4e5309d1956f003bcdff168748bea647</pre>     expect the sum 4e5309d1956f003bcdff168748bea647</PRE>
837  <p>You can, for example, use the GNU utility <em>md5sum</em> to create a  <P>You can, for example, use the GNU utility <EM>md5sum</EM> to create a
838  checksum string for a file and then use this string in the  checksum string for a file and then use this string in the
839  expect-statement.</p>  expect-statement.</P>
840  <p>  <P>
841  </p>  <HR>
842  <hr />  <H1><A NAME="dependency checking">DEPENDENCY CHECKING</A></H1>
843  <h1><a name="dependency_checking">DEPENDENCY CHECKING</a></h1>  <P>If specified in the control file, monit can do dependency
 <p>If specified in the control file, monit can do dependency  
844  checking before starting or stopping processes. The syntax for  checking before starting or stopping processes. The syntax for
845  the depend statement is simply:</p>  the depend statement is simply:</P>
846  <pre>  <PRE>
847   DEPENDS [process]+</pre>   DEPENDS [process]+</PRE>
848  <p>Where <strong>process</strong> is a process entry name, for instance <strong>apache</strong>.  <P>Where <STRONG>process</STRONG> is a process entry name, for instance <STRONG>apache</STRONG>.
849  You may add more than one process name or use more than one  You may add more than one process name or use more than one
850  depend statement in a check entry.</p>  depend statement in an entry.</P>
851  <p>Processes specified in a <em>depends</em> statement will be checked  <P>Processes specified in a <EM>depends</EM> statement will be checked
852  during stop/start operations. If a process is stopped it will  during stop/start operations. If a process is stopped it will
853  first stop any processes that depends on itself. Likewise, if a  stop any processes that depends on itself. Likewise, if a process
854  process is started, it will first stop any processes that depends  is started, it will first stop any processes that depends on
855  on itself and after it is started, start all depending processes  itself and after it is started, start all depending processes
856  again.</p>  again.</P>
857  <p>Consider the following common server setup:</p>  <P>Consider the following common server setup:</P>
858  <pre>  <PRE>
859     (a) WEB-SERVER -&gt; (b) APPLICATION-SERVER -&gt; (c) DATABASE</pre>     (a) WEB-SERVER -&gt; (b) APPLICATION-SERVER -&gt; (c) DATABASE</PRE>
860  <p>You can set dependencies so that the web-server depends on the  <P>You can set dependencies so that the web-server depends on the
861  application server to run before the web-server starts and the  application server to run before the web-server starts and the
862  application server depends on the database server. See also the  application server depends on the database server. See also the
863  example section below for examples using the depend statement.</p>  example section below for examples using the depend statement.</P>
864  <p>Here we describe how monit will function with the above  <P>Here we describe how monit will function with the above
865  dependencies:</p>  dependencies:</P>
866  <dl>  <DL>
867  <dt><strong><a name="item_if_no_servers_are_running">If no servers are running</a></strong><br />  <DT><STRONG><A NAME="item_If_no_servers_are_running">If no servers are running</A></STRONG><BR>
868  </dt>  <DD>
869  <dd>  monit will start the servers in the following order: <EM>c</EM>, <EM>b</EM>,
870  monit will start the servers in the following order: <em>c</em>, <em>b</em>,  <EM>a</EM>
871  <em>a</em>  <P></P>
872  </dd>  <DT><STRONG><A NAME="item_If_all_servers_are_running">If all servers are running</A></STRONG><BR>
873  <p></p>  <DD>
874  <dt><strong><a name="item_if_all_servers_are_running">If all servers are running</a></strong><br />  When you run 'monit stop' this is the stop order: <EM>a</EM>, <EM>b</EM>,
875  </dt>  <EM>c</EM>. If you run 'monit stop c' then <EM>a</EM> and <EM>b</EM> are stopped
876  <dd>  because they depend on <EM>c</EM> and finally <EM>c</EM> is stopped.
877  When you run 'monit stop' this is the stop order: <em>a</em>, <em>b</em>,  <P></P>
878  <em>c</em>. If you run 'monit stop c' then <em>a</em> and <em>b</em> are stopped  <DT><STRONG><A NAME="item_If_a_does_not_run">If <EM>a</EM> does not run</A></STRONG><BR>
879  because they depend on <em>c</em> and finally <em>c</em> is stopped.  <DD>
880  </dd>  When monit runs it will start <EM>a</EM>
881  <p></p>  <P></P>
882  <dt><strong><a name="item_if_a_does_not_run">If <em>a</em> does not run</a></strong><br />  <DT><STRONG><A NAME="item_If_b_does_not_run">If <EM>b</EM> does not run</A></STRONG><BR>
883  </dt>  <DD>
884  <dd>  When monit runs it will first stop <EM>a</EM> then start <EM>b</EM> and
885  When monit runs it will start <em>a</em>  finally start <EM>a</EM> again.
886  </dd>  <P></P>
887  <p></p>  <DT><STRONG><A NAME="item_If_c_does_not_run">If <EM>c</EM> does not run</A></STRONG><BR>
888  <dt><strong><a name="item_if_b_does_not_run">If <em>b</em> does not run</a></strong><br />  <DD>
889  </dt>  When monit runs it will first stop <EM>a</EM> and <EM>b</EM> then start <EM>c</EM>
890  <dd>  and finally start <EM>b</EM> then <EM>a</EM>.
891  When monit runs it will first stop <em>a</em> then start <em>b</em> and  <P></P>
892  finally start <em>a</em> again.  <DT><STRONG><A NAME="item_If_the_control_file_contains_a_depend_loop%2E">If the control file contains a depend loop.</A></STRONG><BR>
893  </dd>  <DD>
 <p></p>  
 <dt><strong><a name="item_if_c_does_not_run">If <em>c</em> does not run</a></strong><br />  
 </dt>  
 <dd>  
 When monit runs it will first stop <em>a</em> and <em>b</em> then start <em>c</em>  
 and finally start <em>b</em> then <em>a</em>.  
 </dd>  
 <p></p>  
 <dt><strong><a name="item_if_the_control_file_contains_a_depend_loop%2e">If the control file contains a depend loop.</a></strong><br />  
 </dt>  
 <dd>  
894  A depend loop is for example; a-&gt;b and b-&gt;a or a-&gt;b-&gt;c-&gt;a.  A depend loop is for example; a-&gt;b and b-&gt;a or a-&gt;b-&gt;c-&gt;a.
895  </dd>  <P>When monit starts it will check for any such loops and complain
 <dd>  
 <p>When monit starts it will check for any such loops and complain  
896  and exit if a loop was found. It will also exit with a complaint  and exit if a loop was found. It will also exit with a complaint
897  if a depend statement was used that does not point to any  if a depend statement was used that does not point to any process
898  processes in the controlfile.</p>  in the controlfile.</P>
899  </dd>  <P></P></DL>
900  <p></p></dl>  <P>
901  <p>  <HR>
902  </p>  <H1><A NAME="the run control file">THE RUN CONTROL FILE</A></H1>
903  <hr />  <P>The preferred way to set up monit is to write a <EM>.monitrc</EM> file
 <h1><a name="the_run_control_file">THE RUN CONTROL FILE</a></h1>  
 <p>The preferred way to set up monit is to write a <em>.monitrc</em> file  
904  in your home directory.  When there is a conflict between the  in your home directory.  When there is a conflict between the
905  command-line arguments and the arguments in this file, the  command-line arguments and the arguments in this file, the
906  command-line arguments take precedence. To protect the security  command-line arguments take precedence. To protect the security
907  of your control file and passwords the control file must have  of your control file and passwords the control file must have
908  permissions <em>no more than 0700</em> (u=xrw,g=,o=); monit will  permissions <EM>no more than 0700</EM> (u=xrw,g=,o=); monit will
909  complain and exit otherwise.</p>  complain and exit otherwise.</P>
910  <p>  <P>
911  </p>  <H2><A NAME="run control syntax">Run Control Syntax</A></H2>
912  <h2><a name="run_control_syntax">Run Control Syntax</a></h2>  <P>Comments begin with a '#' and extend through the end of the line.
 <p>Comments begin with a '#' and extend through the end of the line.  
913  Otherwise the file consists of a series of program entries or  Otherwise the file consists of a series of program entries or
914  global option statements in a free-format, token-oriented syntax.</p>  global option statements in a free-format, token-oriented syntax.</P>
915  <p>There are three kinds of tokens: grammar keywords, numbers (i.e.  <P>There are three kinds of tokens: grammar keywords, numbers (i.e.
916  decimal digit sequences) and strings. Strings can be either  decimal digit sequences) and strings. Strings can be either
917  quoted or unquoted. A quoted string is bounded by double quotes  quoted or unquoted. A quoted string is bounded by double quotes
918  and may contain whitespace (and quoted digits are treated as a  and may contain whitespace (and quoted digits are treated as a
919  string).  An unquoted string is any whitespace-delimited token,  string).  An unquoted string is any whitespace-delimited token,
920  containing characters and/or numbers.</p>  containing characters and/or numbers.</P>
921  <p>Each program entry consists of the keywords `check', followed by  <P>Each program entry consists of the keywords `check', followed by
922  a unique descriptive name for the program, which is again  a unique descriptive name for the program, which is again
923  followed by a path to the program's pidfile. A check entry can  followed by a path to the program's pidfile. A check entry can
924  have a number of optional statements. These statements are  have a number of optional statements. These statements are
925  described below and in the example section.</p>  described below and in the example section.</P>
926  <p>You can use noise keywords like 'if', `and', `with(in)', `has',  <P>You can use noise keywords like 'if', `and', `with(in)', `has',
927  `using', 'use', 'on(ly)' and `program' anywhere in an entry to  `using', 'use', 'on(ly)' and `program' anywhere in an entry to
928  make it resemble English. They're ignored, but can make entries  make it resemble English. They're ignored, but can make entries
929  much easier to read at a glance. The punctuation characters ';'  much easier to read at a glance. The punctuation characters ';'
930  ',' and '=' are also ignored. Keywords are case insensitive.</p>  ',' and '=' are also ignored. Keywords are case insensitive.</P>
931  <pre>  <PRE>
932   Here are the legal global keywords:</pre>   Here are the legal global keywords:</PRE>
933  <pre>  <PRE>
934   Keyword         Function   Keyword         Function
935   -----------------------------------------------------------   -----------------------------------------------------------
936   set daemon      Set a background poll interval in seconds   set daemon      Set a background poll interval in seconds
# Line 1152  much easier to read at a glance. The pun Line 945  much easier to read at a glance. The pun
945                   as the smtp-server for sending mail.                   as the smtp-server for sending mail.
946   set mail-format Set a global mail format for all alert   set mail-format Set a global mail format for all alert
947                   messages emitted by monit.                   messages emitted by monit.
948     set pidfile     Explicit set the location of the monit lock
949                     file. E.g. set pidfile /run/monit.pid.
950   set httpd port  Activates monit http server at the given   set httpd port  Activates monit http server at the given
951                   portnumber.                   portnumber.
952   ssl enable      Enables ssl support for the httpd server.   ssl enable      Enables ssl support for the httpd server.
# Line 1170  much easier to read at a glance. The pun Line 965  much easier to read at a glance. The pun
965                   a username and password allowed to connect                   a username and password allowed to connect
966                   to the server. More than one allow statement                   to the server. More than one allow statement
967                   are allowed. This statement is also an                   are allowed. This statement is also an
968                   optional part of the set httpd statement.</pre>                   optional part of the set httpd statement.</PRE>
969  <pre>  <PRE>
970   Here are the legal program entry keywords:</pre>   Here are the legal program entry keywords:</PRE>
971  <pre>  <PRE>
972   Keyword         Function   Keyword         Function
973   ------------------------------------------------------------   ------------------------------------------------------------
974   check           Starts an entry and must be followed by a   check           Starts an entry and must be followed by a
# Line 1221  much easier to read at a glance. The pun Line 1016  much easier to read at a glance. The pun
1016                   after the protocol keyword mentioned above.                   after the protocol keyword mentioned above.
1017                    - for http it can contain an URI and an                    - for http it can contain an URI and an
1018                      optional query string.                      optional query string.
1019                    - other protocols doesn't support this                    - other protocols does not support this
1020                      statement yet                      statement yet
1021   unix(socket)    Specifies a unix socket file and used like   unix(socket)    Specifies a unix socket file and used like
1022                   the port statement above to test a Unix                   the port statement above to test a Unix
# Line 1284  much easier to read at a glance. The pun Line 1079  much easier to read at a glance. The pun
1079                   action.  This statement is used to check the                   action.  This statement is used to check the
1080                   system load average over a number of cylces. If                   system load average over a number of cylces. If
1081                   the compare expression matches then the action                   the compare expression matches then the action
1082                   start, alert or stop is avtivated.</pre>                   start, alert or stop is avtivated.
 <pre>  
1083   depends (on)    Must be followed by the name of a process this   depends (on)    Must be followed by the name of a process this
1084                   process depends on to run before it starts.</pre>                   process depends on to run before it starts.</PRE>
1085  <p>Here's the complete list of reserved <strong>keywords</strong> used by monit:</p>  <P>Here's the complete list of reserved <STRONG>keywords</STRONG> used by monit:</P>
1086  <p><em>set</em>, <em>daemon</em>, <em>logfile</em>, <em>syslog</em>, <em>address</em>, <em>httpd</em>,  <P><EM>set</EM>, <EM>daemon</EM>, <EM>logfile</EM>, <EM>syslog</EM>, <EM>address</EM>, <EM>httpd</EM>,
1087  <em>ssl</em>, <em>enable</em>, <em>disable</em>, <em>pemfile</em>, <em>allow</em>, <em>check</em>,  <EM>ssl</EM>, <EM>enable</EM>, <EM>disable</EM>, <EM>pemfile</EM>, <EM>allow</EM>, <EM>check</EM>,
1088  <em>init</em>, <em>pidfile</em>, <em>group</em>, <em>start</em>, <em>stop</em>,  <EM>init</EM>, <EM>pidfile</EM>, <EM>group</EM>, <EM>start</EM>, <EM>stop</EM>,
1089  <em>port(number)</em>, <em>unix(socket)</em>, <em>type</em>, <em>proto(col)</em>, <em>tcp</em>,  <EM>port(number)</EM>, <EM>unix(socket)</EM>, <EM>type</EM>, <EM>proto(col)</EM>, <EM>tcp</EM>,
1090  <em>tcpssl</em>, <em>udp</em>, <em>alert</em>, <em>mail-format</em>, <em>restart</em>,  <EM>tcpssl</EM>, <EM>udp</EM>, <EM>alert</EM>, <EM>mail-format</EM>, <EM>restart</EM>,
1091  <em>timeout</em>, <em>checksum</em>, <em>resource</em>, <em>expect</em>, <em>mailserver</em>,  <EM>timeout</EM>, <EM>checksum</EM>, <EM>resource</EM>, <EM>expect</EM>, <EM>mailserver</EM>,
1092  <em>every</em>, <em>mode</em>, <em>active</em>, <em>passive</em>, <em>manual</em>, <em>depends</em>,  <EM>every</EM>, <EM>mode</EM>, <EM>active</EM>, <EM>passive</EM>, <EM>manual</EM>, <EM>depends</EM>,
1093  <em>host</em>, <em>default</em>, <em>http</em>, <em>ftp</em>, <em>smtp</em>, <em>pop</em>, <em>nntp</em>,  <EM>host</EM>, <EM>default</EM>, <EM>http</EM>, <EM>ftp</EM>, <EM>smtp</EM>, <EM>pop</EM>, <EM>nntp</EM>,
1094  <em>imap</em>, <em>ssh</em>, <em>dwp</em>, <em>ldap2</em>, <em>ldap3</em>, <em>request</em>,  <EM>imap</EM>, <EM>ssh</EM>, <EM>dwp</EM>, <EM>ldap2</EM>, <EM>ldap3</EM>, <EM>request</EM>,
1095  <em>cpuusage</em>, <em>memusage</em>, <em>memkbyte</em>, <em>loadavg</em>, <em>timestamp</em>,  <EM>cpuusage</EM>, <EM>memusage</EM>, <EM>memkbyte</EM>, <EM>loadavg</EM>, <EM>timestamp</EM>,
1096  <em>second(s)</em>, <em>minute(s)</em>, <em>hour(s)</em> and <em>day(s)</em>.</p>  <EM>second(s)</EM>, <EM>minute(s)</EM>, <EM>hour(s)</EM> and <EM>day(s)</EM>.</P>
1097  <p>And here is a complete list of <strong>noise keywords</strong> ignored by  <P>And here is a complete list of <STRONG>noise keywords</STRONG> ignored by
1098  monit:</p>  monit:</P>
1099  <p><em>if</em>, <em>is</em>, <em>are</em>, <em>on(ly)</em>, <em>with(in)</em>, <em>and</em>, <em>has</em>,  <P><EM>if</EM>, <EM>is</EM>, <EM>are</EM>, <EM>on(ly)</EM>, <EM>with(in)</EM>, <EM>and</EM>, <EM>has</EM>,
1100  <em>using</em>, <em>use</em>, <em>the</em>, <em>sum</em>, <em>restarts</em>, <em>program(s)</em>,  <EM>using</EM>, <EM>use</EM>, <EM>the</EM>, <EM>sum</EM>, <EM>restarts</EM>, <EM>program(s)</EM>,
1101  <em>cycle(s)</em>, <em>than</em>, <em>then</em>, <em>for</em>.</p>  <EM>cycle(s)</EM>, <EM>than</EM>, <EM>then</EM>, <EM>for</EM>.</P>
1102  <p><strong>Note:</strong> If the <em>start</em> or <em>stop</em> programs are shell scripts,  <P><STRONG>Note:</STRONG> If the <EM>start</EM> or <EM>stop</EM> programs are shell scripts,
1103  then the script must begin with <code>#!</code> and the remainder of the  then the script must begin with <CODE>#!</CODE> and the remainder of the
1104  first line must specify an interpreter for the  first line must specify an interpreter for the
1105  program. E.g. <code>#!/bin/sh</code></p>  program. E.g. <CODE>#!/bin/sh</CODE></P>
1106  <p>It's possible to write scripts directly into the <em>start</em> and  <P>It's possible to write scripts directly into the <EM>start</EM> and
1107  <em>stop</em> entries by using a string of shell-commands. Like:</p>  <EM>stop</EM> entries by using a string of shell-commands. Like:</P>
1108  <pre>  <PRE>
1109   start: &quot;/bin/sh -c { echo $$ &gt; pidfile; exec program }&quot;   start: &quot;/bin/sh -c { echo $$ &gt; pidfile; exec program }&quot;
1110   stop:  &quot;/bin/sh -c { kill -s SIGTERM `cat pidfile` }&quot;</pre>   stop:  &quot;/bin/sh -c { kill -s SIGTERM `cat pidfile` }&quot;</PRE>
1111  <p>  <P>
1112  </p>  <H2><A NAME="configuration examples">CONFIGURATION EXAMPLES</A></H2>
1113  <h2><a name="configuration_examples">CONFIGURATION EXAMPLES</a></h2>  <P>The simplest form is just the check statement. In this example we
1114  <p>The simplest form is just the check statement. In this example we  check to see if the server is running and log a message if not:</P>
1115  check to see if the server is running and log a message if not:</p>  <PRE>
1116  <pre>   check resin with pidfile /usr/local/resin/srun.pid</PRE>
1117   check resin with pidfile /usr/local/resin/srun.pid</pre>  <P>To have monit start the server if it's not running, add a start
1118  <p>To have monit start the server if it's not running, add a start  statement:</P>
1119  statement:</p>  <PRE>
 <pre>  
1120   check resin with pidfile /usr/local/resin/srun.pid   check resin with pidfile /usr/local/resin/srun.pid
1121     start program = &quot;/usr/local/resin/bin/srun.sh start&quot;</pre>     start program = &quot;/usr/local/resin/bin/srun.sh start&quot;</PRE>
1122  <p>Here's a more advanced example for monitoring an apache  <P>Here's a more advanced example for monitoring an apache
1123  web-server listening on the default portnumber for HTTP and  web-server listening on the default portnumber for HTTP and
1124  HTTPS. In this example monit will restart apache if it's not  HTTPS. In this example monit will restart apache if it's not
1125  accepting connections at the portnumbers. The method monit use  accepting connections at the portnumbers. The method monit use
1126  for a process restart is to first execute the stop-program, wait  for a process restart is to first execute the stop-program, wait
1127  for the process to stop and then execute the start-program.</p>  for the process to stop and then execute the start-program.</P>
1128  <pre>  <PRE>
1129   check apache with pidfile /var/run/httpd.pid   check apache with pidfile /var/run/httpd.pid
1130     start program = &quot;/etc/init.d/httpd start&quot;     start program = &quot;/etc/init.d/httpd start&quot;
1131     stop program  = &quot;/etc/init.d/httpd stop&quot;     stop program  = &quot;/etc/init.d/httpd stop&quot;
1132     port 80       port 80  
1133     port 443</pre>     port 443</PRE>
1134  <p>In this example we use udp for connection testing to check if the  <P>In this example we use udp for connection testing to check if the
1135  'named' service is running and also use timeout and alert:</p>  'named' service is running and also use timeout and alert:</P>
1136  <pre>  <PRE>
1137   check named with pidfile /var/run/named.pid   check named with pidfile /var/run/named.pid
1138     start program = &quot;/etc/init.d/named start&quot;     start program = &quot;/etc/init.d/named start&quot;
1139     stop program  = &quot;/etc/init.d/named stop&quot;     stop program  = &quot;/etc/init.d/named stop&quot;
1140     port 53 use type udp     port 53 use type udp
1141     timeout (3,5)     timeout (3,5)
1142     alert bofh@norid.no</pre>     alert bofh@norid.no</PRE>
1143  <p>The following example illustrate how to check if the service  <P>The following example illustrate how to check if the service
1144  'sophie' is answering connections on its unix domain socket:</p>  'sophie' is answering connections on its unix domain socket:</P>
1145  <pre>  <PRE>
1146   check sophie with pidfile /var/run/sophie.pid   check sophie with pidfile /var/run/sophie.pid
1147     start program = &quot;/etc/init.d/sophie start&quot;     start program = &quot;/etc/init.d/sophie start&quot;
1148     stop  program = &quot;/etc/init.d/sophie stop&quot;     stop  program = &quot;/etc/init.d/sophie stop&quot;
1149     unix /var/run/sophie</pre>     unix /var/run/sophie</PRE>
1150  <p>In this example we check an apache web-server running on  <P>In this example we check an apache web-server running on
1151  localhost that answers for several IP-based virtual hosts or  localhost that answers for several IP-based virtual hosts or
1152  vhosts, hence the host statement before port:</p>  vhosts, hence the host statement before port:</P>
1153  <pre>  <PRE>
1154   check apache with pidfile /var/run/httpd.pid   check apache with pidfile /var/run/httpd.pid
1155     start program = &quot;/etc/init.d/httpd start&quot;     start program = &quot;/etc/init.d/httpd start&quot;
1156     stop program  = &quot;/etc/init.d/httpd stop&quot;     stop program  = &quot;/etc/init.d/httpd stop&quot;
1157     host www.sol.no          port 80     host www.sol.no          port 80
1158     host shop.sol.no         port 443     host shop.sol.no         port 443
1159     host chat.sol.no         port 80     host chat.sol.no         port 80
1160     host www.tildeslash.com  port 80</pre>     host www.tildeslash.com  port 80</PRE>
1161  <p>In the following example we ask monit to compute and verify the  <P>In the following example we ask monit to compute and verify the
1162  checksum for the underlying apache binary used by the start and  checksum for the underlying apache binary used by the start and
1163  stop programs.</p>  stop programs.</P>
1164  <pre>  <PRE>
1165   check apache with pidfile /var/run/httpd.pid   check apache with pidfile /var/run/httpd.pid
1166     start program = &quot;/etc/init.d/httpd start&quot;     start program = &quot;/etc/init.d/httpd start&quot;
1167     stop program  = &quot;/etc/init.d/httpd stop&quot;     stop program  = &quot;/etc/init.d/httpd stop&quot;
1168     host www.tildeslash.com  port 80     host www.tildeslash.com  port 80
1169     checksum /usr/local/apache/bin/httpd</pre>     checksum /usr/local/apache/bin/httpd</PRE>
1170  <p>Some servers are slow starters, like for example Java based  <P>Some servers are slow starters, like for example Java based
1171  Application Servers. So if we want to keep the poll-cycle low  Application Servers. So if we want to keep the poll-cycle low
1172  (i.e. &lt; 60 seconds) but allow some programs to take its time to  (i.e. &lt; 60 seconds) but allow some programs to take its time to
1173  start, the <strong>every</strong> statement is handy:</p>  start, the <STRONG>every</STRONG> statement is handy:</P>
1174  <pre>  <PRE>
1175   check dynamo with pidfile /etc/dynamo.pid   check dynamo with pidfile /etc/dynamo.pid
1176     start program = &quot;/etc/init.d/dynamo start&quot;     start program = &quot;/etc/init.d/dynamo start&quot;
1177     stop program  = &quot;/etc/init.d/dynamo stop&quot;     stop program  = &quot;/etc/init.d/dynamo stop&quot;
1178     port 8840     port 8840
1179     every 2 cycle</pre>     every 2 cycle</PRE>
1180  <p>Here is an example where we group together two database entries.  <P>Here is an example where we group together two database entries.
1181  The mode statement is also illustrated in the first entry and  The mode statement is also illustrated in the first entry and
1182  have the effect that monit will not try to (re)start this program  have the effect that monit will not try to (re)start this program
1183  if it is not running:</p>  if it is not running:</P>
1184  <pre>  <PRE>
1185   check sybase with pidfile /var/run/sybase.pid   check sybase with pidfile /var/run/sybase.pid
1186     start program = &quot;/etc/init.d/sybase start&quot;     start program = &quot;/etc/init.d/sybase start&quot;
1187     stop program  = &quot;/etc/init.d/sybase stop&quot;     stop program  = &quot;/etc/init.d/sybase stop&quot;
1188     mode passive     mode passive
1189     group database</pre>     group database</PRE>
1190  <pre>  <PRE>
1191   check oracle with pidfile /var/run/oracle.pid   check oracle with pidfile /var/run/oracle.pid
1192     start program = &quot;/etc/init.d/oracle start&quot;     start program = &quot;/etc/init.d/oracle start&quot;
1193     stop program  = &quot;/etc/init.d/oracle stop&quot;     stop program  = &quot;/etc/init.d/oracle stop&quot;
1194     mode active # Not necessary really, since this is the default     mode active # Not necessary really, since this is the default
1195     port 9001     port 9001
1196     alert bofh@foo.bar     alert bofh@foo.bar
1197     group database</pre>     group database</PRE>
1198  <p>Here is an example to show the usage of the resource checks. It  <P>Here is an example to show the usage of the resource checks. It
1199  will send an alert when the CPU usage of the http daemon and it's  will send an alert when the CPU usage of the http daemon and it's
1200  child processes raises beyond 60% for over two cycles.  It is  child processes raises beyond 60% for over two cycles.  It is
1201  restarted when the CPU usage it over 80% for five cycles, the  restarted when the CPU usage it over 80% for five cycles, the
1202  memory usage over 100Mb for five cycles or if the machines load  memory usage over 100Mb for five cycles or if the machines load
1203  average is beyond 10 for 8 cycles:</p>  average is beyond 10 for 8 cycles:</P>
1204  <pre>  <PRE>
1205   check apache with pidfile /var/run/httpd.pid   check apache with pidfile /var/run/httpd.pid
1206     start program = &quot;/etc/init.d/httpd start&quot;     start program = &quot;/etc/init.d/httpd start&quot;
1207     stop program  = &quot;/etc/init.d/httpd stop&quot;     stop program  = &quot;/etc/init.d/httpd stop&quot;
1208     if cpuusage &gt; 60.0 for 2 cycles then alert     if cpuusage &gt; 60.0 for 2 cycles then alert
1209     if cpuusage &gt; 80.0 for 5 cycles then restart     if cpuusage &gt; 80.0 for 5 cycles then restart
1210     if memkbyte &gt; 100000 for 5 cycles then stop     if memkbyte &gt; 100000 for 5 cycles then stop
1211     if loadavg(5min) greater than 10.0 for 8 cycles then stop</pre>     if loadavg(5min) greater than 10.0 for 8 cycles then stop</PRE>
1212  <p>In this example we demonstrate usage of the extended alert  <P>In this example we demonstrate usage of the extended alert
1213  statement:</p>  statement:</P>
1214  <pre>  <PRE>
1215   check apache with pidfile /var/run/httpd.pid   check apache with pidfile /var/run/httpd.pid
1216     start program = &quot;/etc/init.d/httpd start&quot;     start program = &quot;/etc/init.d/httpd start&quot;
1217     stop program  = &quot;/etc/init.d/httpd stop&quot;     stop program  = &quot;/etc/init.d/httpd stop&quot;
# Line 1430  statement:</p> Line 1223  statement:</p>
1223       with mail-format {       with mail-format {
1224                from:     bofh@$HOST                from:     bofh@$HOST
1225                subject:  apache $EVENT                subject:  apache $EVENT
1226                message:  This event occurred on $HOST at $DATE.</pre>                message:  This event occurred on $HOST at $DATE.</PRE>
1227  <pre>  <PRE>
1228                Your faithful employee,                Your faithful employee,
1229                monit                monit
1230       }       }
1231     timeout (3, 5)     timeout (3, 5)
1232     group server</pre>     group server</PRE>
1233  <p>In this example, we demonstrate usage of the depend statement. In  <P>In this example, we demonstrate usage of the depend statement. In
1234  this case, we want to start oracle and apache. However, we've set  this case, we want to start oracle and apache. However, we've set
1235  up apache to use oracle as a backend, and if oracle is restarted,  up apache to use oracle as a backend, and if oracle is restarted,
1236  apache must be restarted as well.</p>  apache must be restarted as well.</P>
1237  <pre>  <PRE>
1238   check apache with pidfile /var/run/httpd.pid   check apache with pidfile /var/run/httpd.pid
1239     start program = &quot;/etc/init.d/httpd start&quot;     start program = &quot;/etc/init.d/httpd start&quot;
1240     stop  program = &quot;/etc/init.d/httpd stop&quot;     stop  program = &quot;/etc/init.d/httpd stop&quot;
1241     depends on oracle</pre>     depends on oracle</PRE>
1242  <pre>  <PRE>
1243   check oracle with pidfile /var/run/oracle.pid   check oracle with pidfile /var/run/oracle.pid
1244     start program = &quot;/etc/init.d/oracle start&quot;     start program = &quot;/etc/init.d/oracle start&quot;
1245     stop program  = &quot;/etc/init.d/oracle stop&quot;     stop program  = &quot;/etc/init.d/oracle stop&quot;
1246     port 9001</pre>     port 9001</PRE>
1247  <p>In the next example, we have a standard three tier setup with  <P>In the next example, we have a standard three tier setup with
1248  apache, an application server and a back end database server.  apache, an application server and a back end database server.
1249  Dependencies are setup so should oracle be restarted then both  Dependencies are setup so should oracle be restarted then both
1250  apache and the weblogic application server are also restarted.</p>  apache and the weblogic application server are also restarted.</P>
1251  <pre>  <PRE>
1252   check apache with pidfile /var/run/httpd.pid   check apache with pidfile /var/run/httpd.pid
1253     start program = &quot;/etc/init.d/httpd start&quot;     start program = &quot;/etc/init.d/httpd start&quot;
1254     stop  program = &quot;/etc/init.d/httpd stop&quot;     stop  program = &quot;/etc/init.d/httpd stop&quot;
1255     depends on weblogic</pre>     depends on weblogic</PRE>
1256  <pre>  <PRE>
1257   check weblogic with pidfile /var/run/weblogic.pid   check weblogic with pidfile /var/run/weblogic.pid
1258     start program = &quot;/etc/init.d/weblogic start&quot;     start program = &quot;/etc/init.d/weblogic start&quot;
1259     stop  program = &quot;/etc/init.d/weblogic stop&quot;     stop  program = &quot;/etc/init.d/weblogic stop&quot;
1260     depends on oracle</pre>     depends on oracle</PRE>
1261  <pre>  <PRE>
1262   check oracle with pidfile /var/run/oracle.pid   check oracle with pidfile /var/run/oracle.pid
1263     start program = &quot;/etc/init.d/oracle start&quot;     start program = &quot;/etc/init.d/oracle start&quot;
1264     stop program  = &quot;/etc/init.d/oracle stop&quot;     stop program  = &quot;/etc/init.d/oracle stop&quot;
1265     port 9001</pre>     port 9001</PRE>
1266  <p>Next, we have 2 programs oracle-import and oracle-export that  <P>Next, we have 2 programs oracle-import and oracle-export that
1267  need to be restarted if oracle is restarted, but are independent  need to be restarted if oracle is restarted, but are independent
1268  of each other.</p>  of each other.</P>
1269  <pre>  <PRE>
1270   check oracle with pidfile /var/run/oracle.pid   check oracle with pidfile /var/run/oracle.pid
1271     start program = &quot;/etc/init.d/oracle start&quot;     start program = &quot;/etc/init.d/oracle start&quot;
1272     stop program  = &quot;/etc/init.d/oracle stop&quot;     stop program  = &quot;/etc/init.d/oracle stop&quot;
1273     port 9001</pre>     port 9001</PRE>
1274  <pre>  <PRE>
1275   check oracle-import with pidfile /var/run/oracle-import.pid   check oracle-import with pidfile /var/run/oracle-import.pid
1276     start program = &quot;/etc/init.d/oracle-import start&quot;     start program = &quot;/etc/init.d/oracle-import start&quot;
1277     stop  program = &quot;/etc/init.d/oracle-import stop&quot;     stop  program = &quot;/etc/init.d/oracle-import stop&quot;
1278     depends on oracle</pre>     depends on oracle</PRE>
1279  <pre>  <PRE>
1280   check oracle-export with pidfile /var/run/oracle-export.pid   check oracle-export with pidfile /var/run/oracle-export.pid
1281     start program = &quot;/etc/init.d/oracle-export start&quot;     start program = &quot;/etc/init.d/oracle-export start&quot;
1282     stop  program = &quot;/etc/init.d/oracle-export stop&quot;     stop  program = &quot;/etc/init.d/oracle-export stop&quot;
1283     depends on oracle</pre>     depends on oracle</PRE>
1284  <p>Finally an example with all statements:</p>  <P>Finally an example with all statements:</P>
1285  <pre>  <PRE>
1286   check apache with pidfile /var/run/httpd.pid   check apache with pidfile /var/run/httpd.pid
1287     group server     group server
1288     start program = &quot;/etc/init.d/httpd start&quot;     start program = &quot;/etc/init.d/httpd start&quot;
# Line 1510  of each other.</p> Line 1303  of each other.</p>
1303     alert bofh@bar with mail-format {from: monit@foo.bar.no}     alert bofh@bar with mail-format {from: monit@foo.bar.no}
1304     every 2 cycles     every 2 cycles
1305     mode active     mode active
1306     depends on weblogic</pre>     depends on weblogic</PRE>
1307  <p>Note; only the <strong>check-</strong> and <strong>pidfile statement</strong> are mandatory,  <P>Note; only the <STRONG>check-</STRONG> and <STRONG>pidfile statement</STRONG> are mandatory,
1308  the other statements are optional and the order of the optional  the other statements are optional and the order of the optional
1309  statements is not important.</p>  statements is not important.</P>
1310  <p>  <P>
1311  </p>  <H2><A NAME="monit with heartbeat">Monit with Heartbeat</A></H2>
1312  <hr />  <P>The first thing to do is to install and configure <EM>heartbeat</EM>
1313  <h1><a name="files">FILES</a></h1>  <A HREF="http://www.linux-ha.org/download/.">http://www.linux-ha.org/download/.</A> It can be useful to have a
1314  <p><em>~/.monitrc</em>    look at The Heartbeat Getting Started Guide at:
1315     Default run control file</p>  <A HREF="http://www.linux-ha.org/GettingStarted.html">http://www.linux-ha.org/GettingStarted.html</A></P>
1316  <p><em>./monitrc</em>    <P><STRONG>Starting up a Node</STRONG></P>
1317    <P>This is the normal start sequence for a cluster-node. With this
1318    sequence, there should be no error-case, which is not handled
1319    either by heartbeat or monit. For example, if monit dies, initd
1320    restarts it. If heatbeat dies, monit restarts it. If the node
1321    dies, the heartbeat instance on the other node detects it and
1322    restart the services there.</P>
1323    <PRE>
1324     1) initd starts monit with group local
1325     2) monit starts heartbeat in local group
1326     3) heartbeat requests monit to start the node group
1327     4) monit starts the node group</PRE>
1328    <P><STRONG>Monit <EM>/etc/monitrc</EM></STRONG></P>
1329    <P>This example describe a cluster with 2 nodes. Services running on
1330    Node 1 are in the group <EM>node1</EM> and Node 2 services are in the
1331    group <EM>node2</EM>.</P>
1332    <P>The local group entries are mode <EM>active</EM>, the node group
1333    entries are mode <EM>manual</EM> and controlled by heartbeat.</P>
1334    <PRE>
1335     #
1336     # local services on every host
1337     #
1338     check heartbeat with pidfile /var/run/heartbeat.pid
1339           start program = &quot;/etc/init.d/heartbeat start&quot;
1340           stop  program = &quot;/etc/init.d/heartbeat start&quot;
1341           mode  active
1342           alert foo@bar
1343           group local</PRE>
1344    <PRE>
1345     check postfix with pidfile /var/spool/postfix/pid/master.pid
1346           start program = &quot;/etc/init.d/postfix start&quot;
1347           stop program  = &quot;/etc/init.d/postfix stop&quot;
1348           mode  active
1349           alert foo@bar
1350           group local</PRE>
1351    <PRE>
1352     #
1353     # node1 services
1354     #</PRE>
1355    <PRE>
1356     check apache with pidfile /var/apache/logs/httpd.pid
1357           start program = &quot;/etc/init.d/apache start&quot;
1358           stop program  = &quot;/etc/init.d/apache stop&quot;
1359           depends named
1360           alert foo@bar
1361           mode  manual
1362           group node1</PRE>
1363    <PRE>
1364     check named with pidfile /var/tmp/named.pid
1365           start program = &quot;/etc/init.d/named start&quot;
1366           stop program  = &quot;/etc/init.d/named stop&quot;
1367           alert foo@bar
1368           mode  manual
1369           group node1</PRE>
1370    <PRE>
1371     #
1372     # node2 services
1373     #</PRE>
1374    <PRE>
1375     check named-slave with pidfile /var/tmp/named-slave.pid
1376           start program = &quot;/etc/init.d/named-slave start&quot;
1377           stop program  = &quot;/etc/init.d/named-slave stop&quot;
1378           mode  manual
1379           alert foo@bar
1380           group node2</PRE>
1381    <PRE>
1382     check squid with pidfile /var/squid/logs/squid.pid
1383           start program = &quot;/etc/init.d/squid start&quot;
1384           stop program  = &quot;/etc/init.d/squid stop&quot;
1385           depends named-slave
1386           alert foo@bar
1387           mode  manual
1388           group node2</PRE>
1389    <P><STRONG>initd  <EM>/etc/inittab</EM></STRONG></P>
1390    <P>Monit is started on both nodes with initd. You will need to add
1391    an entry in <EM>/etc/inittab</EM> to start monit with the same local
1392    group heartbeat is member of.</P>
1393    <PRE>
1394     #/etc/inittab
1395     mo:2345:respawn:/usr/local/bin/monit -i -d 10 -c /etc/monitrc -g local</PRE>
1396    <P><STRONG>heartbeat  <EM>/etc/ha.d/haresources</EM></STRONG></P>
1397    <P>When heartbeat starts, heartbeat look up the node entry and start
1398    the script <EM>/etc/init.d/monit-node1</EM> or
1399    <EM>/etc/init.d/monit-node2</EM>. The script calls monit to start the
1400    specific group per node.</P>
1401    <PRE>
1402     # /etc/ha.d/haresources
1403     node1 IPaddr::172.16.100.1  monit-node1
1404     node2 IPaddr::172.16.100.2  monit-node2</PRE>
1405    <P><STRONG><EM>/etc/init.d/monit-node1</EM></STRONG></P>
1406    <PRE>
1407     #!/bin/bash
1408     #
1409     # sample script for starting/stopping all services on node1
1410     #
1411     prog=&quot;/usr/local/bin/monit -g node1&quot;
1412     start()
1413     {
1414           echo -n $&quot;Starting $prog:&quot;
1415           $prog start
1416           echo
1417     }</PRE>
1418    <PRE>
1419     stop()
1420     {
1421           echo -n $&quot;Stopping $prog:&quot;
1422           $prog stop
1423           echo
1424     }
1425    </PRE>
1426    <PRE>
1427    
1428     case &quot;$1&quot; in
1429           start)
1430                start;;
1431           stop)
1432                stop;;
1433           *)
1434                echo $&quot;Usage: $0 {start|stop}&quot;
1435                RETVAL=1
1436     esac
1437     exit $RETVAL</PRE>
1438    <P>
1439    <HR>
1440    <H1><A NAME="files">FILES</A></H1>
1441    <P><EM>~/.monitrc</EM>  
1442       Default run control file</P>
1443    <P><EM>./monitrc</EM>  
1444     If the control file is not found in the default     If the control file is not found in the default
1445     location, and the current working directory     location, and the current working directory
1446     contains a <em>monitrc</em> file, this file is used     contains a <EM>monitrc</EM> file, this file is used
1447     instead.</p>     instead.</P>
1448  <p><em>/etc/monitrc</em>  <P><EM>/etc/monitrc</EM>
1449     If the control file is not found in either of the     If the control file is not found in either of the
1450     previous two locations, and /etc contains a     previous two locations, and /etc contains a
1451     <em>monitrc</em> file, this file will be used instead.</p>     <EM>monitrc</EM> file, this file will be used instead.</P>
1452  <p><em>~/.monitrc.pid</em>  <P><EM>~/.monitrc.pid</EM>
1453     Lock file to help prevent concurrent runs (non-root     Lock file to help prevent concurrent runs (non-root
1454     mode).</p>     mode).</P>
1455  <p><em>/var/run/monit.pid</em>  <P><EM>/var/run/monit.pid</EM>
1456     Lock file to help prevent concurrent runs (root mode,     Lock file to help prevent concurrent runs (root mode,
1457     Linux systems).</p>     Linux systems).</P>
1458  <p><em>/etc/monit.pid</em>  <P><EM>/etc/monit.pid</EM>
1459     Lock file to help prevent concurrent runs (root mode,     Lock file to help prevent concurrent runs (root mode,
1460     systems without /var/run).</p>     systems without /var/run).</P>
1461  <p>  <P>
1462  </p>  <HR>
1463  <hr />  <H1><A NAME="signals">SIGNALS</A></H1>
1464  <h1><a name="signals">SIGNALS</a></h1>  <P>If a monit daemon is running, SIGUSR1 wakes it up from its sleep
 <p>If a monit daemon is running, SIGUSR1 wakes it up from its sleep  
1465  phase and forces a poll of all processes. SIGTERM will gracefully  phase and forces a poll of all processes. SIGTERM will gracefully
1466  terminate a monit daemon. This signal is sent to a monit daemon  terminate a monit daemon. This signal is sent to a monit daemon
1467  if monit is started with the <em>quit</em> action argument.</p>  if monit is started with the <EM>quit</EM> action argument.</P>
1468  <p>Sending a SIGHUP signal to a running monit daemon will force  <P>Sending a SIGHUP signal to a running monit daemon will force
1469  the daemon to reinitialize itself, specifically it will reread  the daemon to reinitialize itself, specifically it will reread
1470  configuration, close and reopen log files.</p>  configuration, close and reopen log files.</P>
1471  <p>Running monit in foreground while a background monit daemon is  <P>Running monit in foreground while a background monit daemon is
1472  running will wake up the daemon.</p>  running will wake up the daemon.</P>
1473  <p>  <P>
1474  </p>  <HR>
1475  <hr />  <H1><A NAME="notes">NOTES</A></H1>
1476  <h1><a name="notes">NOTES</a></h1>  <P>This is a very silent program. Use the -v switch if you want to
1477  <p>This is a very silent program. Use the -v switch if you want to  see what monit is doing, and tail -f the logfile.</P>
1478  see what monit is doing, and tail -f the logfile.</p>  <P>The syntax (and parser) of the control file is inspired by Eric
 <p>The syntax (and parser) of the control file is inspired by Eric  
1479  S. Raymond et al. excellent fetchmail program. Some portions of  S. Raymond et al. excellent fetchmail program. Some portions of
1480  this man page does also receive inspiration from the same  this man page does also receive inspiration from the same
1481  authors.</p>  authors.</P>
1482  <p>  <P>
1483  </p>  <HR>
1484  <hr />  <H1><A NAME="authors">AUTHORS</A></H1>
1485  <h1><a name="authors">AUTHORS</a></h1>  <P>Jan-Henrik Haukeland &lt;<A HREF="mailto:hauk@tildeslash.com">hauk@tildeslash.com</A>&gt;,
1486  <p>Jan-Henrik Haukeland &lt;<a href="mailto:hauk@tildeslash.com">hauk@tildeslash.com</a>&gt;,  Martin Pala &lt;<A HREF="mailto:martin.pala@iol.cz">martin.pala@iol.cz</A>&gt;,
1487  Martin Pala &lt;<a href="mailto:martin.pala@iol.cz">martin.pala@iol.cz</a>&gt;,  Christian Hopp &lt;<A HREF="mailto:chopp@iei.tu-clausthal.de">chopp@iei.tu-clausthal.de</A>&gt;,
1488  Christian Hopp &lt;<a href="mailto:chopp@iei.tu-clausthal.de">chopp@iei.tu-clausthal.de</a>&gt;,  Rory Toma &lt;<A HREF="mailto:rory@digeo.com">rory@digeo.com</A>&gt;</P>
1489  Rory Toma &lt;<a href="mailto:rory@digeo.com">rory@digeo.com</a>&gt;</p>  <P>See also <A HREF="http://www.tildeslash.com/monit/who.html">http://www.tildeslash.com/monit/who.html</A></P>
1490  <p>See also <a href="http://www.tildeslash.com/monit/who.html">http://www.tildeslash.com/monit/who.html</a>  <P>
1491    <HR>
1492  </p>  <H1><A NAME="copyright">COPYRIGHT</A></H1>
1493  <p>  <P>Copyright (C) 2000-2003 by Contributors to the monit codebase. All
 </p>  
 <hr />  
 <h1><a name="copyright">COPYRIGHT</a></h1>  
 <p>Copyright (C) 2000-2003 by Contributors to the monit codebase. All  
1494  Rights Reserved. This product is distributed in the hope that it  Rights Reserved. This product is distributed in the hope that it
1495  will be useful, but WITHOUT any warranty; without even the  will be useful, but WITHOUT any warranty; without even the
1496  implied warranty of MERCHANTABILITY or FITNESS for a particular  implied warranty of MERCHANTABILITY or FITNESS for a particular
1497  purpose.  purpose.</P>
1498    <P>
1499  </p>  <HR>
1500  <p>  <H1><A NAME="see also">SEE ALSO</A></H1>
1501  </p>  <P>GNU text utilities;  md5sum(1);  <CODE>openssl(1)</CODE></P>
 <hr />  
 <h1><a name="see_also">SEE ALSO</a></h1>  
 <p>GNU text utilities;  md5sum(1);  <code>openssl(1)</code>  
   
   
 </p>  
1502    
1503  </body>  </BODY>
1504    
1505  </html>  </HTML>

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26