42 |
B<-l> I<logfile> |
B<-l> I<logfile> |
43 |
Print log information to this file. |
Print log information to this file. |
44 |
|
|
45 |
|
B<-p> I<pidfile> |
46 |
|
Use this lock file in daemon mode. |
47 |
|
|
48 |
B<-d> I<n> |
B<-d> I<n> |
49 |
Run as a daemon once per I<n> seconds |
Run as a daemon once per I<n> seconds |
50 |
|
|
124 |
file (and of course, do not use the -l switch) |
file (and of course, do not use the -l switch) |
125 |
|
|
126 |
|
|
|
=head1 MONIT LOCK FILE |
|
|
|
|
|
monit utilize a lock file to prevent concurrent runs. That is, |
|
|
only one monit process is permitted per user. The lock file |
|
|
contains the process id (pid) from the current running monit |
|
|
process and if monit is run by the root user the location of the |
|
|
lock file is either I</var/run/monit.pid> or I</etc/monit.pid> |
|
|
depending on the operating system. If monit is run by a non-root |
|
|
user the location of the lock file is in the users home |
|
|
directory, I<$HOME/.monit.pid>. When a monit process is stopped |
|
|
it removes the lock file before it exit. |
|
|
|
|
|
If you want, you can change the location of the monit lock file |
|
|
via this global set-statement in the monitrc control file: |
|
|
(keywords are in capital) |
|
|
|
|
|
SET PIDFILE {pidfile} |
|
|
|
|
|
For instance, I<set pidfile /run/monit.pid> |
|
|
|
|
|
|
|
127 |
=head1 DAEMON MODE |
=head1 DAEMON MODE |
128 |
|
|
129 |
The I<-d interval> option runs monit in daemon mode. You must |
The I<-d interval> option runs monit in daemon mode. You must |
163 |
after logging the appropriate error message. |
after logging the appropriate error message. |
164 |
|
|
165 |
|
|
166 |
|
=head2 MONIT LOCK FILE |
167 |
|
|
168 |
|
monit utilize a lock file to prevent concurrent runs in daemon |
169 |
|
mode. That is, only one monit daemon is permitted per user. The |
170 |
|
lock file contains the process id (pid) from the current running |
171 |
|
monit daemon. If monit is run by the root user the location of |
172 |
|
the lock file is either I</var/run/monit.pid> or |
173 |
|
I</etc/monit.pid> depending on the operating system. For a |
174 |
|
non-root user the location of the lock file is |
175 |
|
I<$HOME/.monit.pid>. The lock file is removed when a monit daemon |
176 |
|
is stopped. |
177 |
|
|
178 |
|
In very special cases, you may need to control the location of |
179 |
|
the lock file. For instance if you run monit as root on two |
180 |
|
different machines but with the same file system you will need to |
181 |
|
change the location of the monit lock file via the I<-p> option. |
182 |
|
You will also have to submit the '-p pidfile' to every subsequent |
183 |
|
calls to monit if you use this option. You can also set the |
184 |
|
location of the lock file on a more permanent basis via this |
185 |
|
global set-statement in the monitrc control file: (keywords are |
186 |
|
in capital) |
187 |
|
|
188 |
|
SET PIDFILE {pidfile} |
189 |
|
|
190 |
|
For instance, I<set pidfile /run/monit.pid>. But unless it is |
191 |
|
important for you, you do not have to think about the location of |
192 |
|
the lock file. |
193 |
|
|
194 |
|
|
195 |
=head1 INIT SUPPORT |
=head1 INIT SUPPORT |
196 |
|
|
197 |
Monit can be run and controlled from I<init>. In the (unlikely) |
Monit can be run and controlled from I<init>. In the (unlikely) |
621 |
daemon to monitor the service again. |
daemon to monitor the service again. |
622 |
|
|
623 |
The timestamp statement is useful for monitoring systems, that |
The timestamp statement is useful for monitoring systems, that |
624 |
are able to report it's state by changing the timestamp of |
are able to report its state by changing the timestamp of certain |
625 |
certain state files. For instance the I<iPlanet Messaging server |
state files. For instance the I<iPlanet Messaging server stored |
626 |
stored process> system update the timestamp of: |
process> system update the timestamp of: |
627 |
|
|
628 |
o stored.ckp |
o stored.ckp |
629 |
o stored.lcu |
o stored.lcu |
646 |
|
|
647 |
As mentioned above, you can also use the timestamp statement for |
As mentioned above, you can also use the timestamp statement for |
648 |
monitoring directories for changes. If files are added or removed |
monitoring directories for changes. If files are added or removed |
649 |
to/from a directory, it's timestamp is changed: |
to/from a directory, its timestamp is changed: |
650 |
|
|
651 |
if timestamp "/foo/directory" > 1 hour then alert |
if timestamp "/foo/directory" > 1 hour then alert |
652 |
|
|
765 |
DEPENDS [process]+ |
DEPENDS [process]+ |
766 |
|
|
767 |
Where B<process> is a process entry name, for instance B<apache>. |
Where B<process> is a process entry name, for instance B<apache>. |
768 |
You may add more than one process name in a depends statement. |
You may add more than one process name or use more than one |
769 |
|
depend statement in a check entry. |
770 |
|
|
771 |
Processes specified in a I<depends> statement will be checked |
Processes specified in a I<depends> statement will be checked |
772 |
during stop/start operations. If a process is stopped it will |
during stop/start operations. If a process is stopped it will |
814 |
and finally start I<b> then I<a>. |
and finally start I<b> then I<a>. |
815 |
|
|
816 |
|
|
817 |
=item If monitrc contains a dependency loop |
=item If monitrc contains a depend loop. A depend loop is for |
818 |
|
example; a->b and b->a or a->b->c->a. |
|
A dependency loop is for example; a->b and b->a or a->b->c->a. |
|
819 |
|
|
820 |
When monit starts it will check for any such loops and complain |
When monit starts it will check for any such loops and complain |
821 |
and exit if a depend loop is found. It will also exit with a |
and exit if a loop was found. It will also exit with a complaint |
822 |
complaint if a depend statement was used that does not point to |
if a depend statement was used that does not point to any |
823 |
any processes in the controlfile. |
processes in the controlfile. |
824 |
|
|
825 |
=back |
=back |
826 |
|
|