/[monit]/monit/web/doc/manual.php
ViewVC logotype

Diff of /monit/web/doc/manual.php

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

revision 1.6 by martinp, Wed Apr 13 20:46:24 2005 UTC revision 1.7 by martinp, Mon Sep 19 19:53:38 2005 UTC
# Line 8  Line 8 
8    
9  <h2>Manual</h2>  <h2>Manual</h2>
10    
11  <p>Updated for release 4.5.1  <p>Updated for release 4.6
12    
13    
14  <p><a name="__index__"></a></p>  <p><a name="__index__"></a></p>
# Line 40  Line 40 
40                  <li><a href="#setting_a_local_alert_statement">Setting a local alert statement</a></li>                  <li><a href="#setting_a_local_alert_statement">Setting a local alert statement</a></li>
41                  <li><a href="#alert_message_layout">Alert message layout</a></li>                  <li><a href="#alert_message_layout">Alert message layout</a></li>
42                  <li><a href="#setting_a_global_mail_format">Setting a global mail format</a></li>                  <li><a href="#setting_a_global_mail_format">Setting a global mail format</a></li>
43                    <li><a href="#setting_a_error_reminder">Setting a error reminder</a></li>
44                  <li><a href="#setting_a_mail_server_for_alert_messages">Setting a mail server for alert messages</a></li>                  <li><a href="#setting_a_mail_server_for_alert_messages">Setting a mail server for alert messages</a></li>
45          </ul>          </ul>
46    
# Line 52  Line 53 
53                  <li><a href="#timestamp_testing">TIMESTAMP TESTING</a></li>                  <li><a href="#timestamp_testing">TIMESTAMP TESTING</a></li>
54                  <li><a href="#file_size_testing">FILE SIZE TESTING</a></li>                  <li><a href="#file_size_testing">FILE SIZE TESTING</a></li>
55                  <li><a href="#space_testing">SPACE TESTING</a></li>                  <li><a href="#space_testing">SPACE TESTING</a></li>
56                    <li><a href="#space_testing">SPACE TESTING</a></li>
57                  <li><a href="#inode_testing">INODE TESTING</a></li>                  <li><a href="#inode_testing">INODE TESTING</a></li>
58                  <li><a href="#permission_testing">PERMISSION TESTING</a></li>                  <li><a href="#permission_testing">PERMISSION TESTING</a></li>
59                  <li><a href="#uid_testing">UID TESTING</a></li>                  <li><a href="#uid_testing">UID TESTING</a></li>
# Line 516  monitored object changed. This involves: Line 518  monitored object changed. This involves:
518  <pre>  <pre>
519   o A file checksum changed   o A file checksum changed
520   o A file size changed   o A file size changed
521     o A file content match
522   o A file/directory timestamp changed</pre>   o A file/directory timestamp changed</pre>
523  <p>You should use an alert statement to notify monit that you want  <p>You should use an alert statement to notify monit that you want
524  alert messages sent to an email address. If you do not specify an  alert messages sent to an email address. If you do not specify an
# Line 530  addresses. (Just to make it clear, in ca Line 533  addresses. (Just to make it clear, in ca
533  business idea; monit is not suitable for sending spam).</p>  business idea; monit is not suitable for sending spam).</p>
534  <p>Recipients in the global and in the local lists are alerted when  <p>Recipients in the global and in the local lists are alerted when
535  an failed, recovery or changed event occurs. If the same email  an failed, recovery or changed event occurs. If the same email
536  address is in the global and in the local list, monit will still  address is in the global and in the local list, monit will send
537  only send one alert. Local (per service) defined alert email addresses  only one alert. Local (per service) defined alert email addresses
538  override global addresses in case of a conflict. Finally, you may  override global addresses in case of a conflict. Finally, you may
539  choose to only use a global alert list, a local per service list  choose to only use a global alert list, a local per service list
540  or both.</p>  or both.</p>
# Line 544  are in capital):</p> Line 547  are in capital):</p>
547  alert to recipients in the global list which have registred  alert to recipients in the global list which have registred
548  interest for the event type.</p>  interest for the event type.</p>
549  <dl>  <dl>
550  <dt><strong><a name="item_set_alert_mail_2daddress__5b_7bevents_7d_5d__5bmai">SET ALERT mail-address [{events}] [MAIL-FORMAT {mail-format}]</a></strong><br />  <dt><strong><a name="item_set_alert_mail_2daddress__5b_7bevents_7d_5d__5bmai">SET ALERT mail-address [{events}] [MAIL-FORMAT {mail-format}] [REMINDER number]</a></strong><br />
551  </dt>  </dt>
552  </dl>  </dl>
553  <p>Simply using the following in the global section of monitrc:</p>  <p>Simply using the following in the global section of monitrc:</p>
# Line 559  or service does exist (on recovery) and Line 562  or service does exist (on recovery) and
562  <h2><a name="setting_a_local_alert_statement">Setting a local alert statement</a></h2>  <h2><a name="setting_a_local_alert_statement">Setting a local alert statement</a></h2>
563  <p>Each service can have its own recipient list.</p>  <p>Each service can have its own recipient list.</p>
564  <dl>  <dl>
565  <dt><strong><a name="item_alert_mail_2daddress__5b_7bevents_7d_5d__5bmail_2d">ALERT mail-address [{events}] [MAIL-FORMAT {mail-format}]</a></strong><br />  <dt><strong><a name="item_alert_mail_2daddress__5b_7bevents_7d_5d__5bmail_2d">ALERT mail-address [{events}] [MAIL-FORMAT {mail-format}] [REMINDER number]</a></strong><br />
566  </dt>  </dt>
567  </dl>  </dl>
568  <p>If you only want an alert message sent for certain events for  <p>If you only want an alert message sent for certain events for
# Line 601  event occurs.</p> Line 604  event occurs.</p>
604                  timeout                  timeout
605                  resource                  resource
606                  checksum                  checksum
607                    match
608                  timestamp                  timestamp
609                  connection                  connection
610                  permission}</pre>                  permission}</pre>
# Line 681  are fixed and are: Line 685  are fixed and are:
685   EVENT_GID        &quot;GID failed&quot;             &quot;GID passed&quot;   EVENT_GID        &quot;GID failed&quot;             &quot;GID passed&quot;
686   EVENT_ICMP       &quot;ICMP failed&quot;            &quot;ICMP passed&quot;   EVENT_ICMP       &quot;ICMP failed&quot;            &quot;ICMP passed&quot;
687   EVENT_INVALID    &quot;Invalid type&quot;           &quot;Type passed&quot;   EVENT_INVALID    &quot;Invalid type&quot;           &quot;Type passed&quot;
688     EVENT_MATCH      &quot;Regex match&quot;            &quot;No regex match&quot;
689   EVENT_NONEXIST   &quot;Does not exist&quot;         &quot;Exists&quot;   EVENT_NONEXIST   &quot;Does not exist&quot;         &quot;Exists&quot;
690   EVENT_PERMISSION &quot;Permission failed&quot;      &quot;Permission passed&quot;   EVENT_PERMISSION &quot;Permission failed&quot;      &quot;Permission passed&quot;
691   EVENT_RESOURCE   &quot;Resource limit matched&quot; &quot;Resource limit passed&quot;   EVENT_RESOURCE   &quot;Resource limit matched&quot; &quot;Resource limit passed&quot;
# Line 705  fixed and are: Line 710  fixed and are:
710  <pre>  <pre>
711   ACTION_ALERT     &quot;alert&quot;   ACTION_ALERT     &quot;alert&quot;
712   ACTION_EXEC      &quot;exec&quot;   ACTION_EXEC      &quot;exec&quot;
713     ACTION_MONITOR   &quot;monitor&quot;
714   ACTION_RESTART   &quot;restart&quot;   ACTION_RESTART   &quot;restart&quot;
715   ACTION_START     &quot;start&quot;   ACTION_START     &quot;start&quot;
716   ACTION_STOP      &quot;stop&quot;   ACTION_STOP      &quot;stop&quot;
# Line 713  fixed and are: Line 719  fixed and are:
719  <p>  <p>
720  </p>  </p>
721  <h2><a name="setting_a_global_mail_format">Setting a global mail format</a></h2>  <h2><a name="setting_a_global_mail_format">Setting a global mail format</a></h2>
722  <p>Finally, it is possible to set a standard mail format with the  <p>It is possible to set a standard mail format with the
723  following global set-statement (keywords are in capital):</p>  following global set-statement (keywords are in capital):</p>
724  <dl>  <dl>
725  <dt><strong><a name="item_set_mail_2dformat__7bmail_2dformat_7d">SET MAIL-FORMAT {mail-format}</a></strong><br />  <dt><strong><a name="item_set_mail_2dformat__7bmail_2dformat_7d">SET MAIL-FORMAT {mail-format}</a></strong><br />
# Line 727  for messages sent by monit, like so:</p> Line 733  for messages sent by monit, like so:</p>
733   set mail-format { from: monit@foo.bar.no }</pre>   set mail-format { from: monit@foo.bar.no }</pre>
734  <p>  <p>
735  </p>  </p>
736    <h2><a name="setting_a_error_reminder">Setting a error reminder</a></h2>
737    <p>Monit by default sends just one error notification when the
738    service failed and another one when it has recovered. If you want
739    to be notified more then once in the case that the service remains
740    failed, you can use reminder option of alert statement (keywords
741    are in capital):</p>
742    <dl>
743    <dt><strong><a name="item_alert__2e_2e_2e__5bwith_5d_reminder__5bon_5d_numbe">ALERT ... [WITH] REMINDER [ON] number [CYCLES]</a></strong><br />
744    </dt>
745    </dl>
746    <p>For example if you want to be notified each tenth cycle when the
747    service remains failed, you can use:</p>
748    <pre>
749      alert foo@bar with remainder on 10 cycles</pre>
750    <p>If you want to be notified each failed cycle, you can use:</p>
751    <pre>
752      alert foo@bar with remainder on 1 cycle</pre>
753    <p>
754    </p>
755  <h2><a name="setting_a_mail_server_for_alert_messages">Setting a mail server for alert messages</a></h2>  <h2><a name="setting_a_mail_server_for_alert_messages">Setting a mail server for alert messages</a></h2>
756  <p>The mail server monit should use to send alert messages is  <p>The mail server monit should use to send alert messages is
757  defined with a global set statement (keywords are in capital and  defined with a global set statement (keywords are in capital and
# Line 796  the service again.</p> Line 821  the service again.</p>
821  </p>  </p>
822  <hr />  <hr />
823  <h1><a name="service_tests">SERVICE TESTS</a></h1>  <h1><a name="service_tests">SERVICE TESTS</a></h1>
824  <p>Monit provides several tests you may utilize in a service  <p>Monit provides several tests you may utilize in a service entry
825  entry to test a service. Basicaly here are two classes of tests:  to test a service. Basicaly here are two classes of tests:
826  variable and constant object tests.</p>  variable and constant object tests.</p>
827  <p>Constant object tests are related to failed/passed state.  <p>Constant object tests are related to failed/passed state.  In the
828  In the case of error, monit will watch whether the failed  case of error, monit will watch whether the failed parameter will
829  parameter will recover - in such case it will handle recovery  recover - in such case it will handle recovery related
830  related action. General format:</p>  action. General format:</p>
831  <dl>  <dl>
832  <dt><strong><a name="item_if__3ctest_3e_then_action__5belse_if_recovered_the">IF &lt;TEST&gt; THEN ACTION [ELSE IF RECOVERED THEN ACTION]</a></strong><br />  <dt><strong><a name="item_if__3ctest_3e__5b_5b_3cx_3e_5d__5btimes_within_5d_">IF &lt;TEST&gt; [[&lt;X&gt;] [TIMES WITHIN] &lt;Y&gt; CYCLES] THEN ACTION
833           [ELSE IF RECOVERED [[&lt;X&gt;] [TIMES WITHIN] &lt;Y&gt; CYCLES] THEN ACTION]</a></strong><br />
834  </dt>  </dt>
835  </dl>  </dl>
836  <p>For constant object tests if the &lt;TEST&gt; should validate to true,  <p>For constant object tests if the &lt;TEST&gt; should validate to true,
837  then the selected action is executed each cycle the condition remains  then the selected action is executed each cycle the condition
838  true. The value for comparision is constant. Recovery action is  remains true. The value for comparision is constant. Recovery
839  evalueated only once (on failed-&gt;recovered state change only). The  action is evalueated only once (on failed-&gt;recovered state change
840  'ELSE IF RECOVERED' part is optional - if omitted, monit will do alert  only). The 'ELSE IF RECOVERED' part is optional - if omitted,
841  action on recovery by default. The alert is delivered once on each  monit will do alert action on recovery by default. The alert is
842  state change regardless of state change direction).</p>  delivered only once on each state change unless overriden by
843  <p>Variable object tests beggins with 'IF CHANGED' statement and serves  'reminder' alert option.</p>
844  for monitoring of object, which property can change legaly - monit  <p>Variable object tests beggins with 'IF CHANGED' statement and
845  watches whether the value will change again. You can use it just  serves for monitoring of object, which property can change legaly
846  for alert or to involve some automatic action, as for example to  - monit watches whether the value will change again. You can use
847  reload monitored process after its configuration file was changed.  it just for alert or to involve some automatic action, as for
848  Variable tests are supported for 'checksum', 'size', 'pid, 'ppid'  example to reload monitored process after its configuration file
849  and 'timestamp' tests only, if you consider that other tests can  was changed.  Variable tests are supported for 'checksum',
850  be useful in variable form too, please let us know.</p>  'size', 'pid, 'ppid' and 'timestamp' tests only, if you consider
851  <dl>  that other tests can be useful in variable form too, please let
852  <dt><strong><a name="item_if_changed__3ctest_3e_then_action">IF CHANGED &lt;TEST&gt; THEN ACTION</a></strong><br />  us know.</p>
853  </dt>  <dl>
854  </dl>  <dt><strong><a name="item_if_changed__3ctest_3e__5b_5b_3cx_3e_5d__5btimes_wi">IF CHANGED &lt;TEST&gt; [[&lt;X&gt;] [TIMES WITHIN] &lt;Y&gt; CYCLES] THEN ACTION</a></strong><br />
855  <p>For variable object tests if the &lt;TEST&gt; should validate to true, then  </dt>
856  the selected action is executed once and monit will watch for another  </dl>
857  change. The value for comparision is variable - the last result becomes  <p>For variable object tests if the &lt;TEST&gt; should validate to true,
858  actual value, which is compared in future cycles. The alert is delivered  then the selected action is executed once and monit will watch
859  each time the condition becomes true.</p>  for another change. The value for comparision is variable - the
860    last result becomes actual value, which is compared in future
861    cycles. The alert is delivered each time the condition becomes
862    true.</p>
863    <p>You can restrict the event ratio needed to change the state:</p>
864    <dl>
865    <dt><strong><a name="item__2e_2e_2e__5b_5b_3cx_3e_5d__5btimes_within_5d__3cy">... [[&lt;X&gt;] [TIMES WITHIN] &lt;Y&gt; CYCLES] ...</a></strong><br />
866    </dt>
867    </dl>
868    <p>This part is optional and is supported by all testing rules.
869    It defines how many event occurences during how many cycles
870    are needed to trigger the following action. You can use it
871    in several ways - the core syntax is:</p>
872    <pre>
873     [&lt;X&gt;] &lt;Y&gt; CYCLES</pre>
874    <p>It is possible to use filling words which give the rule better
875    first-sight sense. You can use any filling words such as: FOR,
876    TIMES, WITHIN, thus for example:</p>
877    <pre>
878     if failed port 80 for 3 times within 5 cycles then alert</pre>
879    <p>or</p>
880    <pre>
881     if failed port 80 for 10 cycles then unmonitor</pre>
882    <p>When you don't specify the &lt;X&gt;, it equals to &lt;Y&gt; by default,
883    thus the rule applies when &lt;Y&gt; consecutive cycles of inverse
884    event occured (relatively to the current service state).</p>
885    <p>When you omit it at all, monit will by default change state
886    on first inverse event, which is equivalent to this notation:</p>
887    <pre>
888     1 times within 1 cycles</pre>
889    <p>It is possible to use this option for failed, passed/recovered
890    or changed rules. More complex examples:</p>
891    <pre>
892     check device rootfs with path /dev/hda1
893      if space usage &gt; 80% 5 times within 15 cycles then alert else if passed for 10 cycles then alert
894      if space usage &gt; 90% for 5 cycles then exec '/try/to/free/the/space'
895      if space usage &gt; 99% then exec '/stop/processess'</pre>
896    <p>Note that the maximal cycles count which can be used in the rule
897    is limited by the size of 'long long' data type on your platform.
898    This provides 64 cycles on usual platforms currently. In the case
899    that you use unsupported value, the configuration parser will
900    tell you the limits during monit startup.</p>
901  <p>You must select an action to be executed from this list:</p>  <p>You must select an action to be executed from this list:</p>
902  <ul>  <ul>
903  <li></li>  <li></li>
# Line 848  and then the service's start method. Line 915  and then the service's start method.
915  start method <em>and</em> send an alert.  start method <em>and</em> send an alert.
916  <p></p>  <p></p>
917  <li></li>  <li></li>
918  <strong>STOP</strong> stops the service by calling the service's registered stop  <strong>STOP</strong> stops the service by calling the service's registered
919  method <em>and</em> send an alert. If monit stops a service it will not  stop method <em>and</em> send an alert. If monit stops a service it
920  be checked by monit anymore nor restarted again later. To  will not be checked by monit anymore nor restarted again
921  reactivate monitoring of the service again you must explicitly  later. To reactivate monitoring of the service again you must
922  enable monitoring from the web interface or from the console,  explicitly enable monitoring from the web interface or from the
923  e.g. 'monit monitor apache'.  console, e.g. 'monit monitor apache'.
924  <p></p>  <p></p>
925  <li></li>  <li></li>
926  <strong>EXEC</strong> may be used to execute an arbitrary program <em>and</em> send  <strong>EXEC</strong> may be used to execute an arbitrary program <em>and</em> send
# Line 872  all programs executed by monit will be s Line 939  all programs executed by monit will be s
939  privileges unless the uid and gid extension was used.</p>  privileges unless the uid and gid extension was used.</p>
940  <p></p>  <p></p>
941  <li></li>  <li></li>
942    <strong>MONITOR</strong> will enable monitoring of the service <em>and</em> send
943    an alert.
944    <p></p>
945    <li></li>
946  <strong>UNMONITOR</strong> will disable monitoring of the service <em>and</em> send  <strong>UNMONITOR</strong> will disable monitoring of the service <em>and</em> send
947  an alert. The service will not be checked by monit anymore nor  an alert. The service will not be checked by monit anymore nor
948  restarted again later.  To reactivate monitoring of the service  restarted again later.  To reactivate monitoring of the service
# Line 892  load.</p> Line 963  load.</p>
963  testing is as follows (keywords are in capital and optional  testing is as follows (keywords are in capital and optional
964  statements in [brackets]),</p>  statements in [brackets]),</p>
965  <dl>  <dl>
966  <dt><strong><a name="item_if_resource_operator_value__5bcycles_5d_then_actio">IF resource operator value [cycles] THEN action  <dt><strong><a name="item_if_resource_operator_value__5b_5b_3cx_3e_5d__3cy_3">IF resource operator value [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
967        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
968  </dt>  </dt>
969  </dl>  </dl>
970  <p><em>resource</em> is a choice of ``CPU'', ``MEMORY'', ``CHILDREN'',  <p><em>resource</em> is a choice of ``CPU'', ``MEMORY'', ``CHILDREN'',
# Line 909  processes in either percent or as an amo Line 980  processes in either percent or as an amo
980  <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.
981  The load average is the number of processes in the system run  The load average is the number of processes in the system run
982  queue, averaged over the specified time period.</p>  queue, averaged over the specified time period.</p>
983  <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,
984  ``lt'', ``eq'', ``ne'' in shell sh notation and ``greater'', ``less'',  ``gt'', ``lt'', ``eq'', ``ne'' in shell sh notation and ``greater'',
985  ``equal'', ``notequal'' in human readable form (if not specified,  ``less'', ``equal'', ``notequal'' in human readable form (if not
986  default is EQUAL).</p>  specified, default is EQUAL).</p>
987  <p><em>value</em> is either an integer or a real number (except for  <p><em>value</em> is either an integer or a real number (except for
988  CHILDREN). For CPU, MEMORY and TOTALMEMORY you need to specify a  CHILDREN). For CPU, MEMORY and TOTALMEMORY you need to specify a
989  <em>unit</em>.  This could be ``%'' or if applicable ``B'' (Byte), ``kB''  <em>unit</em>.  This could be ``%'' or if applicable ``B'' (Byte), ``kB''
990  (1024 Byte), ``MB'' (1024 KiloByte) or ``GB'' (1024 MegaByte).</p>  (1024 Byte), ``MB'' (1024 KiloByte) or ``GB'' (1024 MegaByte).</p>
 <p><em>cycles</em> is the maximum number of cycles the expression above  
 has to be true in order to start an action. To specify the number  
 of cycles you must state a number followed by the keyword CYCLES.  
 If <em>cycles</em> is omitted then the default is one cycle.</p>  
991  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
992  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
993  <p>To calculate the cycles, a counter is raised whenever the  <p>To calculate the cycles, a counter is raised whenever the
994  expression above is true and it is lowered whenever it is false  expression above is true and it is lowered whenever it is false
995  (but not below 0). All counters are reset in case of a restart.</p>  (but not below 0). All counters are reset in case of a restart.</p>
# Line 941  a md5 or sha1 checksum for a file.</p> Line 1008  a md5 or sha1 checksum for a file.</p>
1008  <p>The checksum test in constant form is used to verify that a  <p>The checksum test in constant form is used to verify that a
1009  file does not change. Syntax (keywords are in capital):</p>  file does not change. Syntax (keywords are in capital):</p>
1010  <dl>  <dl>
1011  <dt><strong><a name="item_if_failed__5bmd5_7csha1_5d_checksum__5bexpect_chec">IF FAILED [MD5|SHA1] CHECKSUM [EXPECT checksum] THEN action  <dt><strong><a name="item_if_failed__5bmd5_7csha1_5d_checksum__5bexpect_chec">IF FAILED [MD5|SHA1] CHECKSUM [EXPECT checksum] [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
1012        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1013  </dt>  </dt>
1014  </dl>  </dl>
1015  <p>The checksum test in variable form is used to watch for  <p>The checksum test in variable form is used to watch for
1016  file changes. Syntax (keywords are in capital):</p>  file changes. Syntax (keywords are in capital):</p>
1017  <dl>  <dl>
1018  <dt><strong><a name="item_if_changed__5bmd5_7csha1_5d_checksum_then_action">IF CHANGED [MD5|SHA1] CHECKSUM THEN action</a></strong><br />  <dt><strong><a name="item_if_changed__5bmd5_7csha1_5d_checksum__5b_5b_3cx_3e">IF CHANGED [MD5|SHA1] CHECKSUM [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action</a></strong><br />
1019  </dt>  </dt>
1020  </dl>  </dl>
1021  <p>The choice of MD5 or SHA1 is optional. MD5 features a 256 bit  <p>The choice of MD5 or SHA1 is optional. MD5 features a 256 bit
1022  and SHA1 a 320 bit checksum. If this option is omitted monit  and SHA1 a 320 bit checksum. If this option is omitted monit
1023  tries to guess the method from the EXPECT string or uses MD5 as  tries to guess the method from the EXPECT string or uses MD5 as
1024  default.</p>  default.</p>
1025  <p><em>expect</em> is optional and if used it specifies a md5 or sha1  <p><em>expect</em> is optional and if used it specifies a md5 or sha1
1026  string monit should expect when testing a file's checksum.  string monit should expect when testing a file's checksum. If
1027  If <em>expect</em> is used, monit will not compute an initial checksum  <em>expect</em> is used, monit will not compute an initial checksum for
1028  for the file, but instead use the string you submit. For example:</p>  the file, but instead use the string you submit. For example:</p>
1029  <pre>  <pre>
1030   if failed checksum and   if failed checksum and
1031      expect the sum 8f7f419955cefa0b33a2ba316cba3659      expect the sum 8f7f419955cefa0b33a2ba316cba3659
# Line 967  for the file, but instead use the string Line 1034  for the file, but instead use the string
1034  <em>sha1sum(1)</em> to create a checksum string for a file and  <em>sha1sum(1)</em> to create a checksum string for a file and
1035  use this string in the expect-statement.</p>  use this string in the expect-statement.</p>
1036  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1037  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1038  <p>The checksum statement in variable form may be used to check  <p>The checksum statement in variable form may be used to check a
1039  a file for changes and if changed, do a specified action.  file for changes and if changed, do a specified action.  For
1040  For instance to reload a server if its configuration file  instance to reload a server if its configuration file was
1041  was changed. The following illustrate this for the apache  changed. The following illustrate this for the apache web server:</p>
 web server:</p>  
1042  <pre>  <pre>
1043   check file httpd.conf path /usr/local/apache/conf/httpd.conf   check file httpd.conf path /usr/local/apache/conf/httpd.conf
1044       if changed sha1 checksum       if changed sha1 checksum
# Line 988  the HTTP protocol. See the CONNECTION TE Line 1054  the HTTP protocol. See the CONNECTION TE
1054  </p>  </p>
1055  <h2><a name="timestamp_testing">TIMESTAMP TESTING</a></h2>  <h2><a name="timestamp_testing">TIMESTAMP TESTING</a></h2>
1056  <p>The timestamp statement may only be used in a file or directory  <p>The timestamp statement may only be used in a file or directory
1057  service entry. If specified in the control file, monit will compute  service entry. If specified in the control file, monit will
1058  a timestamp for a file or directory.</p>  compute a timestamp for a file or directory.</p>
1059  <p>The timestamp test in constant form is used to verify various  <p>The timestamp test in constant form is used to verify various
1060  timestamp conditions. Syntax (keywords are in capital):</p>  timestamp conditions. Syntax (keywords are in capital):</p>
1061  <dl>  <dl>
1062  <dt><strong><a name="item_if_timestamp__5b_5boperator_5d_value__5bunit_5d_5d">IF TIMESTAMP [[operator] value [unit]] THEN action  <dt><strong><a name="item_if_timestamp__5b_5boperator_5d_value__5bunit_5d_5d">IF TIMESTAMP [[operator] value [unit]] [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
1063        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1064  </dt>  </dt>
1065  </dl>  </dl>
1066  <p>The timestamp statement in variable form is simply to test an  <p>The timestamp statement in variable form is simply to test an
1067  existing file or directory for timestamp changes and if changed,  existing file or directory for timestamp changes and if changed,
1068  execute an action. Syntax (keywords are in capital):</p>  execute an action. Syntax (keywords are in capital):</p>
1069  <dl>  <dl>
1070  <dt><strong><a name="item_if_changed_timestamp_then_action">IF CHANGED TIMESTAMP THEN action</a></strong><br />  <dt><strong><a name="item_if_changed_timestamp__5b_5b_3cx_3e_5d__3cy_3e_cycl">IF CHANGED TIMESTAMP [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action</a></strong><br />
1071  </dt>  </dt>
1072  </dl>  </dl>
1073  <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,
1074  ``LT'', ``EQ'', ``NE'' in shell sh notation and ``GREATER'', ``LESS'',  ``GT'', ``LT'', ``EQ'', ``NE'' in shell sh notation and ``GREATER'',
1075  ``EQUAL'', ``NOTEQUAL'' in human readable form (if not specified,  ``LESS'', ``EQUAL'', ``NOTEQUAL'' in human readable form (if not
1076  default is EQUAL).</p>  specified, default is EQUAL).</p>
1077  <p><em>value</em> is a time watermark.</p>  <p><em>value</em> is a time watermark.</p>
1078  <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
1079  possible to use ``SECONDS'', ``MINUTES'', ``HOURS'', or ``DAYS'').</p>  possible to use ``SECONDS'', ``MINUTES'', ``HOURS'', or ``DAYS'').</p>
1080  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1081  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1082  <p>The variable timestamp statement is useful for checking a file for  <p>The variable timestamp statement is useful for checking a file for
1083  changes and then execute an action. This version was written  changes and then execute an action. This version was written
1084  particularly with configuration files in mind. For instance, if  particularly with configuration files in mind. For instance, if
# Line 1068  for a file.</p> Line 1134  for a file.</p>
1134  <p>The size test in constant form is used to verify various  <p>The size test in constant form is used to verify various
1135  size conditions. Syntax (keywords are in capital):</p>  size conditions. Syntax (keywords are in capital):</p>
1136  <dl>  <dl>
1137  <dt><strong><a name="item_if_size__5b_5boperator_5d_value__5bunit_5d_5d_then">IF SIZE [[operator] value [unit]] THEN action  <dt><strong><a name="item_if_size__5b_5boperator_5d_value__5bunit_5d_5d__5b_">IF SIZE [[operator] value [unit]] [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
1138        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1139  </dt>  </dt>
1140  </dl>  </dl>
1141  <p>The size statement in variable form is simply to test an  <p>The size statement in variable form is simply to test an existing
1142  existing file for size changes and if changed, execute an  file for size changes and if changed, execute an action. Syntax
1143  action. Syntax (keywords are in capital):</p>  (keywords are in capital):</p>
1144  <dl>  <dl>
1145  <dt><strong><a name="item_if_changed_size_then_action">IF CHANGED SIZE THEN action</a></strong><br />  <dt><strong><a name="item_if_changed_size__5b_5b_3cx_3e_5d__3cy_3e_cycles_5d">IF CHANGED SIZE [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action</a></strong><br />
1146  </dt>  </dt>
1147  </dl>  </dl>
1148  <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,
1149  ``LT'', ``EQ'', ``NE'' in shell sh notation and ``GREATER'', ``LESS'',  ``GT'', ``LT'', ``EQ'', ``NE'' in shell sh notation and ``GREATER'',
1150  ``EQUAL'', ``NOTEQUAL'' in human readable form (if not specified,  ``LESS'', ``EQUAL'', ``NOTEQUAL'' in human readable form (if not
1151  default is EQUAL).</p>  specified, default is EQUAL).</p>
1152  <p><em>value</em> is a size watermark.</p>  <p><em>value</em> is a size watermark.</p>
1153  <p><em>unit</em> is a choice of ``B'',``KB'',``MB'',``GB'' or long alternatives  <p><em>unit</em> is a choice of ``B'',``KB'',``MB'',``GB'' or long alternatives
1154  ``byte'', ``kilobyte'', ``megabyte'', ``gigabyte''. If it is not specified,  ``byte'', ``kilobyte'', ``megabyte'', ``gigabyte''. If it is not
1155  ``byte'' unit is assumed by default.</p>  specified, ``byte'' unit is assumed by default.</p>
1156  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1157  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1158  <p>The variable size test form is useful for checking a file for  <p>The variable size test form is useful for checking a file for
1159  changes and send an alert or execute an action. Monit will  changes and send an alert or execute an action. Monit will
1160  register the size of the file at startup and monitor the file for  register the size of the file at startup and monitor the file for
1161  changes. As soon as the value changed, monit will do specified  changes. As soon as the value changed, monit will do specified
1162  action, reset the registered value to new result and continue  action, reset the registered value to new result and continue to
1163  to monitor, whether the size changed again.</p>  monitor, whether the size changed again.</p>
1164  <p>One example of use for this statement is to conduct security checks,  <p>One example of use for this statement is to conduct security checks,
1165  for instance:</p>  for instance:</p>
1166  <pre>  <pre>
# Line 1107  you plan to use monit for security reaso Line 1173  you plan to use monit for security reaso
1173  use this test in combination with other supported tests like  use this test in combination with other supported tests like
1174  checksum, timestamp, and so on.</p>  checksum, timestamp, and so on.</p>
1175  <p>The constant size test form may be useful in similar or different  <p>The constant size test form may be useful in similar or different
1176  contexts. It can, for instance, be used to test if a certain  contexts. It can, for instance, be used to test if a certain file
1177  file size was exceeded and then alert you or monit may execute  size was exceeded and then alert you or monit may execute a
1178  a certain action specified by you. An example is to use this  certain action specified by you. An example is to use this
1179  statement to rotate log files after they have reached a certain  statement to rotate log files after they have reached a certain
1180  size or to check that a database file does not grow beyond a  size or to check that a database file does not grow beyond a
1181  specified threshold.</p>  specified threshold.</p>
# Line 1139  dependent):</p> Line 1205  dependent):</p>
1205  <p>  <p>
1206  </p>  </p>
1207  <h2><a name="space_testing">SPACE TESTING</a></h2>  <h2><a name="space_testing">SPACE TESTING</a></h2>
1208    <p>The match statement allows to check lines of file content against
1209    a regular expression (regex).  In case of a match a action like
1210    an alarm is triggered.  Syntax (keywords are in capital):</p>
1211    <dl>
1212    <dt><strong><a name="item_if__5bnot_5d_match__7bregex_7cpath_7d__5b_5b_3cx_3">IF [NOT] MATCH {regex|path} [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action</a></strong><br />
1213    </dt>
1214    </dl>
1215    <p><em>regex</em> is a string containing the extended regular expression.
1216    See also regex(7).</p>
1217    <p><em>path</em> is an absolute path to a file containing extended
1218    regular expression on every line. See also regex(7).</p>
1219    <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1220    ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1221    <p>You can use the <em>NOT</em> statement to invert a match.</p>
1222    <p>The content is only being checked every cycle.  If content is
1223    being added and removed during between two check they are
1224    unnoticed.</p>
1225    <p>On startup the read position is the file end.  Upon file size
1226    decrease and inode change the read position is set to the file
1227    start.</p>
1228    <p>Only lines ending with a newline character are inspected.  Thus,
1229    lines are being ignored until they have been completed with this
1230    character.</p>
1231    <p>Only the first 511 characters of a line are inspected any
1232    following is omitted.</p>
1233    <dl>
1234    <dt><strong><a name="item_ignore__5bnot_5d_match__7bregex_7cpath_7d">IGNORE [NOT] MATCH {regex|path}</a></strong><br />
1235    </dt>
1236    </dl>
1237    <p>Lines matching an <em>IGNORE</em> are not inspected for later matches.
1238    <em>IGNORE MATCH</em> has always precedence over <em>IF MATCH</em>.</p>
1239    <p>In first all <em>IGNORE MATCH</em> statements are evaluated in the
1240    order of there appearance.  In second all <em>IF MATCH</em> statements
1241    are evaluated.</p>
1242    <p>A real life example might look like this:</p>
1243    <pre>
1244      check file syslog with path /var/log/syslog
1245        ignore match
1246            &quot;^\w{3} [ :0-9]{11} [._[:alnum:]-]+ monit\[[0-9]+\]:&quot;
1247        ignore match /etc/monit/syslog.regex.ignore
1248        if match
1249            &quot;^\w{3} [ :0-9]{11} [._[:alnum:]-]+ mrcoffee\[[0-9]+\]:&quot;
1250        if match /etc/monit/syslog.regex.alert then alert</pre>
1251    <p>
1252    </p>
1253    <h2><a name="space_testing">SPACE TESTING</a></h2>
1254  <p>Monit can test devices/file systems and check for space  <p>Monit can test devices/file systems and check for space
1255  usage. This test may only be used within a device service entry  usage. This test may only be used within a device service entry
1256  in the monit control file.</p>  in the monit control file.</p>
# Line 1159  list the reserved blocks for the superus Line 1271  list the reserved blocks for the superus
1271  tunefs on solaris to change values on a live filesystem.</p>  tunefs on solaris to change values on a live filesystem.</p>
1272  <p>The full syntax for the space statement is:</p>  <p>The full syntax for the space statement is:</p>
1273  <dl>  <dl>
1274  <dt><strong><a name="item_if_space_operator_value_unit_then_action__5belse_i">IF SPACE operator value unit THEN action  <dt><strong><a name="item_if_space_operator_value_unit__5b_5b_3cx_3e_5d__3cy">IF SPACE operator value unit [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
1275        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1276  </dt>  </dt>
1277  </dl>  </dl>
1278  <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'',
# Line 1171  default is EQUAL).</p> Line 1283  default is EQUAL).</p>
1283  alternatives ``byte'', ``kilobyte'', ``megabyte'', ``gigabyte'',  alternatives ``byte'', ``kilobyte'', ``megabyte'', ``gigabyte'',
1284  ``percent''.</p>  ``percent''.</p>
1285  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1286  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1287  <p>  <p>
1288  </p>  </p>
1289  <h2><a name="inode_testing">INODE TESTING</a></h2>  <h2><a name="inode_testing">INODE TESTING</a></h2>
# Line 1184  in active mode. If monit runs in passive Line 1296  in active mode. If monit runs in passive
1296  methods is not defined, monit will just send an error alert.</p>  methods is not defined, monit will just send an error alert.</p>
1297  <p>The syntax for the inode statement is:</p>  <p>The syntax for the inode statement is:</p>
1298  <dl>  <dl>
1299  <dt><strong><a name="item_inode">IF <code>INODE(S)</code> operator value [unit] THEN action  <dt><strong><a name="item_inode">IF <code>INODE(S)</code> operator value [unit] [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
1300        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1301  </dt>  </dt>
1302  </dl>  </dl>
1303  <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'',
# Line 1196  default is EQUAL).</p> Line 1308  default is EQUAL).</p>
1308  count of inodes. You can use the ``%'' character or the longer  count of inodes. You can use the ``%'' character or the longer
1309  alternative ``percent'' as a unit.</p>  alternative ``percent'' as a unit.</p>
1310  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1311  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1312  <p>  <p>
1313  </p>  </p>
1314  <h2><a name="permission_testing">PERMISSION TESTING</a></h2>  <h2><a name="permission_testing">PERMISSION TESTING</a></h2>
# Line 1205  devices. This test may only be used with Line 1317  devices. This test may only be used with
1317  device service entry in the monit control file.</p>  device service entry in the monit control file.</p>
1318  <p>The syntax for the permission statement is:</p>  <p>The syntax for the permission statement is:</p>
1319  <dl>  <dl>
1320  <dt><strong><a name="item_perm">IF FAILED <code>PERM(ISSION)</code> octalnumber THEN action  <dt><strong><a name="item_perm">IF FAILED <code>PERM(ISSION)</code> octalnumber [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
1321        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1322  </dt>  </dt>
1323  </dl>  </dl>
1324  <p><em>octalnumber</em> defines permissions for a file, a directory or a  <p><em>octalnumber</em> defines permissions for a file, a directory or a
1325  device.</p>  device.</p>
1326  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1327  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1328  <p>The web interface will show a permission warning if the test  <p>The web interface will show a permission warning if the test
1329  failed.</p>  failed.</p>
1330  <p>We recommend that you use the UNMONITOR action in a permission  <p>We recommend that you use the UNMONITOR action in a permission
# Line 1234  and devices. This test may only be used Line 1346  and devices. This test may only be used
1346  or device service entry in the monit control file.</p>  or device service entry in the monit control file.</p>
1347  <p>The syntax for the uid statement is:</p>  <p>The syntax for the uid statement is:</p>
1348  <dl>  <dl>
1349  <dt><strong><a name="item_if_failed_uid_user_then_action__5belse_if_recovere">IF FAILED UID user THEN action  <dt><strong><a name="item_if_failed_uid_user__5b_5b_3cx_3e_5d__3cy_3e_cycles">IF FAILED UID user [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
1350        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1351  </dt>  </dt>
1352  </dl>  </dl>
1353  <p><em>user</em> defines a user id either in numeric or in string form.</p>  <p><em>user</em> defines a user id either in numeric or in string form.</p>
1354  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1355  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1356  <p>The web interface will show a uid warning if the test should  <p>The web interface will show a uid warning if the test should
1357  fail.</p>  fail.</p>
1358  <p>We recommend that you use the UNMONITOR action in a uid  <p>We recommend that you use the UNMONITOR action in a uid
# Line 1262  and devices. This test may only be used Line 1374  and devices. This test may only be used
1374  or device service entry in the monit control file.</p>  or device service entry in the monit control file.</p>
1375  <p>The syntax for the gid statement is:</p>  <p>The syntax for the gid statement is:</p>
1376  <dl>  <dl>
1377  <dt><strong><a name="item_if_failed_gid_user_then_action__5belse_if_recovere">IF FAILED GID user THEN action  <dt><strong><a name="item_if_failed_gid_user__5b_5b_3cx_3e_5d__3cy_3e_cycles">IF FAILED GID user [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action
1378        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1379  </dt>  </dt>
1380  </dl>  </dl>
1381  <p><em>user</em> defines a group id either in numeric or in string form.</p>  <p><em>user</em> defines a group id either in numeric or in string form.</p>
1382  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1383  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1384  <p>The web interface will show a gid warning if the test should  <p>The web interface will show a gid warning if the test should
1385  fail.</p>  fail.</p>
1386  <p>We recommend that you use the UNMONITOR action in a gid  <p>We recommend that you use the UNMONITOR action in a gid
# Line 1292  default.</p> Line 1404  default.</p>
1404  be used within a process service entry in the monit control file).</p>  be used within a process service entry in the monit control file).</p>
1405  <p>The syntax for the pid statement is:</p>  <p>The syntax for the pid statement is:</p>
1406  <dl>  <dl>
1407  <dt><strong><a name="item_if_changed_pid_then_action">IF CHANGED PID THEN action</a></strong><br />  <dt><strong><a name="item_if_changed_pid__5b_5b_3cx_3e_5d__3cy_3e_cycles_5d_">IF CHANGED PID [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action</a></strong><br />
1408  </dt>  </dt>
1409  </dl>  </dl>
1410  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1411  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1412  <p>This test is useful to detect possible process restarts which  <p>This test is useful to detect possible process restarts which
1413  has occured in the timeframe between two monit testing cycles.  has occured in the timeframe between two monit testing cycles.
1414  In the case that the restart was fast and the process provides  In the case that the restart was fast and the process provides
# Line 1326  failure by default.</p> Line 1438  failure by default.</p>
1438  be used within a process service entry in the monit control file).</p>  be used within a process service entry in the monit control file).</p>
1439  <p>The syntax for the ppid statement is:</p>  <p>The syntax for the ppid statement is:</p>
1440  <dl>  <dl>
1441  <dt><strong><a name="item_if_changed_ppid_then_action">IF CHANGED PPID THEN action</a></strong><br />  <dt><strong><a name="item_if_changed_ppid__5b_5b_3cx_3e_5d__3cy_3e_cycles_5d">IF CHANGED PPID [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action</a></strong><br />
1442  </dt>  </dt>
1443  </dl>  </dl>
1444  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1445  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1446  <p>This test is useful to detect possible process parent change.  <p>This test is useful to detect possible process parent change.
1447  This may happen normaly only in the case that the process parent  This may happen normaly only in the case that the process parent
1448  exited.</p>  exited.</p>
# Line 1358  as follows (keywords are in capital and Line 1470  as follows (keywords are in capital and
1470  [brackets]),</p>  [brackets]),</p>
1471  <dl>  <dl>
1472  <dt><strong><a name="item_if_failed__5bhost_5d_port__5btype_5d__5bprotocol_7">IF FAILED [host] port [type]  <dt><strong><a name="item_if_failed__5bhost_5d_port__5btype_5d__5bprotocol_7">IF FAILED [host] port [type]
1473           [protocol|{send/expect}+] [timeout]           [protocol|{send/expect}+] [timeout] [[&lt;X&gt;] &lt;Y&gt; CYCLES]
1474        THEN action        THEN action
1475        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1476  </dt>  </dt>
1477  </dl>  </dl>
1478  <p>or for Unix sockets,</p>  <p>or for Unix sockets,</p>
1479  <dl>  <dl>
1480  <dt><strong><a name="item_if_failed__5bunixsocket_5d__5btype_5d__5bprotocol_">IF FAILED [unixsocket] [type]  <dt><strong><a name="item_if_failed__5bunixsocket_5d__5btype_5d__5bprotocol_">IF FAILED [unixsocket] [type]
1481            [protocol|{send/expect}+] [timeout]            [protocol|{send/expect}+] [timeout] [[&lt;X&gt;] &lt;Y&gt; CYCLES]
1482         THEN action         THEN action
1483        [ELSE IF RECOVERED THEN action]</a></strong><br />        [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</a></strong><br />
1484  </dt>  </dt>
1485  </dl>  </dl>
1486  <p><strong>host:HOST hostname</strong>. Optionally specify the host to connect  <p><strong>host:HOST hostname</strong>. Optionally specify the host to connect
# Line 1402  options are:</p> Line 1514  options are:</p>
1514  monit should speak when a connection is established. At the  monit should speak when a connection is established. At the
1515  moment monit knows how to speak <em>HTTP</em>, <em>SMTP</em>, <em>FTP</em>, <em>POP</em>,  moment monit knows how to speak <em>HTTP</em>, <em>SMTP</em>, <em>FTP</em>, <em>POP</em>,
1516  <em>IMAP</em>, <em>MYSQL</em>, <em>NTP3</em>, <em>NNTP</em>, <em>SSH</em>, <em>DWP</em>, <em>LDAP2</em>, <em>LDAP3</em>,  <em>IMAP</em>, <em>MYSQL</em>, <em>NTP3</em>, <em>NNTP</em>, <em>SSH</em>, <em>DWP</em>, <em>LDAP2</em>, <em>LDAP3</em>,
1517  <em>RDATE</em>, <em>DNS</em> and <em>RSYNC</em> and if you have compiled monit with ssl  <em>RDATE</em>, <em>DNS</em>, <em>POSTFIX-POLICY</em>, <em>APACHE-STATUS</em> and <em>RSYNC</em>
1518  support, monit can also speak <em>HTTPS</em>, <em>FTPS</em>, <em>POPS</em> and  and if you have compiled monit with ssl support, monit can also
1519  <em>IMAPS</em>. If the server's protocol is not found in this list,  speak <em>HTTPS</em>, <em>FTPS</em>, <em>POPS</em> and <em>IMAPS</em>. If the server's
1520  simply do not specify the protocol and monit will utilize a  protocol is not found in this list, simply do not specify the
1521  default test, including testing if it is possible to read and  protocol and monit will utilize a default test, including testing
1522  write to the port. This default test is in most cases more than  if it is possible to read and write to the port. This default test
1523  good enough to deduce if the server behind the port is up or not.  is in most cases more than good enough to deduce if the server
1524  The protocol statement is:</p>  behind the port is up or not.</p>
1525    <p>The protocol statement is:</p>
1526  <pre>  <pre>
1527   [PROTO(COL) {name} [REQUEST {&quot;/path&quot;} [with CHECKSUM checksum]]</pre>   [PROTO(COL) {name} [REQUEST {&quot;/path&quot;} [with CHECKSUM checksum]]</pre>
1528  <p>As you can see, you may specify a request after the protocol, at  <p>As you can see, you may specify a request after the protocol, at
# Line 1490  connect to the server within this time i Line 1603  connect to the server within this time i
1603  connection failed and execute the specified action. The default  connection failed and execute the specified action. The default
1604  connect timeout is 5 seconds.</p>  connect timeout is 5 seconds.</p>
1605  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',  <p><em>action</em> is a choice of ``ALERT'', ``RESTART'', ``START'', ``STOP'',
1606  ``EXEC'' or ``UNMONITOR''.</p>  ``EXEC'', ``MONITOR'' or ``UNMONITOR''.</p>
1607  <p>  <p>
1608  </p>  </p>
1609  <h4><a name="connection_testing_using_the_url_notation">Connection testing using the URL notation</a></h4>  <h4><a name="connection_testing_using_the_url_notation">Connection testing using the URL notation</a></h4>
# Line 1502  in capital and optional statements in [b Line 1615  in capital and optional statements in [b
1615  <pre>  <pre>
1616    IF FAILED URL ULR-spec    IF FAILED URL ULR-spec
1617       [CONTENT {==|!=} &quot;regular-expression&quot;]       [CONTENT {==|!=} &quot;regular-expression&quot;]
1618       [TIMEOUT number SECONDS]       [TIMEOUT number SECONDS] [[&lt;X&gt;] &lt;Y&gt; CYCLES]
1619       THEN action       THEN action
1620       [ELSE IF RECOVERED THEN action]</pre>       [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</pre>
1621  <p>Where URL-spec is an URL on the standard form as specified in RFC  <p>Where URL-spec is an URL on the standard form as specified in RFC
1622  2396:</p>  2396:</p>
1623  <pre>  <pre>
# Line 1545  to create a raw socket.</p> Line 1658  to create a raw socket.</p>
1658  is as follows (keywords are in capital and optional statements in  is as follows (keywords are in capital and optional statements in
1659  [brackets]):</p>  [brackets]):</p>
1660  <pre>  <pre>
1661    IF FAILED ICMP TYPE ECHO [WITH] [TIMEOUT number SECONDS]    IF FAILED ICMP TYPE ECHO
1662         [COUNT number] [WITH] [TIMEOUT number SECONDS] [[&lt;X&gt;] &lt;Y&gt; CYCLES]
1663       THEN action       THEN action
1664       [ELSE IF RECOVERED THEN action]</pre>       [ELSE IF RECOVERED [[&lt;X&gt;] &lt;Y&gt; CYCLES] THEN action]</pre>
1665  <p>The rules for action and timeout are the same as those mentioned  <p>The rules for action and timeout are the same as those mentioned
1666  above in the CONNECTION TESTING section. An icmp ping test is  above in the CONNECTION TESTING section. The count parameter
1667  useful for testing if a host is up, before testing ports at the  specifies how many consecutive echo requests will be send to the
1668  host. If an icmp ping test is used in a check host entry, this  host in one cycle. In the case that no reply came within timeout
1669  test is run first and if the ping test should fail we assume that  frame, monit reports error. When at least one reply was received,
1670  the connection to the host is down and monit does <em>not</em> continue  the test will pass. Monit sends by default three echo requests in
1671  to test any ports. Here's an example:</p>  one cycle to prevent the random packet loss from generating false
1672    alarm (i.e. up to 66% packet loss is tolerated). You can set the
1673    count option to different value, which can serve as error ratio.
1674    For example in the case that you require 100% ping success, you
1675    can set the count to 1 (i.e. just one attempt will be send, when
1676    the packet was lost, then error will be reported).</p>
1677    <p>An icmp ping test is useful for testing if a host is up, before
1678    testing ports at the host. If an icmp ping test is used in a check
1679    host entry, this test is run first and if the ping test should fail
1680    we assume that the connection to the host is down and monit does
1681    <em>not</em> continue to test any ports. Here's an example:</p>
1682  <pre>  <pre>
1683   check host xyzzy with address xyzzy.org   check host xyzzy with address xyzzy.org
1684         if failed icmp type echo with timeout 15 seconds         if failed icmp type echo count 5 with timeout 15 seconds
1685            then alert            then alert
1686         if failed port 80 proto http then alert         if failed port 80 proto http then alert
1687         if failed port 443 type TCPSSL proto http then alert         if failed port 443 type TCPSSL proto http then alert
# Line 2261  insensitive.</p> Line 2385  insensitive.</p>
2385   proto(col)      This keyword specifies the type of service   proto(col)      This keyword specifies the type of service
2386                   found at the port. monit knows at the moment                   found at the port. monit knows at the moment
2387                   how to speak HTTP, SMTP, FTP, POP, IMAP, MYSQL,                   how to speak HTTP, SMTP, FTP, POP, IMAP, MYSQL,
2388                   NNTP, SSH, DWP, LDAP2, LDAP3, RDATE, NTP3, DNS and                   NNTP, SSH, DWP, LDAP2, LDAP3, RDATE, NTP3, DNS,
2389                   RSYNC.  You're welcome to write new protocol test                   POSTFIX-POLICY, APACHE-STATUS and RSYNC.  You're
2390                   modules.  If no protocol is specified monit will                   welcome to write new protocol test modules. If no
2391                   use a def- ault test which in most cases are good                   protocol is specified monit will use a default
2392                   enough.                   test which in most cases are good enough.
2393   request         Specifies a server request and must come   request         Specifies a server request and must come
2394                   after the protocol keyword mentioned above.                   after the protocol keyword mentioned above.
2395                    - for http it can contain an URL and an                    - for http it can contain an URL and an
# Line 2337  insensitive.</p> Line 2461  insensitive.</p>
2461                   monit's control otherwise the service isn't                   monit's control otherwise the service isn't
2462                   monitored.                   monitored.
2463   cpu             Must be followed by a compare operator, a number   cpu             Must be followed by a compare operator, a number
2464                   with &quot;%&quot;, optionally a maximum number of cycles                   with &quot;%&quot; and an action. This statement is used
2465                   and an action. This statement is used to check                   to check the cpu usage in percent of a process
2466                   the cpu usage in percent of a process with its                   with its children over a number of cycles. If
2467                   children over a number of cycles.  If the                   the compare expression matches then the specified
                  compare expression matches then the specified  
2468                   action is executed.                   action is executed.
2469   mem             The equivalent to the cpu token for memory of a   mem             The equivalent to the cpu token for memory of a
2470                   process (w/o children!).  This token must be                   process (w/o children!).  This token must be
2471                   followed by a compare operator a number with                   followed by a compare operator a number with
2472                   unit {B|KB|MB|GB|%|byte|kilobyte|megabyte|                   unit {B|KB|MB|GB|%|byte|kilobyte|megabyte|
2473                   gigabyte|percent}, optionally a maximum number                   gigabyte|percent} and an action.
                  of cycles and an action.  
2474   loadavg         Must be followed by [1min,5min,15min] in (), a   loadavg         Must be followed by [1min,5min,15min] in (), a
2475                   compare operator, a number, optionally a maximum                   compare operator, a number and an action. This
2476                   number of cycles and an action.  This statement                   statement is used to check the system load average
2477                   is used to check the system load average over a                   over a number of cycles. If the compare expression
                  number of cycles. If the compare expression  
2478                   matches then the specified action is executed.                   matches then the specified action is executed.
2479   children        This is the number of child processes spawn by a   children        This is the number of child processes spawn by a
2480                   process. The syntax is the same as above.                   process. The syntax is the same as above.
# Line 2377  insensitive.</p> Line 2498  insensitive.</p>
2498  <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>
2499  <p><em>if</em>, <em>then</em>, <em>else</em>, <em>set</em>, <em>daemon</em>, <em>logfile</em>,  <p><em>if</em>, <em>then</em>, <em>else</em>, <em>set</em>, <em>daemon</em>, <em>logfile</em>,
2500  <em>syslog</em>, <em>address</em>, <em>httpd</em>, <em>ssl</em>, <em>enable</em>, <em>disable</em>,  <em>syslog</em>, <em>address</em>, <em>httpd</em>, <em>ssl</em>, <em>enable</em>, <em>disable</em>,
2501  <em>pemfile</em>, <em>allow</em>, <em>read-only</em>, <em>check</em>, <em>init</em>,  <em>pemfile</em>, <em>allow</em>, <em>read-only</em>, <em>check</em>, <em>init</em>, <em>count</em>,
2502  <em>pidfile</em>, <em>statefile</em>, <em>group</em>, <em>start</em>, <em>stop</em>, <em>uid</em>,  <em>pidfile</em>, <em>statefile</em>, <em>group</em>, <em>start</em>, <em>stop</em>, <em>uid</em>,
2503  <em>gid</em>, <em>connection</em>, <em>port(number)</em>, <em>unix(socket)</em>, <em>type</em>,  <em>gid</em>, <em>connection</em>, <em>port(number)</em>, <em>unix(socket)</em>, <em>type</em>,
2504  <em>proto(col)</em>, <em>tcp</em>, <em>tcpssl</em>, <em>udp</em>, <em>alert</em>,  <em>proto(col)</em>, <em>tcp</em>, <em>tcpssl</em>, <em>udp</em>, <em>alert</em>, <em>icmp</em>,
2505  <em>mail-format</em>, <em>restart</em>, <em>timeout</em>, <em>checksum</em>, <em>resource</em>,  <em>mail-format</em>, <em>restart</em>, <em>timeout</em>, <em>checksum</em>, <em>resource</em>,
2506  <em>expect</em>, <em>send</em>, <em>mailserver</em>, <em>every</em>, <em>mode</em>, <em>active</em>,  <em>expect</em>, <em>send</em>, <em>mailserver</em>, <em>every</em>, <em>mode</em>, <em>active</em>,
2507  <em>passive</em>, <em>manual</em>, <em>depends</em>, <em>host</em>, <em>default</em>, <em>http</em>,  <em>passive</em>, <em>manual</em>, <em>depends</em>, <em>host</em>, <em>default</em>, <em>http</em>,
# Line 2390  insensitive.</p> Line 2511  insensitive.</p>
2511  <em>minute(s)</em>, <em>hour(s)</em>, <em>day(s)</em>, <em>space</em>, <em>inode</em>, <em>pid</em>,  <em>minute(s)</em>, <em>hour(s)</em>, <em>day(s)</em>, <em>space</em>, <em>inode</em>, <em>pid</em>,
2512  <em>ppid</em>, <em>perm(ission)</em>, <em>process</em>, <em>file</em>, <em>directory</em>,  <em>ppid</em>, <em>perm(ission)</em>, <em>process</em>, <em>file</em>, <em>directory</em>,
2513  <em>device</em>, <em>size</em>, <em>unmonitor</em>, <em>rdate</em>, <em>rsync</em>, <em>data</em>,  <em>device</em>, <em>size</em>, <em>unmonitor</em>, <em>rdate</em>, <em>rsync</em>, <em>data</em>,
2514  <em>invalid</em>, <em>exec</em>, <em>nonexist</em> and <em>failed</em></p>  <em>invalid</em>, <em>exec</em>, <em>nonexist</em>, <em>policy</em>, <em>reminder</em> and
2515    <em>failed</em></p>
2516  <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
2517  monit:</p>  monit:</p>
2518  <p><em>is</em>, <em>as</em>, <em>are</em>, <em>on(ly)</em>, <em>with(in)</em>, <em>and</em>, <em>has</em>,  <p><em>is</em>, <em>as</em>, <em>are</em>, <em>on(ly)</em>, <em>with(in)</em>, <em>and</em>, <em>has</em>,
# Line 2517  of Apache child processes are stuck perf Line 2639  of Apache child processes are stuck perf
2639  if not send an alert:</p>  if not send an alert:</p>
2640  <pre>  <pre>
2641   check host www.tildeslash.com with address www.tildeslash.com   check host www.tildeslash.com with address www.tildeslash.com
2642         if failed icmp type echo with timeout 15 seconds         if failed icmp type echo count 5 with timeout 15 seconds
2643            then alert            then alert
2644         alert foo@bar.org</pre>         alert foo@bar.org</pre>
2645  <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
# Line 3047  warranty of MERCHANTABILITY or FITNESS f Line 3169  warranty of MERCHANTABILITY or FITNESS f
3169  </p>  </p>
3170  <hr />  <hr />
3171  <h1><a name="see_also">SEE ALSO</a></h1>  <h1><a name="see_also">SEE ALSO</a></h1>
3172  <p>GNU text utilities;  md5sum(1);  sha1sum(1);  openssl(1);  <code>glob(7)</code></p>  <p>GNU text utilities;  md5sum(1);  sha1sum(1);  openssl(1);  glob(7);
3173    <code>regex(7)</code></p>
3174    
3175    
3176  <?php include '../include/footer.html'; ?>  <?php include '../include/footer.html'; ?>
3177    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

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