/[monit]/monit/monit.pod
ViewVC logotype

Diff of /monit/monit.pod

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

revision 1.93 by hauk, Sun Aug 17 02:21:22 2003 UTC revision 1.94 by martinp, Wed Aug 27 23:36:43 2003 UTC
# Line 78  of the following action arguments; monit Line 78  of the following action arguments; monit
78  action and exit without transforming itself to a deamon.  action and exit without transforming itself to a deamon.
79    
80  B<start all>  B<start all>
81      Start all services listed in the control file. If      Start all services listed in the control file and enable
82      the group option is set, only start the services in      monitoring for them. If the group option is set, only
83      the named group.      start and enable monitoring of services in the named group.
84    
85  B<start name>  B<start name>
86      Start the named service. The name must exist in the      Start the named service and enable monitoring for it. The
87      monitrc file, after a I<check> keyword. See also      name must exist in the monitrc file, after a I<check>
88      the MONIT HTTPD section below.      keyword. See also the MONIT HTTPD section below.
89    
90  B<stop all>      B<stop all>    
91      Stop all services listed in the control file. If      Stop all services listed in the control file and disable
92      the group option is set, only stop the services in      their monitoring. If the group option is set, only stop and
93      the named group.      disable monitoring of the services in the named group.
94    
95  B<stop name>  B<stop name>
96      Stop the named service. The name must exist in the      Stop the named service and disable its monitoring. The name
97      monitrc file, after a I<check> keyword. See also      must exist in the monitrc file, after a I<check> keyword.
98      the MONIT HTTPD section below.      See also the MONIT HTTPD section below.
99    
100  B<restart all>  B<restart all>
101      Stop and start I<all> services. If the group option is      Stop and start I<all> services. If the group option is
# Line 106  B<restart name> Line 106  B<restart name>
106      the monitrc file, after a I<check> keyword. also      the monitrc file, after a I<check> keyword. also
107      the MONIT HTTPD section below.      the MONIT HTTPD section below.
108    
109    B<monitor all>    
110        Enable monitoring of all services listed in the
111        control file. If the group option is set, only start
112        the services monitoring in the named group.
113    
114    B<monitor name>
115        Enable monitoring of the named service. The name must
116        exist in the monitrc file, after a I<check> keyword.
117        Monit will enable monitoring of all services chain which
118        this service depends on before actualy starting monitoring
119        of this service. See also the MONIT HTTPD section below.
120    
121    B<unmonitor all>    
122        Disable monitoring of all services listed in the
123        control file. If the group option is set, only stop
124        the services monitoring in the named group.
125    
126    B<unmonitor name>
127        Disable monitoring of the named service. The name must
128        exist in the monitrc file, after a I<check> keyword.
129        Monit will disable monitoring of the whole services chain
130        which depends on this service before actualy stopping
131        monitoring of this service. See also the MONIT HTTPD
132        section below.
133    
134  B<status>  B<status>
135      Print status information for each service. If the      Print status information for each service. If the
136      group option is set, only print the status for the      group option is set, only print the status for the
# Line 241  alerts in case of a problem. Line 266  alerts in case of a problem.
266    
267  For use in clustered environments there is also a I<manual>  For use in clustered environments there is also a I<manual>
268  mode. In this mode, monit will enter I<active> mode B<only> if a  mode. In this mode, monit will enter I<active> mode B<only> if a
269  service was started under monit's control, for example by:  service was brough under monit's control, for example by:
270    
271    monit start sybase    monit start sybase (it will call start method and enable
272                          monitoring)
273    
274  or  or
275    
276    monit -g database start (for service group)    monit -g database start (for service group)
277    
278  If the service wasn't started by monit or was stopped for example  or
279  by:  
280      monit monitor sybase (it will just enable monitoring)
281    
282    or
283    
284      monit -g database monitor (for service group)
285    
286    If the service wasn't started by monit or was stopped or
287    disabled for example by:
288    
289    monit stop sybase    monit stop sybase (it will call stop method and disable
290                         monitoring)
291    
292  or  or
293    
294    monit -g database stop (for service group)    monit -g database stop (for service group)
295    
296    or
297    
298      monit unmonitor sybase (it will just disable monitoring)
299    
300    or
301    
302      monit -g database unmonitor (for service group)
303    
304  monit will not monitor the service at all. This allows for having  monit will not monitor the service at all. This allows for having
305  services configured in monitrc and start it with monit only if it  services configured in monitrc and start it with monit only if it
306  should run. This can be used to build simple failsafe clusters.  should run. This can be used to build simple failsafe clusters.
# Line 272  monit will raise an email alert if: Line 315  monit will raise an email alert if:
315    
316   o A service timed out   o A service timed out
317   o A service was stopped   o A service was stopped
318     o A service monitoring was disabled (unmonitor)
319   o A port connection failed   o A port connection failed
320   o A resource statement match   o A resource statement match
321   o A permission error occurred   o A permission error occurred
# Line 295  Simply using: Line 339  Simply using:
339    
340  will send a default email alert to the address foo@bar whenever a  will send a default email alert to the address foo@bar whenever a
341  timeout, start, restart, checksum, resource, stop, connection, size,  timeout, start, restart, checksum, resource, stop, connection, size,
342  permission, uid, gid or timestamp error occurs.  permission, uid, gid, unmonitor or timestamp error occurs.
343    
344  If you only want an alert message sent when a certain event  If you only want an alert message sent when a certain event
345  occurs for example a timeout or when a service is restarted,  occurs for example a timeout or when a service is restarted,
# Line 317  The same applies for a checksum error Line 361  The same applies for a checksum error
361  It is also possible to combine events and send mail to different  It is also possible to combine events and send mail to different
362  email addresses like:  email addresses like:
363    
364   alert foo@bar { restart, timeout, resource, connection }   alert foo@bar { restart, timeout, resource, connection,
365   alert security@bar on { checksum, permission, uid, gid, stop }                   unmonitor }
366     alert security@bar on { checksum, permission, uid, gid,
367                             stop, unmonitor }
368   alert manager@bar   alert manager@bar
369    
370  This will send an alert message to foo@bar whenever a restart,  This will send an alert message to foo@bar whenever a restart,
# Line 340  The following alert-statement: Line 386  The following alert-statement:
386                  stop                  stop
387                  timeout                  timeout
388                  timestamp                  timestamp
389                  uid}                  uid
390                    unmonitor}
391    
392  is equivalent to:  is equivalent to:
393    
# Line 348  is equivalent to: Line 395  is equivalent to:
395    
396  which as stated above, will send a message whenever a timeout, a  which as stated above, will send a message whenever a timeout, a
397  start, restart, checksum, resource, stop, connection, size,  start, restart, checksum, resource, stop, connection, size,
398  permission, uid, gid or timestamp error occurs. (If the postfix  permission, uid, gid, unmonitor or timestamp error occurs. (If
399  variant is used, then note that the parenthesis are  the postfix variant is used, then note that the parenthesis are
400  I<mandatory>).  I<mandatory>).
401    
402  A start, stop or restart alert is also sent I<if monit fails to  A start, stop or restart alert is also sent I<if monit fails to
# Line 410  I<$EVENT> A string describing the event Line 457  I<$EVENT> A string describing the event
457  are fixed and are, "Started", "Stopped", "Restarted", Checksum  are fixed and are, "Started", "Stopped", "Restarted", Checksum
458  error", "Resource limit matched", "Timeout", "Size rule matched",  error", "Resource limit matched", "Timeout", "Size rule matched",
459  "Permission error", "Connection test failed", "UID error", "GID  "Permission error", "Connection test failed", "UID error", "GID
460  error" and "Timestamp rule matched".  error", "Monitoring disabled" and "Timestamp rule matched".
461    
462  I<$SERVICE> The service entry name in monitrc (old form  I<$SERVICE> The service entry name in monitrc (old form
463  I<$PROGRAM> is supported too but not recommended).  I<$PROGRAM> is supported too but not recommended).
# Line 537  I<cycles> is the maximum number of cycle Line 584  I<cycles> is the maximum number of cycle
584  has to be true in order to start an action.  If I<cycles> is  has to be true in order to start an action.  If I<cycles> is
585  omitted then it is set to one.  omitted then it is set to one.
586    
587  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
588    "UNMONITOR":
589    
590  =over 4  =over 4
591    
# Line 553  has been reached. Line 601  has been reached.
601    
602  =item *  =item *
603    
604  STOP stops the service in case the maximum number of cycles has  STOP stops the service. If monit stops a service it will not be
605  been reached. If monit stops a service it will not be checked by  checked by monit anymore nor restarted again later. You must
606  monit anymore nor restarted again later. You must explicit start  explicitly start it again from the web interface or from the
607  it again from the web interface or from the console, like: 'monit  console, like: 'monit start apache' or 'monit monitor apache'
608  start apache' if you want the monit daemon to monitor the service  if you want the monit daemon to monitor the service again.
 again.  
