5 |
|
|
6 |
=head1 NAME |
=head1 NAME |
7 |
|
|
8 |
monit - system for monitoring programs |
monit - system for monitoring services |
9 |
|
|
10 |
|
|
11 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
16 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
17 |
|
|
18 |
B<monit> is a utility for monitoring and managing daemons or |
B<monit> is a utility for monitoring and managing daemons or |
19 |
similar programs running on a Unix system; monit will start |
similar programs running on a Unix system, devices, files or |
20 |
specified programs if they are not running and restart programs |
directories. Monit will do appropriate action if attributes of |
21 |
not responding. |
monitored device, file, directory or process entered erroneous |
22 |
|
state. |
23 |
|
|
24 |
The monit utility can run in a daemon mode to repeatedly poll one |
The monit utility can run in a daemon mode to repeatedly poll one |
25 |
or more programs at a specified interval. |
or more monitored services at a specified interval. |
26 |
|
|
27 |
|
|
28 |
=head1 GENERAL OPERATION |
=head1 GENERAL OPERATION |
77 |
action and exit without transforming itself to a deamon. |
action and exit without transforming itself to a deamon. |
78 |
|
|
79 |
B<start> |
B<start> |
80 |
Start all programs listed in the control file. If |
Start all services listed in the control file. If |
81 |
the group option is set, only start the programs in |
the group option is set, only start the services in |
82 |
the named group. |
the named group. |
83 |
|
|
84 |
B<start name> |
B<start name> |
85 |
Start the named program. The name must exist in the |
Start the named service. The name must exist in the |
86 |
monitrc file, after a I<check> keyword. See also |
monitrc file, after a I<check> keyword. See also |
87 |
the MONIT HTTPD section below. |
the MONIT HTTPD section below. |
88 |
|
|
89 |
B<stop> |
B<stop> |
90 |
Stop all programs listed in the control file. If |
Stop all services listed in the control file. If |
91 |
the group option is set, only stop the programs in |
the group option is set, only stop the services in |
92 |
the named group. |
the named group. |
93 |
|
|
94 |
B<stop name> |
B<stop name> |
95 |
Stop the named program. The name must exist in the |
Stop the named service. The name must exist in the |
96 |
monitrc file, after a I<check> keyword. See also |
monitrc file, after a I<check> keyword. See also |
97 |
the MONIT HTTPD section below. |
the MONIT HTTPD section below. |
98 |
|
|
101 |
reread its configuration, close and reopen log files. |
reread its configuration, close and reopen log files. |
102 |
|
|
103 |
B<restart> |
B<restart> |
104 |
Stop and start I<all> programs. If the group option is |
Stop and start I<all> services. If the group option is |
105 |
set, only restart the programs in the named group. |
set, only restart the services in the named group. |
106 |
|
|
107 |
B<restart name> |
B<restart name> |
108 |
Restart the named program. The name must exist in |
Restart the named service. The name must exist in |
109 |
the monitrc file, after a I<check> keyword. also |
the monitrc file, after a I<check> keyword. also |
110 |
the MONIT HTTPD section below. |
the MONIT HTTPD section below. |
111 |
|
|
112 |
B<status> |
B<status> |
113 |
Print status information for each program. If the |
Print status information for each service. If the |
114 |
group option is set, only print the status for the |
group option is set, only print the status for the |
115 |
named group. |
named group. |
116 |
|
|
118 |
Kill monit daemon process |
Kill monit daemon process |
119 |
|
|
120 |
B<validate> |
B<validate> |
121 |
Check all programs and start the ones not running. |
Check all services and start the ones not running. |
122 |
Also if a program indicates (in the control file) |
Also if a process indicates (in the control file) |
123 |
that it's listening on a port number, although |
that it's listening on a port number, although |
124 |
monit cannot connect to the port, then restart the |
monit cannot connect to the port, then restart the |
125 |
program. This action is also the default |
process. This action is also the default |
126 |
behavior when monit runs in daemon mode. |
behavior when monit runs in daemon mode. |
127 |
|
|
128 |
|
|
143 |
seconds. |
seconds. |
144 |
|
|
145 |
In daemon mode, monit puts itself in the background and runs |
In daemon mode, monit puts itself in the background and runs |
146 |
continously, monitoring each specified program and then sleeping |
continously, monitoring each specified service and then sleeping |
147 |
for the given polling interval. |
for the given polling interval. |
148 |
|
|
149 |
Simply invoking |
Simply invoking |
150 |
|
|
151 |
monit -d 300 |
monit -d 300 |
152 |
|
|
153 |
will poll all programs described in your F<~/.monitrc> file every |
will poll all services described in your F<~/.monitrc> file every |
154 |
5 minutes. |
5 minutes. |
155 |
|
|
156 |
It is possible to set a polling interval in your ~/.monitrc file |
It is possible to set a polling interval in your ~/.monitrc file |
158 |
seconds. If you do this, monit will always start in daemon mode |
seconds. If you do this, monit will always start in daemon mode |
159 |
(as long as no action arguments are given). |
(as long as no action arguments are given). |
160 |
|
|
161 |
Only one daemon process is permitted per user; in daemon mode, |
Monit makes a per-instance lockfile in daemon mode. If you need |
162 |
monit makes a per-user lockfile to guarantee this. |
more instances, you will need more configuration files, each |
163 |
|
pointing to its own lockfile. |
164 |
|
|
165 |
Calling monit with a daemon in the background sends a wakeup |
Calling monit with a daemon in the background sends a wakeup |
166 |
signal to the daemon, forcing it to check programs immediately. |
signal to the daemon, forcing it to check services immediately. |
167 |
|
|
168 |
The I<quit> argument will kill a running daemon process instead |
The I<quit> argument will kill a running daemon process instead |
169 |
of waking it up. |
of waking it up. |
196 |
|
|
197 |
=head1 GROUP SUPPORT |
=head1 GROUP SUPPORT |
198 |
|
|
199 |
Program entries in the control file, I<monitrc>, can be grouped |
Service entries in the control file, I<monitrc>, can be grouped |
200 |
together by the I<group> statement. The syntax is simply (keyword |
together by the I<group> statement. The syntax is simply (keyword |
201 |
in capital): |
in capital): |
202 |
|
|
203 |
GROUP groupname |
GROUP groupname |
204 |
|
|
205 |
With this statement it is possible to group similar program |
With this statement it is possible to group similar service |
206 |
entries together and manage them as a whole. Monit provides |
entries together and manage them as a whole. Monit provides |
207 |
functions to start, stop and restart a group of programs, like |
functions to start, stop and restart a group of services, like |
208 |
so: |
so: |
209 |
|
|
210 |
To start a group of programs: |
To start a group of services: |
211 |
|
|
212 |
monit -g <groupname> start |
monit -g <groupname> start |
213 |
|
|
214 |
To stop a group of programs: |
To stop a group of services: |
215 |
|
|
216 |
monit -g <groupname> stop |
monit -g <groupname> stop |
217 |
|
|
218 |
To restart a group of programs: |
To restart a group of services: |
219 |
|
|
220 |
monit -g <groupname> restart |
monit -g <groupname> restart |
221 |
|
|
222 |
Show the status of a program group: |
Show the status of a service group: |
223 |
|
|
224 |
monit -g <groupname> status |
monit -g <groupname> status |
225 |
|
|
269 |
|
|
270 |
monit will raise an email alert if: |
monit will raise an email alert if: |
271 |
|
|
272 |
o A program timed out |
o A service timed out |
273 |
o A program was restarted |
o A service was restarted |
274 |
o A program was stopped |
o A service was stopped |
275 |
o A timestamp test didn't pass |
o A timestamp test didn't pass |
276 |
o A resource statement match (see also the section RESOURCE |
o A resource statement match (see also the section RESOURCE |
277 |
TESTING below) |
TESTING below) |
278 |
o A checksum error occurred (see also the section MD5 CHECKSUM |
o A checksum error occurred (see also the section MD5 CHECKSUM |
279 |
below) |
below) |
280 |
|
|
281 |
More than one alert statement can be used in a process entry. |
More than one alert statement can be used in a service entry. |
282 |
This means that you can send different emails to different |
This means that you can send different emails to different |
283 |
addresses. The full syntax for the alert statement is as |
addresses. The full syntax for the alert statement is as |
284 |
follows (keywords are in capital): |
follows (keywords are in capital): |
294 |
occurs. |
occurs. |
295 |
|
|
296 |
If you only want an alert message sent when a certain event |
If you only want an alert message sent when a certain event |
297 |
occurs for example a timeout or when a program is restarted, |
occurs for example a timeout or when a service is restarted, |
298 |
postfix the alert-statement respectively |
postfix the alert-statement respectively |
299 |
|
|
300 |
alert foo@bar only on { timeout } or |
alert foo@bar only on { timeout } or |
354 |
To: hauk@tildeslash.com |
To: hauk@tildeslash.com |
355 |
Date: Tue, 28 May 2002 20:42:30 +0200 |
Date: Tue, 28 May 2002 20:42:30 +0200 |
356 |
|
|
357 |
Program apache restarted |
Service apache restarted |
358 |
|
|
359 |
Date: Tue May 28 20:42:30 2002 |
Date: Tue May 28 20:42:30 2002 |
360 |
Host: www.tildeslash.com |
Host: www.tildeslash.com |
370 |
mail-format { |
mail-format { |
371 |
from: monit@localhost |
from: monit@localhost |
372 |
subject: apache $EVENT at $DATE |
subject: apache $EVENT at $DATE |
373 |
message: Monit restarted $PROGRAM at $DATE on $HOST. |
message: Monit restarted $SERVICE at $DATE on $HOST. |
374 |
Yours sincerely, |
Yours sincerely, |
375 |
monit |
monit |
376 |
} |
} |
377 |
|
|
378 |
Where the keyword I<from:> is the email address monit should |
Where the keyword I<from:> is the email address monit should |
379 |
pretend it is sending from. It does not have to be a real mail |
pretend it is sending from. It does not have to be a real mail |
380 |
address, but must be a proper formated mail address, on the form; |
address, but must be a proper formated mail address, in the form: |
381 |
name@domain. The keyword I<subject:> is for the email subject |
name@domain. The keyword I<subject:> is for the email subject |
382 |
line. The subject must be on only I<one> line. The I<message:> |
line. The subject must be on only I<one> line. The I<message:> |
383 |
keyword denotes the mail body. If used, this keyword should |
keyword denotes the mail body. If used, this keyword should |
398 |
are fixed and are, "restarted", "timed out", "stopped and |
are fixed and are, "restarted", "timed out", "stopped and |
399 |
"checksum error" |
"checksum error" |
400 |
|
|
401 |
I<$PROGRAM> The program entry name in monitrc |
I<$SERVICE> The service entry name in monitrc (old form I<$PROGRAM> |
402 |
|
is supported too but not recommended). |
403 |
|
|
404 |
I<$DATE> The current time and date (C time style). |
I<$DATE> The current time and date (C time style). |
405 |
|
|
421 |
set mail-format { from: monit@foo.bar.no } |
set mail-format { from: monit@foo.bar.no } |
422 |
|
|
423 |
|
|
424 |
=head1 PROGRAM TIMEOUT |
=head1 SERVICE TIMEOUT |
425 |
|
|
426 |
B<monit> provides a program timeout mechanism for situations |
B<monit> provides a service timeout mechanism for situations |
427 |
where a program simply refuses to start or respond over a longer |
where a service simply refuses to start or respond over a longer |
428 |
period. In cases like this, and particularly if monits poll-cycle |
period. In cases like this, and particularly if monits poll-cycle |
429 |
is low, monit will simply increase the machine load by trying to |
is low, monit will simply increase the machine load by trying to |
430 |
restart the program. |
restart the service. |
431 |
|
|
432 |
The timeout mechanism monit provides is based on two variables, |
The timeout mechanism monit provides is based on two variables, |
433 |
i.e. the number the program has been started and the number of |
i.e. the number the service has been started and the number of |
434 |
poll-cycles. For example, if a program had I<x> restarts within |
poll-cycles. For example, if a service had I<x> restarts within |
435 |
I<y> poll-cycles (where I<x> <= I<y>) then monit will timeout and |
I<y> poll-cycles (where I<x> <= I<y>) then monit will timeout and |
436 |
not (re)start the program on the next cycle. It's a good idea to |
not (re)start the service on the next cycle. It's a good idea to |
437 |
use the alert statement in conjunction with timeout, so if a |
use the alert statement in conjunction with timeout, so if a |
438 |
timeout occurs monit will send an alert notification. A legal |
timeout occurs monit will send an alert notification. A legal |
439 |
(but verbose) way to write a timeout statement for a program |
(but verbose) way to write a timeout statement for a service |
440 |
entry in the control file is: |
entry in the control file is: |
441 |
|
|
442 |
timeout if 3 restarts within 3 cycles |
timeout if 3 restarts within 3 cycles |
445 |
|
|
446 |
timeout(3,3) |
timeout(3,3) |
447 |
|
|
448 |
Where the first digit is the number of program restarts, the |
Where the first digit is the number of service restarts, the |
449 |
second is the number of poll-cycles. If the number of cycles was |
second is the number of poll-cycles. If the number of cycles was |
450 |
reached without a timeout, the program start-counter is reset to |
reached without a timeout, the service start-counter is reset to |
451 |
zero. This provides some granularity to catch expectional cases |
zero. This provides some granularity to catch expectional cases |
452 |
and do a program timeout, but to let occasional program restarts |
and do a service timeout, but to let occasional service restarts |
453 |
happen without having an accumulated timeout. |
happen without having an accumulated timeout. |
454 |
|
|
455 |
If you use timeout (it's optional), then be sure to add an alert |
If you use timeout (it's optional), then be sure to add an alert |
457 |
|
|
458 |
timeout(3, 5) and alert bofh@foo.bar on { timeout } |
timeout(3, 5) and alert bofh@foo.bar on { timeout } |
459 |
|
|
460 |
To have monit check the program again after a timeout, run 'monit |
To have monit check the service again after a timeout, run 'monit |
461 |
start program' from the command line. This will remove the |
start service' from the command line. This will remove the |
462 |
timeout lock in the daemon and make the daemon start and check |
timeout lock in the daemon and make the daemon start and check |
463 |
the program again. |
the service again. |
464 |
|
|
465 |
|
|
466 |
=head1 RESOURCE TESTING |
=head1 RESOURCE TESTING |
554 |
=head1 TIMESTAMP TESTING |
=head1 TIMESTAMP TESTING |
555 |
|
|
556 |
Monit can watch the timestamp of any file or directory associated |
Monit can watch the timestamp of any file or directory associated |
557 |
with a program. |
with a service. |
558 |
|
|
559 |
The full syntax for the timestamp statement is as follows |
The full syntax for the timestamp statement is as follows |
560 |
(keywords are in capital and optional statements in [brackets]): |
(keywords are in capital and optional statements in [brackets]): |
631 |
Monit is able to perfom connection testing via networked ports |
Monit is able to perfom connection testing via networked ports |
632 |
and via unix sockets. |
and via unix sockets. |
633 |
|
|
634 |
If a program listens on one or more sockets, monit can connect to |
If a service listens on one or more sockets, monit can connect to |
635 |
the port (using either tcp or udp) and verify that the program |
the port (using either tcp or udp) and verify that the service |
636 |
will accept a connection and that it is possible to read and |
will accept a connection and that it is possible to read and |
637 |
write to the socket. If a connection is not accepted or if there |
write to the socket. If a connection is not accepted or if there |
638 |
is a problem with the socket i|o, monit will assume that |
is a problem with the socket i|o, monit will assume that |
639 |
something is wrong and restart the program. Additionally, if |
something is wrong and restart the service. Additionally, if |
640 |
monit is compiled with openssl support ssl forged network |
monit is compiled with openssl support ssl forged network |
641 |
services can be tested, too. |
services can be tested, too. |
642 |
|
|
726 |
See also the example section below. |
See also the example section below. |
727 |
|
|
728 |
|
|
729 |
|
=head1 SPACE TESTING |
730 |
|
|
731 |
|
Monit supports test of devices/filesystems. You can check for |
732 |
|
space usage. |
733 |
|
|
734 |
|
Full syntax of space testing statement: |
735 |
|
|
736 |
|
SPACE operator value unit action |
737 |
|
|
738 |
|
I<operator> is a choice of "<",">","!=","==" in c notation, "gt", |
739 |
|
"lt", "eq", "ne" in shell sh notation and "greater", "less", |
740 |
|
"equal", "notequal" in human readable form (if not specified, |
741 |
|
default is EQUAL). |
742 |
|
|
743 |
|
I<unit> is a choice of "B","KB","MB","GB", "%" or long |
744 |
|
alternatives "byte", "kilobyte", "megabyte", "gigabyte", |
745 |
|
"percent". |
746 |
|
|
747 |
|
I<action> is a choice of "ALERT", "RESTART", "STOP": |
748 |
|
|
749 |
|
ALERT sends the user a resource alert. |
750 |
|
|
751 |
|
RESTART restarts the service. |
752 |
|
|
753 |
|
STOP stops the service. If monit stops a service it will not be |
754 |
|
checked by monit anymore nor restarted again later. You must |
755 |
|
explicit start it again from the web interface or from the |
756 |
|
console, like: 'monit start datafs' if you want the monit daemon |
757 |
|
to monitor the service again. |
758 |
|
|
759 |
|
|
760 |
|
=head1 INODE TESTING |
761 |
|
|
762 |
|
Monit supports test of devices/filesystems. You can check for |
763 |
|
inodes usage whenever supported by filesystem. |
764 |
|
|
765 |
|
In the case that the device becomes unavailable, monit will |
766 |
|
call start/stop methods whenever defined if it is running in |
767 |
|
active mode. In the case that it is running in passive mode or |
768 |
|
start/stop methods were not defined, it will just send failure |
769 |
|
alert. |
770 |
|
|
771 |
|
Full syntax of inode testing statement: |
772 |
|
|
773 |
|
INODE(S) operator value [unit] action |
774 |
|
|
775 |
|
I<operator> is a choice of "<",">","!=","==" in c notation, "gt", |
776 |
|
"lt", "eq", "ne" in shell sh notation and "greater", "less", |
777 |
|
"equal", "notequal" in human readable form (if not specified, |
778 |
|
default is EQUAL). |
779 |
|
|
780 |
|
I<unit> is optional. If not specified, value is absolute count |
781 |
|
of inodes. You can use "%" character or long alternative "percent" |
782 |
|
as unit. |
783 |
|
|
784 |
|
I<action> is a choice of "ALERT", "RESTART", "STOP": |
785 |
|
|
786 |
|
ALERT sends the user a resource alert. |
787 |
|
|
788 |
|
RESTART restarts the service. |
789 |
|
|
790 |
|
STOP stops the service. If monit stops a service it will not be |
791 |
|
checked by monit anymore nor restarted again later. You must |
792 |
|
explicit start it again from the web interface or from the |
793 |
|
console, like: 'monit start datafs' if you want the monit daemon |
794 |
|
to monitor the service again. |
795 |
|
|
796 |
|
|
797 |
|
=head1 PERMISSION TESTING |
798 |
|
|
799 |
|
Monit can watch file or directory permission. |
800 |
|
|
801 |
|
Full syntax is: |
802 |
|
|
803 |
|
PERM(ISSION) octalnumber |
804 |
|
|
805 |
|
I<octalnumber> defines appropriate file or directory permissions. |
806 |
|
|
807 |
|
In the case that permission test will fail, monit will call |
808 |
|
start/stop methods whenever defined if it is running in active |
809 |
|
mode. In the case that it is running in passive mode or |
810 |
|
start/stop methods were not defined, it will just send failure |
811 |
|
alert. |
812 |
|
|
813 |
|
|
814 |
=head1 MONIT HTTPD |
=head1 MONIT HTTPD |
815 |
|
|
816 |
If specified in the control file, monit will start a monit daemon |
If specified in the control file, monit will start a monit daemon |
817 |
with http support. From a Browser you can then start and stop |
with http support. From a Browser you can then start and stop |
818 |
programs as well as view the status of each program. Also, if |
services as well as view the status of each service. Also, if |
819 |
monit logs to its own file, you can view the content of this |
monit logs to its own file, you can view the content of this |
820 |
logfile in a Browser. |
logfile in a Browser. |
821 |
|
|
901 |
be able to use the following console commands. |
be able to use the following console commands. |
902 |
|
|
903 |
'monit stop' |
'monit stop' |
904 |
'monit start program' |
'monit start service' |
905 |
'monit stop program' |
'monit stop service' |
906 |
'monit restart program' |
'monit restart service' |
907 |
'monit -g groupname start' |
'monit -g groupname start' |
908 |
'monit -g groupname stop' |
'monit -g groupname stop' |
909 |
'monit -g groupname restart' |
'monit -g groupname restart' |
910 |
|
|
911 |
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 |
912 |
deamon (via the HTTP protocol) to execute the above commands. |
deamon (via the HTTP protocol) to execute the above commands. |
913 |
That is, the daemon is requested to start and stop the programs. |
That is, the daemon is requested to start and stop the services. |
914 |
This ensures that a daemon will not restart a program that you |
This ensures that a daemon will not restart a service that you |
915 |
requested to stop and that (any) timeout lock will be removed |
requested to stop and that (any) timeout lock will be removed |
916 |
from a program when you start it. |
from a service when you start it. |
917 |
|
|
918 |
|
|
919 |
=head2 Monit HTTPD Authentication |
=head2 Monit HTTPD Authentication |
1001 |
checksum for programs. The checksum is used to verify that a |
checksum for programs. The checksum is used to verify that a |
1002 |
program does not change. If a program was changed, monit will |
program does not change. If a program was changed, monit will |
1003 |
send an (optional) alert notification, log an alert message and |
send an (optional) alert notification, log an alert message and |
1004 |
not check the process anymore. The web interface will also show a |
not check the service anymore. The web interface will also show a |
1005 |
checksum warning. |
checksum warning. |
1006 |
|
|
1007 |
The rationale for this feature is security and that monit does |
The rationale for this feature is security and that monit does |
1033 |
You can add as many 'checksum file' statements as you want. Like |
You can add as many 'checksum file' statements as you want. Like |
1034 |
described above, if the checksum for a file changes, monit will |
described above, if the checksum for a file changes, monit will |
1035 |
log a warning, issue an alert message and not check the |
log a warning, issue an alert message and not check the |
1036 |
associated process anymore. |
associated service anymore. |
1037 |
|
|
1038 |
The I<expect> statement is optional and used to specify a md5 |
The I<expect> statement is optional and used to specify a md5 |
1039 |
string monit should expect when testing a file's checksum. If |
string monit should expect when testing a file's checksum. If |
1056 |
=head1 DEPENDENCY CHECKING |
=head1 DEPENDENCY CHECKING |
1057 |
|
|
1058 |
If specified in the control file, monit can do dependency |
If specified in the control file, monit can do dependency |
1059 |
checking before starting or stopping processes. The syntax for |
checking before starting or stopping services. The syntax for |
1060 |
the depend statement is simply: |
the depend statement is simply: |
1061 |
|
|
1062 |
DEPENDS [process]+ |
DEPENDS [service]+ |
1063 |
|
|
1064 |
|
Where B<service> is a service entry name, for instance B<apache> |
1065 |
|
or B<datafs>. |
1066 |
|
|
1067 |
Where B<process> is a process entry name, for instance B<apache>. |
You may add more than one service name of any type (device, |
1068 |
You may add more than one process name or use more than one |
directory, file or process) or use more than one depend statement |
1069 |
depend statement in an entry. |
in an entry. |
1070 |
|
|
1071 |
Processes specified in a I<depends> statement will be checked |
Services specified in a I<depends> statement will be checked |
1072 |
during stop/start operations. If a process is stopped it will |
during stop/start operations. If a service is stopped it will |
1073 |
stop any processes that depends on itself. Likewise, if a process |
stop any services that depends on itself. Likewise, if a service |
1074 |
is started, it will first stop any processes that depends on |
is started, it will first stop any services that depends on |
1075 |
itself and after it is started, start all depending processes |
itself and after it is started, start all depending services |
1076 |
again. |
again. |
1077 |
|
|
1078 |
Consider the following common server setup: |
Consider the following common server setup: |
1079 |
|
|
1080 |
(a) WEB-SERVER -> (b) APPLICATION-SERVER -> (c) DATABASE |
WEB-SERVER -> APPLICATION-SERVER -> DATABASE -> FILESYSTEM |
1081 |
|
(a) (b) (c) (d) |
1082 |
|
|
1083 |
You can set dependencies so that the web-server depends on the |
You can set dependencies so that the web-server depends on the |
1084 |
application server to run before the web-server starts and the |
application server to run before the web-server starts and the |
1085 |
application server depends on the database server. See also the |
application server depends on the database server and the |
1086 |
example section below for examples using the depend statement. |
database depends on filesystem to be mounted before it starts. |
1087 |
|
See also the example section below for examples using the depend |
1088 |
|
statement. |
1089 |
|
|
1090 |
|
|
1091 |
Here we describe how monit will function with the above |
Here we describe how monit will function with the above |
1095 |
|
|
1096 |
=item If no servers are running |
=item If no servers are running |
1097 |
|
|
1098 |
monit will start the servers in the following order: I<c>, I<b>, |
monit will start the servers in the following order: I<d>, I<c>, |
1099 |
I<a> |
I<b>, I<a> |
1100 |
|
|
1101 |
=item If all servers are running |
=item If all servers are running |
1102 |
|
|
1103 |
When you run 'monit stop' this is the stop order: I<a>, I<b>, |
When you run 'monit stop' this is the stop order: I<a>, I<b>, |
1104 |
I<c>. If you run 'monit stop c' then I<a> and I<b> are stopped |
I<c>, I<d>. If you run 'monit stop d' then I<a>, I<b> and I<c> |
1105 |
because they depend on I<c> and finally I<c> is stopped. |
are stopped because they depend on I<d> and finally I<d> is |
1106 |
|
stopped. |
1107 |
|
|
1108 |
=item If I<a> does not run |
=item If I<a> does not run |
1109 |
|
|
1119 |
When monit runs it will first stop I<a> and I<b> then start I<c> |
When monit runs it will first stop I<a> and I<b> then start I<c> |
1120 |
and finally start I<b> then I<a>. |
and finally start I<b> then I<a>. |
1121 |
|
|
1122 |
|
=item If I<d> does not run |
1123 |
|
|
1124 |
|
When monit runs it will first stop I<a>, I<b> and I<c> then start |
1125 |
|
I<d> and finally start I<c>, I<b> then I<a>. |
1126 |
|
|
1127 |
=item If the control file contains a depend loop. |
=item If the control file contains a depend loop. |
1128 |
|
|
1129 |
A depend loop is for example; a->b and b->a or a->b->c->a. |
A depend loop is for example; a->b and b->a or a->b->c->a. |
1130 |
|
|
1131 |
When monit starts it will check for any such loops and complain |
When monit starts it will check for any such loops and complain |
1132 |
and exit if a loop was found. It will also exit with a complaint |
and exit if a loop was found. It will also exit with a complaint |
1133 |
if a depend statement was used that does not point to any process |
if a depend statement was used that does not point to any service |
1134 |
in the controlfile. |
in the controlfile. |
1135 |
|
|
1136 |
=back |
=back |
1149 |
=head2 Run Control Syntax |
=head2 Run Control Syntax |
1150 |
|
|
1151 |
Comments begin with a '#' and extend through the end of the line. |
Comments begin with a '#' and extend through the end of the line. |
1152 |
Otherwise the file consists of a series of program entries or |
Otherwise the file consists of a series of service entries or |
1153 |
global option statements in a free-format, token-oriented syntax. |
global option statements in a free-format, token-oriented syntax. |
1154 |
|
|
1155 |
There are three kinds of tokens: grammar keywords, numbers (i.e. |
There are three kinds of tokens: grammar keywords, numbers (i.e. |
1159 |
string). An unquoted string is any whitespace-delimited token, |
string). An unquoted string is any whitespace-delimited token, |
1160 |
containing characters and/or numbers. |
containing characters and/or numbers. |
1161 |
|
|
1162 |
Each program entry consists of the keywords `check', followed by |
Each service entry consists of the keywords `check', followed by |
1163 |
a unique descriptive name for the program, which is again |
a type of service. There are currently four types of services |
1164 |
followed by a path to the program's pidfile. A check entry can |
supported: |
1165 |
have a number of optional statements. These statements are |
|
1166 |
described below and in the example section. |
1.) device |
1167 |
|
2.) directory |
1168 |
|
3.) file |
1169 |
|
4.) process |
1170 |
|
|
1171 |
|
Unique descriptive name for the service follows service type |
1172 |
|
specification. It is used by monit to refer this service |
1173 |
|
internally and in all interactions with user. |
1174 |
|
|
1175 |
|
Name is followed by `path' keyword which is followed depending on |
1176 |
|
the type of service: |
1177 |
|
|
1178 |
|
1.) device |
1179 |
|
By a path to the device block special file, mountpoint, file |
1180 |
|
or directory which is part of the filesystem. It is recommended |
1181 |
|
to use block special file directly (for example /dev/hda1 on |
1182 |
|
Linux or /dev/dsk/c0t0d0s1 on Solaris, etc.) If you use |
1183 |
|
mountpoint (for example /data), be carefull, because if the |
1184 |
|
device is dismounted it still exists but it is part of superior |
1185 |
|
filesystem. |
1186 |
|
|
1187 |
|
In the case that the device becomes unavailable, monit will |
1188 |
|
call start/stop methods whenever defined if it is running in |
1189 |
|
active mode. In the case that it is running in passive mode or |
1190 |
|
start/stop methods were not defined, it will just send failure |
1191 |
|
alert. |
1192 |
|
|
1193 |
|
2.) directory |
1194 |
|
By a path to the directory (surprise :) |
1195 |
|
|
1196 |
|
In the case that the directory doesn't exist any more |
1197 |
|
monit will call start/stop methods whenever defined if it is |
1198 |
|
running in active mode. In the case that it is running in |
1199 |
|
passive mode or start/stop methods were not defined, it will |
1200 |
|
just send failure alert. |
1201 |
|
|
1202 |
|
3.) file |
1203 |
|
By a path to the file. |
1204 |
|
|
1205 |
|
In the case that the file doesn't exist any more |
1206 |
|
monit will call start/stop methods whenever defined if it is |
1207 |
|
running in active mode. In the case that it is running in |
1208 |
|
passive mode or start/stop methods were not defined, it will |
1209 |
|
just send failure alert. |
1210 |
|
|
1211 |
|
4.) process |
1212 |
|
By a path to the program's pidfile. For this type of service you |
1213 |
|
can use keyword `pidfile' as predecesor of pidfile path instead |
1214 |
|
of `path' keyword (for backward compatibility). |
1215 |
|
|
1216 |
|
|
1217 |
|
A check entry can have a number of optional statements. Each type |
1218 |
|
of service (device, directory, file, process) supports subset of |
1219 |
|
these options, complete list follows: |
1220 |
|
|
1221 |
|
check device service1 with path /dev/hdb1 |
1222 |
|
start |
1223 |
|
stop |
1224 |
|
timeout |
1225 |
|
every |
1226 |
|
alert |
1227 |
|
mode |
1228 |
|
group |
1229 |
|
depend |
1230 |
|
inode |
1231 |
|
space |
1232 |
|
|
1233 |
|
check directory service2 with path /mydir |
1234 |
|
start |
1235 |
|
stop |
1236 |
|
timeout |
1237 |
|
every |
1238 |
|
alert |
1239 |
|
mode |
1240 |
|
group |
1241 |
|
depend |
1242 |
|
checksum |
1243 |
|
timestamp |
1244 |
|
perm |
1245 |
|
|
1246 |
|
check file service3 with path /mydir/myfile |
1247 |
|
start |
1248 |
|
stop |
1249 |
|
timeout |
1250 |
|
every |
1251 |
|
alert |
1252 |
|
mode |
1253 |
|
group |
1254 |
|
depend |
1255 |
|
checksum |
1256 |
|
timestamp |
1257 |
|
perm |
1258 |
|
|
1259 |
|
check process service4 with {pidfile|path} /var/run/myproc.pid |
1260 |
|
start |
1261 |
|
stop |
1262 |
|
host |
1263 |
|
unixsocket |
1264 |
|
resource |
1265 |
|
timeout |
1266 |
|
every |
1267 |
|
alert |
1268 |
|
mode |
1269 |
|
group |
1270 |
|
depend |
1271 |
|
checksum |
1272 |
|
timestamp |
1273 |
|
|
1274 |
|
These statements are described below and in the example section. |
1275 |
|
|
1276 |
You can use noise keywords like 'if', `and', `with(in)', `has', |
You can use noise keywords like 'if', `and', `with(in)', `has', |
1277 |
`using', 'use', 'on(ly)' and `program' anywhere in an entry to |
`using', 'use', 'on(ly)', `usage' and `program(s)' anywhere in |
1278 |
make it resemble English. They're ignored, but can make entries |
an entry to make it resemble English. They're ignored, but can |
1279 |
much easier to read at a glance. The punctuation characters ';' |
make entries much easier to read at a glance. The punctuation |
1280 |
',' and '=' are also ignored. Keywords are case insensitive. |
characters ';' ',' and '=' are also ignored. Keywords are case |
1281 |
|
insensitive. |
1282 |
|
|
1283 |
Here are the legal global keywords: |
Here are the legal global keywords: |
1284 |
|
|
1323 |
optional part of the set httpd statement. |
optional part of the set httpd statement. |
1324 |
|
|
1325 |
|
|
1326 |
Here are the legal program entry keywords: |
Here are the legal service entry keywords: |
1327 |
|
|
1328 |
Keyword Function |
Keyword Function |
1329 |
------------------------------------------------------------ |
------------------------------------------------------------ |
1330 |
check Starts an entry and must be followed by a |
check Starts an entry and must be followed by type |
1331 |
descriptive name for the program. |
of monitored service {device|directory|file| |
1332 |
pidfile Specify the programs pidfile. Every |
process} and descriptive name for the service. |
1333 |
program must create a pidfile with its |
pidfile Specify the process pidfile. Every |
1334 |
current process id |
process must create a pidfile with its |
1335 |
group Specify a groupname for a program entry. |
current process id. This statement is possible |
1336 |
|
to use with process monitoring type only (for |
1337 |
|
backward compatibility). You can use path |
1338 |
|
statement with process monitoring type as well |
1339 |
|
(see bellow). |
1340 |
|
path Must be followed by a path to the block |
1341 |
|
special file for filesystem (device), regular |
1342 |
|
file, directory or process's pidfile. |
1343 |
|
group Specify a groupname for a service entry. |
1344 |
start The program for starting the specified |
start The program for starting the specified |
1345 |
process. Full path is required. This |
service. Full path is required. This |
1346 |
statement is optional. |
statement is optional. |
1347 |
uid and gid Optional part of the start statement. May |
uid and gid Optional part of the start statement. May |
1348 |
be used to specify a user id and a group id |
be used to specify a user id and a group id |
1351 |
number. This extension can only be used if |
number. This extension can only be used if |
1352 |
the super-user is running monit. |
the super-user is running monit. |
1353 |
stop The program for stopping the specified |
stop The program for stopping the specified |
1354 |
process -- full path is required. This |
service. Full path is required. This |
1355 |
statement is optional. |
statement is optional. |
1356 |
host The hostname or IP address to test the port |
host The hostname or IP address to test the port |
1357 |
at. This keyword can only be used together |
at. This keyword can only be used together |
1391 |
unix(socket) Specifies a unix socket file and used like |
unix(socket) Specifies a unix socket file and used like |
1392 |
the port statement above to test a Unix |
the port statement above to test a Unix |
1393 |
domain network socket connection. |
domain network socket connection. |
1394 |
timeout Define program timeout. Must be followed by |
timeout Define service timeout. Must be followed by |
1395 |
two digits. The first digit is max number of |
two digits. The first digit is max number of |
1396 |
restarts for the program. The second digit |
restarts for the service. The second digit |
1397 |
is the cycle interval to test restarts. |
is the cycle interval to test restarts. |
1398 |
This statement is optional |
This statement is optional |
1399 |
alert Specifies an email address for notification |
alert Specifies an email address for notification |
1418 |
statement are allowed. |
statement are allowed. |
1419 |
every Validate this entry only at every n poll |
every Validate this entry only at every n poll |
1420 |
cycle. Usefull in daemon mode when the |
cycle. Usefull in daemon mode when the |
1421 |
poll-cycle is short and the program takes |
poll-cycle is short and the service takes |
1422 |
some time to start. |
some time to start. |
1423 |
mode Must be followed either by the keyword active, |
mode Must be followed either by the keyword active, |
1424 |
passive or manual. If active, monit will restart |
passive or manual. If active, monit will restart |
1425 |
the program if it is not running (this is the |
the service if it is not running (this is the |
1426 |
default behaviour). If passive, monit will not |
default behaviour). If passive, monit will not |
1427 |
(re)start the program if it is not running - it |
(re)start the service if it is not running - it |
1428 |
will only monitor and send alerts (resource |
will only monitor and send alerts (resource |
1429 |
related restart and stop options are ignored |
related restart and stop options are ignored |
1430 |
in this mode also). If manual, monit will enter |
in this mode also). If manual, monit will enter |
1457 |
is the same as above. |
is the same as above. |
1458 |
totalmemkbyte The equivalent to totalmemusage but with amounts |
totalmemkbyte The equivalent to totalmemusage but with amounts |
1459 |
in Kb instead of percentages. |
in Kb instead of percentages. |
1460 |
depends (on) Must be followed by the name of a process this |
space Must be followed by a compare operator, integer |
1461 |
process depends on to run before it starts. |
number, unit {B|KB|MB|GB|%|byte|kilobyte| |
1462 |
|
megabyte|gigabyte|percent} and action. |
1463 |
|
inode(s) Must be followed by a compare operator, integer |
1464 |
|
number, optionaly by percent sign (if not, the |
1465 |
|
limit is absolute) and action (required). |
1466 |
|
perm(ission) Must be followed by an octal number describing |
1467 |
|
permissions. |
1468 |
|
depends (on) Must be followed by the name of a service this |
1469 |
|
service depends on to run before it starts. |
1470 |
|
|
1471 |
|
|
1472 |
Here's the complete list of reserved B<keywords> used by monit: |
Here's the complete list of reserved B<keywords> used by monit: |
1482 |
I<imap>, I<ssh>, I<dwp>, I<ldap2>, I<ldap3>, I<request>, |
I<imap>, I<ssh>, I<dwp>, I<ldap2>, I<ldap3>, I<request>, |
1483 |
I<cpuusage>, I<memusage>, I<memkbyte>, I<totalmemusage>, |
I<cpuusage>, I<memusage>, I<memkbyte>, I<totalmemusage>, |
1484 |
I<totalmemkbyte>, I<children>, I<loadavg>, I<timestamp>, |
I<totalmemkbyte>, I<children>, I<loadavg>, I<timestamp>, |
1485 |
I<second(s)>, I<minute(s)>, I<hour(s)> and I<day(s)>. |
I<second(s)>, I<minute(s)>, I<hour(s)>, I<day(s)>, I<space>, |
1486 |
|
I<inode>, I<perm>, I<process>, I<file>, I<directory> and I<device> |
1487 |
|
|
1488 |
And here is a complete list of B<noise keywords> ignored by |
And here is a complete list of B<noise keywords> ignored by |
1489 |
monit: |
monit: |
1490 |
|
|
1491 |
I<if>, I<is>, I<are>, I<on(ly)>, I<with(in)>, I<and>, I<has>, |
I<if>, I<is>, I<are>, I<on(ly)>, I<with(in)>, I<and>, I<has>, |
1492 |
I<using>, I<use>, I<the>, I<sum>, I<restarts>, I<program(s)>, |
I<using>, I<use>, I<the>, I<sum>, I<restarts>, I<program(s)>, |
1493 |
I<cycle(s)>, I<than>, I<then>, I<for>. |
I<cycle(s)>, I<than>, I<then>, I<for>, I<usage>. |
1494 |
|
|
1495 |
B<Note:> If the I<start> or I<stop> programs are shell scripts, |
B<Note:> If the I<start> or I<stop> programs are shell scripts, |
1496 |
then the script must begin with C<#!> and the remainder of the |
then the script must begin with C<#!> and the remainder of the |
1509 |
The simplest form is just the check statement. In this example we |
The simplest form is just the check statement. In this example we |
1510 |
check to see if the server is running and log a message if not: |
check to see if the server is running and log a message if not: |
1511 |
|
|
1512 |
check resin with pidfile /usr/local/resin/srun.pid |
check process resin with pidfile /usr/local/resin/srun.pid |
1513 |
|
|
1514 |
To have monit start the server if it's not running, add a start |
To have monit start the server if it's not running, add a start |
1515 |
statement: |
statement: |
1516 |
|
|
1517 |
check resin with pidfile /usr/local/resin/srun.pid |
check process resin with pidfile /usr/local/resin/srun.pid |
1518 |
start program = "/usr/local/resin/bin/srun.sh start" |
start program = "/usr/local/resin/bin/srun.sh start" |
1519 |
|
|
1520 |
Here's a more advanced example for monitoring an apache |
Here's a more advanced example for monitoring an apache |
1524 |
for a process restart is to first execute the stop-program, wait |
for a process restart is to first execute the stop-program, wait |
1525 |
for the process to stop and then execute the start-program. |
for the process to stop and then execute the start-program. |
1526 |
|
|
1527 |
check apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1528 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1529 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1530 |
port 80 |
port 80 |
1552 |
In this example we use udp for connection testing to check if the |
In this example we use udp for connection testing to check if the |
1553 |
'named' service is running and also use timeout and alert: |
'named' service is running and also use timeout and alert: |
1554 |
|
|
1555 |
check named with pidfile /var/run/named.pid |
check process named with pidfile /var/run/named.pid |
1556 |
start program = "/etc/init.d/named start" |
start program = "/etc/init.d/named start" |
1557 |
stop program = "/etc/init.d/named stop" |
stop program = "/etc/init.d/named stop" |
1558 |
port 53 use type udp |
port 53 use type udp |
1562 |
The following example illustrate how to check if the service |
The following example illustrate how to check if the service |
1563 |
'sophie' is answering connections on its unix domain socket: |
'sophie' is answering connections on its unix domain socket: |
1564 |
|
|
1565 |
check sophie with pidfile /var/run/sophie.pid |
check process sophie with pidfile /var/run/sophie.pid |
1566 |
start program = "/etc/init.d/sophie start" |
start program = "/etc/init.d/sophie start" |
1567 |
stop program = "/etc/init.d/sophie stop" |
stop program = "/etc/init.d/sophie stop" |
1568 |
unix /var/run/sophie |
unix /var/run/sophie |
1571 |
localhost that answers for several IP-based virtual hosts or |
localhost that answers for several IP-based virtual hosts or |
1572 |
vhosts, hence the host statement before port: |
vhosts, hence the host statement before port: |
1573 |
|
|
1574 |
check apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1575 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1576 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1577 |
host www.sol.no port 80 |
host www.sol.no port 80 |
1583 |
checksum for the underlying apache binary used by the start and |
checksum for the underlying apache binary used by the start and |
1584 |
stop programs. |
stop programs. |
1585 |
|
|
1586 |
check apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1587 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1588 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1589 |
host www.tildeslash.com port 80 |
host www.tildeslash.com port 80 |
1591 |
|
|
1592 |
Some servers are slow starters, like for example Java based |
Some servers are slow starters, like for example Java based |
1593 |
Application Servers. So if we want to keep the poll-cycle low |
Application Servers. So if we want to keep the poll-cycle low |
1594 |
(i.e. < 60 seconds) but allow some programs to take its time to |
(i.e. < 60 seconds) but allow some services to take its time to |
1595 |
start, the B<every> statement is handy: |
start, the B<every> statement is handy: |
1596 |
|
|
1597 |
check dynamo with pidfile /etc/dynamo.pid |
check process dynamo with pidfile /etc/dynamo.pid |
1598 |
start program = "/etc/init.d/dynamo start" |
start program = "/etc/init.d/dynamo start" |
1599 |
stop program = "/etc/init.d/dynamo stop" |
stop program = "/etc/init.d/dynamo stop" |
1600 |
port 8840 |
port 8840 |
1602 |
|
|
1603 |
Here is an example where we group together two database entries. |
Here is an example where we group together two database entries. |
1604 |
The mode statement is also illustrated in the first entry and |
The mode statement is also illustrated in the first entry and |
1605 |
have the effect that monit will not try to (re)start this program |
have the effect that monit will not try to (re)start this service |
1606 |
if it is not running: |
if it is not running: |
1607 |
|
|
1608 |
check sybase with pidfile /var/run/sybase.pid |
check process sybase with pidfile /var/run/sybase.pid |
1609 |
start program = "/etc/init.d/sybase start" |
start program = "/etc/init.d/sybase start" |
1610 |
stop program = "/etc/init.d/sybase stop" |
stop program = "/etc/init.d/sybase stop" |
1611 |
mode passive |
mode passive |
1612 |
group database |
group database |
1613 |
|
|
1614 |
check oracle with pidfile /var/run/oracle.pid |
check process oracle with pidfile /var/run/oracle.pid |
1615 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1616 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1617 |
mode active # Not necessary really, since this is the default |
mode active # Not necessary really, since this is the default |
1626 |
memory usage over 100Mb for five cycles or if the machines load |
memory usage over 100Mb for five cycles or if the machines load |
1627 |
average is beyond 10 for 8 cycles: |
average is beyond 10 for 8 cycles: |
1628 |
|
|
1629 |
check apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1630 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1631 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1632 |
if cpuusage > 60.0 for 2 cycles then alert |
if cpuusage > 60.0 for 2 cycles then alert |
1638 |
In this example we demonstrate usage of the extended alert |
In this example we demonstrate usage of the extended alert |
1639 |
statement: |
statement: |
1640 |
|
|
1641 |
check apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1642 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1643 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1644 |
host www.tildeslash.com port 80 |
host www.tildeslash.com port 80 |
1662 |
up apache to use oracle as a backend, and if oracle is restarted, |
up apache to use oracle as a backend, and if oracle is restarted, |
1663 |
apache must be restarted as well. |
apache must be restarted as well. |
1664 |
|
|
1665 |
check apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1666 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1667 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1668 |
depends on oracle |
depends on oracle |
1669 |
|
|
1670 |
check oracle with pidfile /var/run/oracle.pid |
check process oracle with pidfile /var/run/oracle.pid |
1671 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1672 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1673 |
port 9001 |
port 9001 |
1677 |
Dependencies are setup so should oracle be restarted then both |
Dependencies are setup so should oracle be restarted then both |
1678 |
apache and the weblogic application server are also restarted. |
apache and the weblogic application server are also restarted. |
1679 |
|
|
1680 |
check apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1681 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1682 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1683 |
depends on weblogic |
depends on weblogic |
1684 |
|
|
1685 |
check weblogic with pidfile /var/run/weblogic.pid |
check process weblogic with pidfile /var/run/weblogic.pid |
1686 |
start program = "/etc/init.d/weblogic start" |
start program = "/etc/init.d/weblogic start" |
1687 |
stop program = "/etc/init.d/weblogic stop" |
stop program = "/etc/init.d/weblogic stop" |
1688 |
depends on oracle |
depends on oracle |
1689 |
|
|
1690 |
check oracle with pidfile /var/run/oracle.pid |
check process oracle with pidfile /var/run/oracle.pid |
1691 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1692 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1693 |
port 9001 |
port 9001 |
1694 |
|
|
1695 |
|
|
1696 |
Next, we have 2 programs oracle-import and oracle-export that |
Next, we have 2 services oracle-import and oracle-export that |
1697 |
need to be restarted if oracle is restarted, but are independent |
need to be restarted if oracle is restarted, but are independent |
1698 |
of each other. |
of each other. |
1699 |
|
|
1700 |
check oracle with pidfile /var/run/oracle.pid |
check process oracle with pidfile /var/run/oracle.pid |
1701 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1702 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1703 |
port 9001 |
port 9001 |
1704 |
|
|
1705 |
check oracle-import with pidfile /var/run/oracle-import.pid |
check process oracle-import with pidfile /var/run/oracle-import.pid |
1706 |
start program = "/etc/init.d/oracle-import start" |
start program = "/etc/init.d/oracle-import start" |
1707 |
stop program = "/etc/init.d/oracle-import stop" |
stop program = "/etc/init.d/oracle-import stop" |
1708 |
depends on oracle |
depends on oracle |
1709 |
|
|
1710 |
check oracle-export with pidfile /var/run/oracle-export.pid |
check process oracle-export with pidfile /var/run/oracle-export.pid |
1711 |
start program = "/etc/init.d/oracle-export start" |
start program = "/etc/init.d/oracle-export start" |
1712 |
stop program = "/etc/init.d/oracle-export stop" |
stop program = "/etc/init.d/oracle-export stop" |
1713 |
depends on oracle |
depends on oracle |
1714 |
|
|
1715 |
Finally an example with all statements: |
Finally an example with all statements: |
1716 |
|
|
1717 |
check apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1718 |
group server |
group server |
1719 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1720 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1775 |
# |
# |
1776 |
# local services on every host |
# local services on every host |
1777 |
# |
# |
1778 |
check heartbeat with pidfile /var/run/heartbeat.pid |
check process heartbeat with pidfile /var/run/heartbeat.pid |
1779 |
start program = "/etc/init.d/heartbeat start" |
start program = "/etc/init.d/heartbeat start" |
1780 |
stop program = "/etc/init.d/heartbeat start" |
stop program = "/etc/init.d/heartbeat start" |
1781 |
mode active |
mode active |
1782 |
alert foo@bar |
alert foo@bar |
1783 |
group local |
group local |
1784 |
|
|
1785 |
check postfix with pidfile /var/spool/postfix/pid/master.pid |
check process postfix with pidfile /var/spool/postfix/pid/master.pid |
1786 |
start program = "/etc/init.d/postfix start" |
start program = "/etc/init.d/postfix start" |
1787 |
stop program = "/etc/init.d/postfix stop" |
stop program = "/etc/init.d/postfix stop" |
1788 |
mode active |
mode active |
1793 |
# node1 services |
# node1 services |
1794 |
# |
# |
1795 |
|
|
1796 |
check apache with pidfile /var/apache/logs/httpd.pid |
check process apache with pidfile /var/apache/logs/httpd.pid |
1797 |
start program = "/etc/init.d/apache start" |
start program = "/etc/init.d/apache start" |
1798 |
stop program = "/etc/init.d/apache stop" |
stop program = "/etc/init.d/apache stop" |
1799 |
depends named |
depends named |
1801 |
mode manual |
mode manual |
1802 |
group node1 |
group node1 |
1803 |
|
|
1804 |
check named with pidfile /var/tmp/named.pid |
check process named with pidfile /var/tmp/named.pid |
1805 |
start program = "/etc/init.d/named start" |
start program = "/etc/init.d/named start" |
1806 |
stop program = "/etc/init.d/named stop" |
stop program = "/etc/init.d/named stop" |
1807 |
alert foo@bar |
alert foo@bar |
1812 |
# node2 services |
# node2 services |
1813 |
# |
# |
1814 |
|
|
1815 |
check named-slave with pidfile /var/tmp/named-slave.pid |
check process named-slave with pidfile /var/tmp/named-slave.pid |
1816 |
start program = "/etc/init.d/named-slave start" |
start program = "/etc/init.d/named-slave start" |
1817 |
stop program = "/etc/init.d/named-slave stop" |
stop program = "/etc/init.d/named-slave stop" |
1818 |
mode manual |
mode manual |
1819 |
alert foo@bar |
alert foo@bar |
1820 |
group node2 |
group node2 |
1821 |
|
|
1822 |
check squid with pidfile /var/squid/logs/squid.pid |
check process squid with pidfile /var/squid/logs/squid.pid |
1823 |
start program = "/etc/init.d/squid start" |
start program = "/etc/init.d/squid start" |
1824 |
stop program = "/etc/init.d/squid stop" |
stop program = "/etc/init.d/squid stop" |
1825 |
depends named-slave |
depends named-slave |
1919 |
=head1 SIGNALS |
=head1 SIGNALS |
1920 |
|
|
1921 |
If a monit daemon is running, SIGUSR1 wakes it up from its sleep |
If a monit daemon is running, SIGUSR1 wakes it up from its sleep |
1922 |
phase and forces a poll of all processes. SIGTERM will gracefully |
phase and forces a poll of all services. SIGTERM will gracefully |
1923 |
terminate a monit daemon. This signal is sent to a monit daemon |
terminate a monit daemon. This signal is sent to a monit daemon |
1924 |
if monit is started with the I<quit> action argument. |
if monit is started with the I<quit> action argument. |
1925 |
|
|