609    
610  =item *  =item *
611    
# Line 566  EXEC may be used to execute an arbitrary Line 613  EXEC may be used to execute an arbitrary
613  this action you must state the program to be executed. For  this action you must state the program to be executed. For
614  instance; exec "/etc/init.d/network restart"  instance; exec "/etc/init.d/network restart"
615    
616    =item *
617    
618    UNMONITOR will disable monitoring of the service - it will not be
619    checked by monit anymore nor restarted again later. The chain of
620    all services which depends on this service will be unmonitored
621    before this service monitoring will be stopped. You can enable
622    monitoring again either via console 'monitor' command, via web
623    interface or use 'start' command, which will enable the
624    monitoring too.
625    
626  =back  =back
627    
628    
# Line 613  You can, for example, use the GNU utilit Line 670  You can, for example, use the GNU utilit
670  checksum string for a file and then use this string in the  checksum string for a file and then use this string in the
671  expect-statement.  expect-statement.
672    
673  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
674    "UNMONITOR":
675    
676  =over 4  =over 4
677    
# Line 630  RESTART restarts the service I<and> send Line 688  RESTART restarts the service I<and> send
688  STOP stops the service I<and> sends an alert. If monit stops a  STOP stops the service I<and> sends an alert. If monit stops a
689  service it will not be checked by monit anymore nor restarted  service it will not be checked by monit anymore nor restarted
690  again later. You must explicit start it again from the web  again later. You must explicit start it again from the web
691  interface or from the console, like: 'monit start myfile' if you  interface or from the console, like: 'monit start myfile' or
692  want the monit daemon to monitor the service again.  'monit monitor myfile' if you want the monit daemon to monitor
693    the service again.
694    
695  =item *  =item *
696    
# Line 639  EXEC may be used to execute an arbitrary Line 698  EXEC may be used to execute an arbitrary
698  alert. If you choose this action you must state the program to be  alert. If you choose this action you must state the program to be
699  executed. For instance; exec "/sbin/ifconfig eth0 down".  executed. For instance; exec "/sbin/ifconfig eth0 down".
700    
701    =item *
702    
703    UNMONITOR will disable monitoring of the service - it will not be
704    checked by monit anymore nor restarted again later. The chain of
705    all services which depends on this service will be unmonitored
706    before this service monitoring will be stopped. You can enable
707    monitoring again either via console 'monitor' command, via web
708    interface or use 'start' command, which will enable the
709    monitoring too.
710    
711  =back  =back
712    
713  The checksum statement may be used to check a file for changes  The checksum statement may be used to check a file for changes
# Line 652  illustrate this for the apache web serve Line 721  illustrate this for the apache web serve
721    
722  B<Note>, if you plan to use the checksum statement for security  B<Note>, if you plan to use the checksum statement for security
723  reasons, e.g. to monitor a file which should not change, then we  reasons, e.g. to monitor a file which should not change, then we
724  strongly recommend that you choose the I<alert> action and only  strongly recommend that you choose the I<unmonitor> action.  The
725  the alert action. The reason is that you may accidentally execute  reason is that you may accidentally execute a cracked program if
726  a cracked program if a service depends on the file-service  a service depends on the file-service containing the checksum
727  containing the checksum test, as in this example:  test, as in this example:
728    
729   check apache with pidfile "/usr/local/apache/logs/httpd.pid"   check apache with pidfile "/usr/local/apache/logs/httpd.pid"
730    start program = "/usr/local/apache/bin/http start"    start program = "/usr/local/apache/bin/http start"
# Line 674  file service as well. Since we just foun Line 743  file service as well. Since we just foun
743  http binary we should absolutely not want to execute this  http binary we should absolutely not want to execute this
744  program, that is; the apache service's stop program.  program, that is; the apache service's stop program.
745    
746  In this example, you should instead choose the alert action. You  In this example, you should instead choose the unmonitor action.
747  will then only get an alert message saying that  You will then disable monitoring of this service and all services
748    which depends on it and only get an alert message saying that
749  /usr/local/apache/bin/http was changed and you may then start  /usr/local/apache/bin/http was changed and you may then start
750  your own cognitive B<OODA> loop, that is; Observe, Orient, Decide  your own cognitive B<OODA> loop, that is; Observe, Orient, Decide
751  and Act. In this case, where your system may be compromised, it's  and Act. In this case, where your system may be compromised, it's
# Line 716  I<value> is a time watermark. Line 786  I<value> is a time watermark.
786  I<unit> is either "SECOND", "MINUTE", "HOUR" or "DAY" (it is also  I<unit> is either "SECOND", "MINUTE", "HOUR" or "DAY" (it is also
787  possible to use "SECONDS", "MINUTES", "HOURS", or "DAYS").  possible to use "SECONDS", "MINUTES", "HOURS", or "DAYS").
788    
789  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
790    "UNMONITOR":
791    
792  =over 4  =over 4
793    
# Line 733  RESTART restarts the service. Line 804  RESTART restarts the service.
804  STOP stops the service. If monit stops a service it will  STOP stops the service. If monit stops a service it will
805  not be checked by monit anymore nor restarted again later. You  not be checked by monit anymore nor restarted again later. You
806  must explicit start it again from the web interface or from the  must explicit start it again from the web interface or from the
807  console, like: 'monit start datafs' if you want the monit daemon  console, like: 'monit start datafs' or 'monit monitor datafs'
808  to monitor the service again.  if you want the monit daemon to monitor the service again.
809    
810  =item *  =item *
811    
# Line 742  EXEC may be used to execute an arbitrary Line 813  EXEC may be used to execute an arbitrary
813  this action you must state the program to be executed. For  this action you must state the program to be executed. For
814  instance; exec "/bin/rm -f /tmp/foobar"  instance; exec "/bin/rm -f /tmp/foobar"
815    
816    =item *
817    
818    UNMONITOR will disable monitoring of the service - it will not be
819    checked by monit anymore nor restarted again later. The chain of
820    all services which depends on this service will be unmonitored
821    before this service monitoring will be stopped. You can enable
822    monitoring again either via console 'monitor' command, via web
823    interface or use 'start' command, which will enable the
824    monitoring too.
825    
826  =back  =back
827    
828    
# Line 833  I<unit> is a choice of "B","KB","MB","GB Line 914  I<unit> is a choice of "B","KB","MB","GB
914  "byte", "kilobyte", "megabyte", "gigabyte". If it is not specified,  "byte", "kilobyte", "megabyte", "gigabyte". If it is not specified,
915  "byte" unit is assumed by default.  "byte" unit is assumed by default.
916    
917  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
918    "UNMONITOR":
919    
920  =over 4  =over 4
921    
# Line 850  RESTART restarts the service. Line 932  RESTART restarts the service.
932  STOP stops the service. If monit stops a service it will  STOP stops the service. If monit stops a service it will
933  not be checked by monit anymore nor restarted again later. You  not be checked by monit anymore nor restarted again later. You
934  must explicit start it again from the web interface or from the  must explicit start it again from the web interface or from the
935  console, like: 'monit start myfile' if you want the monit daemon  console, like: 'monit start myfile' or 'monit monitor myfile'
936  to monitor the service again.  if you want the monit daemon to monitor the service again.
937    
938  =item *  =item *
939    
# Line 859  EXEC may be used to execute an arbitrary Line 941  EXEC may be used to execute an arbitrary
941  this action you must state the program to be executed. For  this action you must state the program to be executed. For
942  instance; exec "/bin/rm -f /tmp/foobar"  instance; exec "/bin/rm -f /tmp/foobar"
943    
944    =item *
945    
946    UNMONITOR will disable monitoring of the service - it will not be
947    checked by monit anymore nor restarted again later. The chain of
948    all services which depends on this service will be unmonitored
949    before this service monitoring will be stopped. You can enable
950    monitoring again either via console 'monitor' command, via web
951    interface or use 'start' command, which will enable the
952    monitoring too.
953    
954  =back  =back
955    
956    
# Line 1004  statement is: Line 1096  statement is:
1096    
1097    [with TIMEOUT x SECONDS]    [with TIMEOUT x SECONDS]
1098    
1099  B<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  B<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
1100    "UNMONITOR":
1101    
1102  =over 4  =over 4
1103    
# Line 1021  RESTART restarts the service. Line 1114  RESTART restarts the service.
1114  STOP stops the service. If monit stops a service it will  STOP stops the service. If monit stops a service it will
1115  not be checked by monit anymore nor restarted again later. You  not be checked by monit anymore nor restarted again later. You
1116  must explicit start it again from the web interface or from the  must explicit start it again from the web interface or from the
1117  console, like: 'monit start datafs' if you want the monit daemon  console, like: 'monit start myfile' or 'monit monitor myfile'
1118  to monitor the service again.  if you want the monit daemon to monitor the service again.
1119    
1120  =item *  =item *
1121    
# Line 1030  EXEC may be used to execute an arbitrary Line 1123  EXEC may be used to execute an arbitrary
1123  this action you must state the program to be executed. For  this action you must state the program to be executed. For
1124  instance; exec "/etc/init.d/network restart"  instance; exec "/etc/init.d/network restart"
1125    
1126    =item *
1127    
1128    UNMONITOR will disable monitoring of the service - it will not be
1129    checked by monit anymore nor restarted again later. The chain of
1130    all services which depends on this service will be unmonitored
1131    before this service monitoring will be stopped. You can enable
1132    monitoring again either via console 'monitor' command, via web
1133    interface or use 'start' command, which will enable the
1134    monitoring too.
1135    
1136  =back  =back
1137    
1138  =head4 Examples  =head4 Examples
# Line 1161  I<unit> is a choice of "B","KB","MB","GB Line 1264  I<unit> is a choice of "B","KB","MB","GB
1264  alternatives "byte", "kilobyte", "megabyte", "gigabyte",  alternatives "byte", "kilobyte", "megabyte", "gigabyte",
1265  "percent".  "percent".
1266    
1267  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
1268    "UNMONITOR":
1269    
1270  =over 4  =over 4
1271    
# Line 1178  RESTART restarts the service. Line 1282  RESTART restarts the service.
1282  STOP stops the service. If monit stops a service it will  STOP stops the service. If monit stops a service it will
1283  not be checked by monit anymore nor restarted again later. You  not be checked by monit anymore nor restarted again later. You
1284  must explicit start it again from the web interface or from the  must explicit start it again from the web interface or from the
1285  console, like: 'monit start datafs' if you want the monit daemon  console, like: 'monit start datafs' or 'monit monitor datafs'
1286  to monitor the service again.  if you want the monit daemon to monitor the service again.
1287    
1288  =item *  =item *
1289    
1290  EXEC may be used to execute an arbitrary program. If you choose  EXEC may be used to execute an arbitrary program. If you choose
1291  this action you must state the program to be executed.  this action you must state the program to be executed.
1292    
1293    =item *
1294    
1295    UNMONITOR will disable monitoring of the service - it will not be
1296    checked by monit anymore nor restarted again later. The chain of
1297    all services which depends on this service will be unmonitored
1298    before this service monitoring will be stopped. You can enable
1299    monitoring again either via console 'monitor' command, via web
1300    interface or use 'start' command, which will enable the
1301    monitoring too.
1302    
1303  =back  =back
1304    
1305    
# Line 1218  I<unit> is optional. If not specified, t Line 1332  I<unit> is optional. If not specified, t
1332  count of inodes. You can use the "%" character or the longer  count of inodes. You can use the "%" character or the longer
1333  alternative "percent" as a unit.  alternative "percent" as a unit.
1334    
1335  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
1336    "UNMONITOR":
1337    
1338  =over 4  =over 4
1339    
# Line 1235  RESTART restarts the service. Line 1350  RESTART restarts the service.
1350  STOP stops the service. If monit stops a service it will  STOP stops the service. If monit stops a service it will
1351  not be checked by monit anymore nor restarted again later. You  not be checked by monit anymore nor restarted again later. You
1352  must explicit start it again from the web interface or from the  must explicit start it again from the web interface or from the
1353  console, like: 'monit start datafs' if you want the monit daemon  console, like: 'monit start datafs' or 'monit monitor datafs'
1354  to monitor the service again.  if you want the monit daemon to monitor the service again.
1355    
1356  =item *  =item *
1357    
1358  EXEC may be used to execute an arbitrary program. If you choose  EXEC may be used to execute an arbitrary program. If you choose
1359  this action you must state the program to be executed.  this action you must state the program to be executed.
1360    
1361    =item *
1362    
1363    UNMONITOR will disable monitoring of the service - it will not be
1364    checked by monit anymore nor restarted again later. The chain of
1365    all services which depends on this service will be unmonitored
1366    before this service monitoring will be stopped. You can enable
1367    monitoring again either via console 'monitor' command, via web
1368    interface or use 'start' command, which will enable the
1369    monitoring too.
1370    
1371  =back  =back
1372    
1373    
# Line 1263  Full syntax is: Line 1388  Full syntax is:
1388  I<octalnumber> defines appropriate file, directory or device  I<octalnumber> defines appropriate file, directory or device
1389  permissions.  permissions.
1390    
1391  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
1392    "UNMONITOR":
1393    
1394  =over 4  =over 4
1395    
# Line 1280  RESTART restarts the service. Line 1406  RESTART restarts the service.
1406  STOP stops the service. If monit stops a service it will  STOP stops the service. If monit stops a service it will
1407  not be checked by monit anymore nor restarted again later. You  not be checked by monit anymore nor restarted again later. You
1408  must explicit start it again from the web interface or from the  must explicit start it again from the web interface or from the
1409  console, like: 'monit start myfile' if you want the monit daemon  console, like: 'monit start myfile' or 'monit monitor myfile'
1410  to monitor the service again.  if you want the monit daemon to monitor the service again.
1411    
1412  =item *  =item *
1413    
# Line 1289  EXEC may be used to execute an arbitrary Line 1415  EXEC may be used to execute an arbitrary
1415  this action you must state the program to be executed. For  this action you must state the program to be executed. For
1416  instance; exec "/sbin/ifconfig eth0 down"  instance; exec "/sbin/ifconfig eth0 down"
1417    
1418    =item *
1419    
1420    UNMONITOR will disable monitoring of the service - it will not be
1421    checked by monit anymore nor restarted again later. The chain of
1422    all services which depends on this service will be unmonitored
1423    before this service monitoring will be stopped. You can enable
1424    monitoring again either via console 'monitor' command, via web
1425    interface or use 'start' command, which will enable the
1426    monitoring too.
1427    
1428  =back  =back
1429    
1430    
1431  The web interface will show a permission warning in the case that  The web interface will show a permission warning in the case that
1432  it failed.  it failed.
1433    
1434  We recommend to use STOP action in the permission statement. The  We recommend to use UNMONITOR action in the permission statement. The
1435  rationale for this feature is security and that monit does not  rationale for this feature is security and that monit does not
1436  start a possible cracked program or script. Example:  start a possible cracked program or script. Example:
1437    
1438   check file myfile with path "/path/to/myfile"   check file myfile with path "/path/to/myfile"
1439     if failed permission 700 then stop     if failed permission 700 then unmonitor
1440    
1441  It will just stop service monitoring. In the case that some other  It will just stop service monitoring. In the case that some other
1442  service depends on myfile service, stop event will be send to it  service depends on myfile service, unmonitor event will be send
1443  as well.  to it and all its dependants as well.
1444    
1445    
1446    
# Line 1324  Full syntax is: Line 1460  Full syntax is:
1460  I<user> defines appropriate file, directory or device  I<user> defines appropriate file, directory or device
1461  owner user id either in numeric or string form.  owner user id either in numeric or string form.
1462    
1463  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
1464    "UNMONITOR":
1465    
1466  =over 4  =over 4
1467    
# Line 1341  RESTART restarts the service. Line 1478  RESTART restarts the service.
1478  STOP stops the service. If monit stops a service it will  STOP stops the service. If monit stops a service it will
1479  not be checked by monit anymore nor restarted again later. You  not be checked by monit anymore nor restarted again later. You
1480  must explicit start it again from the web interface or from the  must explicit start it again from the web interface or from the
1481  console, like: 'monit start myfile' if you want the monit daemon  console, like: 'monit start myfile' or 'monit monitor myfile'
1482  to monitor the service again.  if you want the monit daemon to monitor the service again.
1483    
1484  =item *  =item *
1485    
# Line 1350  EXEC may be used to execute an arbitrary Line 1487  EXEC may be used to execute an arbitrary
1487  this action you must state the program to be executed. For  this action you must state the program to be executed. For
1488  instance; exec "/sbin/ifconfig eth0 down"  instance; exec "/sbin/ifconfig eth0 down"
1489    
1490    =item *
1491    
1492    UNMONITOR will disable monitoring of the service - it will not be
1493    checked by monit anymore nor restarted again later. The chain of
1494    all services which depends on this service will be unmonitored
1495    before this service monitoring will be stopped. You can enable
1496    monitoring again either via console 'monitor' command, via web
1497    interface or use 'start' command, which will enable the
1498    monitoring too.
1499    
1500  =back  =back
1501    
1502    
1503  The web interface will show a uid warning in the case that it  The web interface will show a uid warning in the case that it
1504  failed.  failed.
1505    
1506  We recommend to use STOP action in the uid statement. The  We recommend to use UNMONITOR action in the uid statement. The
1507  rationale for this feature is security and that monit does not  rationale for this feature is security and that monit does not
1508  start a possible cracked program or script. Example:  start a possible cracked program or script. Example:
1509    
1510   check file myfile with path "/path/to/myfile"   check file myfile with path "/path/to/myfile"
1511     if failed uid root then stop     if failed uid root then unmonitor
1512    
1513  It will just stop service monitoring. In the case that some other  It will just stop service monitoring. In the case that some other
1514  service depends on myfile service, stop event will be send to it  service depends on myfile service, unmonitor event will be send
1515  as well.  to it and all its dependants as well.
1516    
1517    
1518    
# Line 1385  Full syntax is: Line 1532  Full syntax is:
1532  I<user> defines appropriate file, directory or device  I<user> defines appropriate file, directory or device
1533  owner group id either in numeric or string form.  owner group id either in numeric or string form.
1534    
1535  I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC":  I<action> is a choice of "ALERT", "RESTART", "STOP", "EXEC" or
1536    "UNMONITOR":
1537    
1538  =over 4  =over 4
1539    
# Line 1402  RESTART restarts the service. Line 1550  RESTART restarts the service.
1550  STOP stops the service. If monit stops a service it will  STOP stops the service. If monit stops a service it will
1551  not be checked by monit anymore nor restarted again later. You  not be checked by monit anymore nor restarted again later. You
1552  must explicit start it again from the web interface or from the  must explicit start it again from the web interface or from the
1553  console, like: 'monit start myfile' if you want the monit daemon  console, like: 'monit start myfile' or 'monit monitor myfile'
1554  to monitor the service again.  if you want the monit daemon to monitor the service again.
1555    
1556  =item *  =item *
1557    
# Line 1411  EXEC may be used to execute an arbitrary Line 1559  EXEC may be used to execute an arbitrary
1559  this action you must state the program to be executed. For  this action you must state the program to be executed. For
1560  instance; exec "/sbin/ifconfig eth0 down"  instance; exec "/sbin/ifconfig eth0 down"
1561    
1562    =item *
1563    
1564    UNMONITOR will disable monitoring of the service - it will not be
1565    checked by monit anymore nor restarted again later. The chain of
1566    all services which depends on this service will be unmonitored
1567    before this service monitoring will be stopped. You can enable
1568    monitoring again either via console 'monitor' command, via web
1569    interface or use 'start' command, which will enable the
1570    monitoring too.
1571    
1572  =back  =back
1573    
1574    
1575  The web interface will show a gid warning in the case that it  The web interface will show a gid warning in the case that it
1576  failed.  failed.
1577    
1578  We recommend to use STOP action in the uid statement. The  We recommend to use UNMONITOR action in the uid statement. The
1579  rationale for this feature is security and that monit does not  rationale for this feature is security and that monit does not
1580  start a possible cracked program or script. Example:  start a possible cracked program or script. Example:
1581    
1582   check file myfile with path "/path/to/myfile"   check file myfile with path "/path/to/myfile"
1583     if failed gid root then stop     if failed gid root then unmonitor
1584    
1585  It will just stop service monitoring. In the case that some other  It will just stop service monitoring. In the case that some other
1586  service depends on myfile service, stop event will be send to it  service depends on myfile service, unmonitor event will be send
1587  as well.  to it and all its dependants as well.
1588    
1589    
1590    
# Line 1527  be able to use the following console com Line 1685  be able to use the following console com
1685   'monit start service'   'monit start service'
1686   'monit stop service'   'monit stop service'
1687   'monit restart service'   'monit restart service'
1688     'monit monitor service'
1689     'monit unmonitor service'
1690   'monit -g groupname start'   'monit -g groupname start'
1691   'monit -g groupname stop'   'monit -g groupname stop'
1692   'monit -g groupname restart'   'monit -g groupname restart'
1693     'monit -g groupname monitor'
1694     'monit -g groupname unmonitor'
1695    
1696  If a monit daemon is running in the background we will ask the  If a monit daemon is running in the background we will ask the
1697  deamon (via the HTTP protocol) to execute the above commands.  deamon (via the HTTP protocol) to execute the above commands.
# Line 1622  complain and exit if the control file is Line 1784  complain and exit if the control file is
1784  =head1 DEPENDENCY CHECKING  =head1 DEPENDENCY CHECKING
1785    
1786  If specified in the control file, monit can do dependency  If specified in the control file, monit can do dependency
1787  checking before starting or stopping services. The syntax for  checking before starting, stopping, monitoring or unmonitoring
1788  the depend statement is simply:  services. The syntax for the depend statement is simply:
1789    
1790  =over 4  =over 4
1791    
# Line 1639  directory, file or process) or use more Line 1801  directory, file or process) or use more
1801  in an entry.  in an entry.
1802    
1803  Services specified in a I<depends> statement will be checked  Services specified in a I<depends> statement will be checked
1804  during stop/start operations. If a service is stopped it will  during stop/start/monitor/unmonitor operations. If a service
1805  stop any services that depends on itself. Likewise, if a service  is stopped or unmonitored it will stop/unmonitor any services
1806  is started, it will first stop any services that depends on  that depends on itself. Likewise, if a service is started, it
1807  itself and after it is started, start all depending services  will first stop any services that depends on itself and after
1808  again.  it is started, start all depending services again. If the
1809    service is to be monitored (enable monitoring), all services
1810    which this service depends on will be monitored before enabling
1811    monitoring of this service.
1812    
1813  Consider the following common server setup:  Consider the following common server setup:
1814    
# Line 1983  insensitive. Line 2148  insensitive.
2148                   This statement is optional                   This statement is optional
2149   alert           Specifies an email address for notification   alert           Specifies an email address for notification
2150                   if timeout, start, restart, checksum, resource,                   if timeout, start, restart, checksum, resource,
2151                   stop, connection, size, permission, uid, gid or                   stop, connection, size, permission, uid, gid,
2152                   timestamp occurs. Alert can also be postfixed,                   unmonitor or timestamp occurs. Alert can also
2153                   to only send a message for certain events. See                   be postfixed, to only send a message for
2154                   the examples above. More than one alert                   certain events. See the examples above. More
2155                   statement is allowed in an entry. This statement                   than one alert statement is allowed in an
2156                   is also optional.                   entry. This statement is also optional.
2157   restart,        These keywords may be used as actions for   restart, stop   These keywords may be used as actions for
2158   stop and exec   various test statements. The exec statement is   unmonitor and   various test statements. The exec statement is
2159                   special in that it requires a following string   exec            special in that it requires a following string
2160                   specifying the program to be execute. You may                   specifying the program to be execute. You may
2161                   also specify an UID and GID to the exec                   also specify an UID and GID to the exec
2162                   statement. The program executed will then run                   statement. The program executed will then run
# Line 2082  I<ldap2>, I<ldap3>, I<request>, I<cpu>, Line 2247  I<ldap2>, I<ldap3>, I<request>, I<cpu>,
2247  I<children>, I<loadavg>, I<timestamp>, I<changed>, I<second(s)>,  I<children>, I<loadavg>, I<timestamp>, I<changed>, I<second(s)>,
2248  I<minute(s)>, I<hour(s)>, I<day(s)>, I<space>, I<inode>,  I<minute(s)>, I<hour(s)>, I<day(s)>, I<space>, I<inode>,
2249  I<perm(ission)>, I<process>, I<file>, I<directory>, I<device>,  I<perm(ission)>, I<process>, I<file>, I<directory>, I<device>,
2250  I<size> and I<failed>  I<size>, I<unmonitor> and I<failed>
2251    
2252  And here is a complete list of B<noise keywords> ignored by  And here is a complete list of B<noise keywords> ignored by
2253  monit:  monit:
# Line 2185  vhosts, hence the host statement before Line 2350  vhosts, hence the host statement before
2350    
2351  In the following example we ask monit to compute and verify the  In the following example we ask monit to compute and verify the
2352  checksum for the underlying apache binary used by the start and  checksum for the underlying apache binary used by the start and
2353  stop programs.  stop programs. In the case that the chaksum will fail, the
2354    monitoring will be disabled to prevent compromited binary
2355    execution:
2356    
2357   check process apache with pidfile /var/run/httpd.pid   check process apache with pidfile /var/run/httpd.pid
2358     start program = "/etc/init.d/httpd start"     start program = "/etc/init.d/httpd start"
# Line 2194  stop programs. Line 2361  stop programs.
2361     depends on apache_bin     depends on apache_bin
2362    
2363   check file apache_bin with path /usr/local/apache/bin/httpd   check file apache_bin with path /usr/local/apache/bin/httpd
2364     if failed checksum then stop     if failed checksum then unmonitor
2365    
2366  Some servers are slow starters, like for example Java based  Some servers are slow starters, like for example Java based
2367  Application Servers. So if we want to keep the poll-cycle low  Application Servers. So if we want to keep the poll-cycle low
# Line 2270  statement and file check dependency: Line 2437  statement and file check dependency:
2437    
2438   check file httpd_bin with path /usr/local/apache/bin/httpd   check file httpd_bin with path /usr/local/apache/bin/httpd
2439     if failed checksum and expect 8f7f419955cefa0b33a2ba316cba3659     if failed checksum and expect 8f7f419955cefa0b33a2ba316cba3659
2440       then alert       then unmonitor
2441     if failed permission 755 then alert     if failed permission 755 then unmonitor
2442     if failed uid root then alert     if failed uid root then unmonitor
2443     if failed gid root then alert     if failed gid root then unmonitor
2444     if size changed then alert     if size changed then alert
2445     if timestamp changed then alert     if timestamp changed then alert
2446     alert security@bar on {checksum, size, timestamp, permission,     alert security@bar on {checksum, size, timestamp, permission,
2447       uid, gid} with mail-format {subject: Alaaarrm! on $HOST}       uid, gid, unmonitor} with mail-format
2448         {subject: Alaaarrm! on $HOST}
2449     group apache     group apache
2450    
2451    
# Line 2379  Finally an example with all statements: Line 2547  Finally an example with all statements:
2547   check file httpd_bin with path /usr/local/apache/bin/httpd   check file httpd_bin with path /usr/local/apache/bin/httpd
2548     group server     group server
2549     if failed checksum and expect the sum     if failed checksum and expect the sum
2550       8f7f419955cefa0b33a2ba316cba3659 the alert       8f7f419955cefa0b33a2ba316cba3659 the unmonitor
2551     if failed permission 755 then alert     if failed permission 755 then unmonitor
2552     if failed uid root then alert     if failed uid root then unmonitor
2553     if failed gid root then alert     if failed gid root then unmonitor
2554     if size changed then alert     if size changed then alert
2555     if timestamp changed then alert     if timestamp changed then alert
2556     every 2 cycles     every 2 cycles
# Line 2394  Finally an example with all statements: Line 2562  Finally an example with all statements:
2562     group server     group server
2563     start program  = "/bin/mount /data"     start program  = "/bin/mount /data"
2564     stop program  =  "/bin/umount /data"     stop program  =  "/bin/umount /data"
2565     if failed permission 660 then stop     if failed permission 660 then unmonitor
2566       if failed uid root then unmonitor
2567       if failed gid disk then unmonitor
2568     if space usage > 80 % then alert     if space usage > 80 % then alert
2569     if space usage > 94 % then stop     if space usage > 94 % then stop
2570     if inode usage > 80 % then alert     if inode usage > 80 % then alert

Legend:
Removed from v.1.93  
changed lines
  Added in v.1.94

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