271 |
monit will raise an email alert if: |
monit will raise an email alert if: |
272 |
|
|
273 |
o A service timed out |
o A service timed out |
|
o A service was started or restarted |
|
274 |
o A service was stopped |
o A service was stopped |
275 |
|
o A port connection failed |
276 |
o A timestamp test didn't pass |
o A timestamp test didn't pass |
277 |
|
o A service was started or restarted |
278 |
o A resource statement match (see also the section RESOURCE |
o A resource statement match (see also the section RESOURCE |
279 |
TESTING below) |
TESTING below) |
280 |
o A checksum error occurred (see also the section MD5 CHECKSUM |
o A checksum error occurred (see also the section MD5 CHECKSUM |
292 |
alert foo@bar |
alert foo@bar |
293 |
|
|
294 |
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 |
295 |
timeout, start, restart, checksum, resource, stop or timestamp |
timeout, start, restart, checksum, resource, stop, connection or |
296 |
error occurs. |
timestamp error occurs. |
297 |
|
|
298 |
If you only want an alert message sent when a certain event |
If you only want an alert message sent when a certain event |
299 |
occurs for example a timeout or when a service is restarted, |
occurs for example a timeout or when a service is restarted, |
315 |
It is also possible to combine events and send mail to different |
It is also possible to combine events and send mail to different |
316 |
email addresses like: |
email addresses like: |
317 |
|
|
318 |
alert foo@bar { restart, timeout, resource } |
alert foo@bar { restart, timeout, resource, connection } |
319 |
alert security@bar on { checksum, stop } |
alert security@bar on { checksum, stop } |
320 |
alert manager@bar |
alert manager@bar |
321 |
|
|
322 |
This will send an alert message to foo@bar when a timeout, |
This will send an alert message to foo@bar whenever a restart, |
323 |
resource or restart occurs and a message to security@bar if a |
timeout, resource or connection error occurs and a message to |
324 |
checksum error or stop occurs. And finally, a message to |
security@bar if a checksum or stop error occurs. And finally, a |
325 |
manager@bar whenever any error event occurs. |
message to manager@bar whenever any error event occurs. |
326 |
|
|
327 |
The following alert-statement: |
The following alert-statement: |
328 |
|
|
329 |
alert foo@bar { start |
alert foo@bar {stop |
330 |
stop |
start |
331 |
restart |
restart |
332 |
checksum |
timeout |
333 |
resource |
checksum |
334 |
timeout |
resource |
335 |
timestamp } |
timestamp |
336 |
|
connection} |
337 |
|
|
338 |
is equivalent to: |
is equivalent to: |
339 |
|
|
340 |
alert foo@bar |
alert foo@bar |
341 |
|
|
342 |
which as stated above, will send a message when a timeout, a |
which as stated above, will send a message whenever a timeout, a |
343 |
start, restart, checksum, resource, stop or timestamp error |
start, restart, checksum, resource, stop, connection or timestamp |
344 |
occurs. (If the postfix variant is used, then note that the |
error occurs. (If the postfix variant is used, then note that |
345 |
parenthesis are I<mandatory>). |
the parenthesis are I<mandatory>). |
346 |
|
|
347 |
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 |
348 |
execute> a start or stop program for an entry. B<It is therefor |
execute> a start or stop program for an entry. B<It is therefor |
354 |
by monit: |
by monit: |
355 |
|
|
356 |
From: monit@tildeslash.com |
From: monit@tildeslash.com |
357 |
Subject: monit alert -- Restart apache |
Subject: monit alert -- Restarted apache |
358 |
To: hauk@tildeslash.com |
To: hauk@tildeslash.com |
359 |
Date: Tue, 28 May 2002 20:42:30 +0200 |
Date: Mon, 04 Aug 2003 06:26:54 +0200 |
360 |
|
|
361 |
Restart service apache |
Restarted Service apache |
362 |
|
|
363 |
Date: Tue May 28 20:42:30 2002 |
Date: Tue May 28 20:42:30 2002 |
364 |
Host: www.tildeslash.com |
Host: www.tildeslash.com |
403 |
error", "Resource limit matched", "Timeout", and "Timestamp |
error", "Resource limit matched", "Timeout", and "Timestamp |
404 |
error" |
error" |
405 |
|
|
406 |
I<$SERVICE> The service entry name in monitrc (old form I<$PROGRAM> |
I<$SERVICE> The service entry name in monitrc (old form |
407 |
is supported too but not recommended). |
I<$PROGRAM> is supported too but not recommended). |
408 |
|
|
409 |
I<$DATE> The current time and date (C time style). |
I<$DATE> The current time and date (RFC 822 date style). |
410 |
|
|
411 |
I<$HOST> The name of the host monit is running on |
I<$HOST> The name of the host monit is running on |
412 |
|
|
426 |
set mail-format { from: monit@foo.bar.no } |
set mail-format { from: monit@foo.bar.no } |
427 |
|
|
428 |
|
|
429 |
|
|
430 |
|
|
431 |
=head1 SERVICE TIMEOUT |
=head1 SERVICE TIMEOUT |
432 |
|
|
433 |
B<monit> provides a service timeout mechanism for situations |
B<monit> provides a service timeout mechanism for situations |
470 |
the service again. |
the service again. |
471 |
|
|
472 |
|
|
473 |
|
|
474 |
=head1 RESOURCE TESTING |
=head1 RESOURCE TESTING |
475 |
|
|
476 |
Monit can examine how much system resources a service or the |
Monit can examine how much system resources a service or the |
484 |
testing is as follows (keywords are in capital and optional |
testing is as follows (keywords are in capital and optional |
485 |
statements in [brackets]), |
statements in [brackets]), |
486 |
|
|
487 |
resource operator value [cycles] action |
=over 4 |
488 |
|
|
489 |
|
=item if resource operator value [cycles] then action |
490 |
|
|
491 |
|
=back |
492 |
|
|
493 |
|
|
494 |
I<resource> is a choice of "CPU", "MEMORY", "CHILDREN", |
I<resource> is a choice of "CPU", "MEMORY", "CHILDREN", |
495 |
"TOTALMEMORY", "LOADAVG([1min|5min|15min]): |
"TOTALMEMORY", "LOADAVG([1min|5min|15min]): |
526 |
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 |
527 |
omitted then it is set to one. |
omitted then it is set to one. |
528 |
|
|
529 |
I<action> is a choice of "ALERT", "RESTART", "STOP": |
I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC": |
530 |
|
|
531 |
|
=over 4 |
532 |
|
|
533 |
|
=item * |
534 |
|
|
535 |
|
ALERT ALERT sends the user a resource alert in case the maximum |
536 |
|
number of cycles has been reached. |
537 |
|
|
538 |
ALERT sends the user a resource alert in case the maximum number |
=item * |
|
of cycles has been reached. |
|
539 |
|
|
540 |
RESTART restarts the service in case the maximum number of cycles |
RESTART restarts the service in case the maximum number of cycles |
541 |
has been reached. |
has been reached. |
542 |
|
|
543 |
|
=item * |
544 |
|
|
545 |
STOP stops the service in case the maximum number of cycles has |
STOP stops the service in case the maximum number of cycles has |
546 |
been reached. If monit stops a service it will not be checked by |
been reached. If monit stops a service it will not be checked by |
547 |
monit anymore nor restarted again later. You must explicit start |
monit anymore nor restarted again later. You must explicit start |
549 |
start apache' if you want the monit daemon to monitor the service |
start apache' if you want the monit daemon to monitor the service |
550 |
again. |
again. |
551 |
|
|
552 |
|
=item * |
553 |
|
|
554 |
|
EXEC may be used to execute an arbitrary program. If you choose |
555 |
|
this action you must state the program to be executed. For |
556 |
|
instance; exec "/etc/init.d/network restart" |
557 |
|
|
558 |
|
=back |
559 |
|
|
560 |
|
|
561 |
To calculate the cycles, a counter is raised whenever the |
To calculate the cycles, a counter is raised whenever the |
562 |
expression above is true and it is lowered whenever it is false |
expression above is true and it is lowered whenever it is false |
563 |
(but not below 0). All counters are reseted in case of a |
(but not below 0). All counters are reseted in case of a |
579 |
=head1 TIMESTAMP TESTING |
=head1 TIMESTAMP TESTING |
580 |
|
|
581 |
Monit can watch the timestamp of any file or directory associated |
Monit can watch the timestamp of any file or directory associated |
582 |
with a service. |
with a service. The timestamp statement comes in two flavors. The |
583 |
|
first and basic version is simply to test an existing file for |
584 |
|
timestamp changes and if changed, execute an action. The second, |
585 |
|
and more compound, version is used to test a file or directory |
586 |
|
for various timestamp changes. |
587 |
|
|
588 |
The full syntax for the timestamp statement is as follows |
The full syntax for the timestamp statement is as follows |
589 |
(keywords are in capital and optional statements in [brackets]): |
(keywords are in capital and optional statements in [brackets]): |
590 |
|
|
591 |
TIMESTAMP object [operator] value [unit] action |
=over 4 |
592 |
|
|
593 |
|
=item 1. if TIMESTAMP object was CHANGED then action |
594 |
|
|
595 |
|
=item 2. if TIMESTAMP object [operator] value [unit] then action |
596 |
|
|
597 |
|
=back |
598 |
|
|
599 |
I<object> is a path to the associated file or directory to watch. |
I<object> is a path to the associated file or directory to watch. |
600 |
|
|
608 |
I<unit> is either "SECOND", "MINUTE", "HOUR" or "DAY" (it is also |
I<unit> is either "SECOND", "MINUTE", "HOUR" or "DAY" (it is also |
609 |
possible to use "SECONDS", "MINUTES", "HOURS", or "DAYS"). |
possible to use "SECONDS", "MINUTES", "HOURS", or "DAYS"). |
610 |
|
|
611 |
I<action> is a choice of "ALERT", "RESTART", "STOP": |
I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC": |
612 |
|
|
613 |
|
=over 4 |
614 |
|
|
615 |
o ALERT sends the user a timestamp alert. |
=item * |
616 |
|
|
617 |
|
ALERT sends the user a timestamp alert. |
618 |
|
|
619 |
|
=item * |
620 |
|
|
621 |
|
RESTART restarts the service. |
622 |
|
|
623 |
|
=item * |
624 |
|
|
625 |
|
STOP stops the service. If monit stops a service it will |
626 |
|
not be checked by monit anymore nor restarted again later. You |
627 |
|
must explicit start it again from the web interface or from the |
628 |
|
console, like: 'monit start datafs' if you want the monit daemon |
629 |
|
to monitor the service again. |
630 |
|
|
631 |
o RESTART restarts the service. |
=item * |
632 |
|
|
633 |
o STOP stops the service. If monit stops a service it will not |
EXEC may be used to execute an arbitrary program. If you choose |
634 |
be checked by monit anymore nor restarted again later. You |
this action you must state the program to be executed. For |
635 |
must explicit start it again from the web interface or from |
instance; exec "/bin/rm -f /tmp/foobar" |
636 |
the console, like: 'monit start apache' if you want the monit |
|
637 |
daemon to monitor the service again. |
=back |
638 |
|
|
639 |
The timestamp statement is useful for monitoring systems, that |
|
640 |
are able to report its state by changing the timestamp of certain |
The basic timestamp statement is useful for checking a file for |
641 |
state files. For instance the I<iPlanet Messaging server stored |
changes and then execute an action. This version was written |
642 |
process> system update the timestamp of: |
particularly with configuration files in mind. For instance, if |
643 |
|
you monitor the apache web server you can use this statement to |
644 |
|
restart apache if the I<httpd.conf> (apache's configuration file) |
645 |
|
was changed. Like so: |
646 |
|
|
647 |
|
if timestamp /usr/local/apache/conf/httpd.conf was changed |
648 |
|
then exec "/usr/local/apache/bin/apachectl -k restart" |
649 |
|
|
650 |
|
|
651 |
|
The second timestamp version is useful for monitoring systems, |
652 |
|
that are able to report its state by changing the timestamp of |
653 |
|
certain state files. For instance the I<iPlanet Messaging server |
654 |
|
stored process> system updates the timestamp of: |
655 |
|
|
656 |
o stored.ckp |
o stored.ckp |
657 |
o stored.lcu |
o stored.lcu |
699 |
will accept a connection and that it is possible to read and |
will accept a connection and that it is possible to read and |
700 |
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 |
701 |
is a problem with the socket i|o, monit will assume that |
is a problem with the socket i|o, monit will assume that |
702 |
something is wrong and restart the service. Additionally, if |
something is wrong and execute a specified action for the |
703 |
monit is compiled with openssl support ssl forged network |
service. If monit is compiled with openssl, ssl based network |
704 |
services can be tested, too. |
services can also be tested. |
705 |
|
|
706 |
The full syntax for the port-statement used for connection |
The full syntax for the port-statement used for connection |
707 |
testing is as follows (keywords are in capital and optional |
testing is as follows (keywords are in capital and optional |
708 |
statements in [brackets]) for networked ports, |
statements in [brackets]) for networked ports, |
709 |
|
|
710 |
[HOST hostname] PORT number |
=over 4 |
711 |
[TYPE {TCP|UDP|TCPSSL [SSLAUTO|SSLV2|SSLV3|TLSV1] |
|
712 |
[CERTMD5 md5sum] |
=item if failed [HOST hostname] PORT number |
713 |
}] |
[TYPE {TCP|UDP|TCPSSL [SSLAUTO|SSLV2|SSLV3|TLSV1] |
714 |
[PROTO(COL) {name} [REQUEST {"/path"}]] |
[CERTMD5 md5sum] }] |
715 |
|
[PROTO(COL) {name} [REQUEST {"/path"}]] |
716 |
|
[with TIMEOUT AFTER x SECONDS] |
717 |
|
then action |
718 |
|
|
719 |
|
=back |
720 |
|
|
721 |
or for unix sockets, |
or for unix sockets, |
722 |
|
|
723 |
UNIX(SOCKET) path [TYPE {TCP|UDP}] [PROTO(COL) {name} |
=over 4 |
724 |
[REQUEST {"/path"}]] |
|
725 |
|
=item if failed UNIX(SOCKET) path [TYPE {TCP|UDP}] |
726 |
|
[PROTO(COL) {name} [REQUEST {"/path"}]] |
727 |
|
[with TIMEOUT AFTER x SECONDS] |
728 |
|
then action |
729 |
|
|
730 |
|
=back |
731 |
|
|
732 |
|
Where I<action> is a choice of "ALERT", "RESTART", "STOP" or |
733 |
|
"EXEC": |
734 |
|
|
735 |
|
=over 4 |
736 |
|
|
737 |
|
=item * |
738 |
|
|
739 |
|
ALERT sends the user a connection alert. |
740 |
|
|
741 |
|
=item * |
742 |
|
|
743 |
To have monit check a port connection use the following statement: |
RESTART restarts the service. |
744 |
|
|
745 |
port 80 |
=item * |
746 |
|
|
747 |
|
STOP stops the service. If monit stops a service it will |
748 |
|
not be checked by monit anymore nor restarted again later. You |
749 |
|
must explicit start it again from the web interface or from the |
750 |
|
console, like: 'monit start datafs' if you want the monit daemon |
751 |
|
to monitor the service again. |
752 |
|
|
753 |
|
=item * |
754 |
|
|
755 |
|
EXEC may be used to execute an arbitrary program. If you choose |
756 |
|
this action you must state the program to be executed. For |
757 |
|
instance; exec "/etc/init.d/network restart" |
758 |
|
|
759 |
|
=back |
760 |
|
|
761 |
|
|
762 |
|
To have monit check a port connection and alert you if monit |
763 |
|
cannot connect to the port, use the following statement: |
764 |
|
|
765 |
|
if failed port 80 then alert |
766 |
|
|
767 |
In this case the machine in question is assumed to be |
In this case the machine in question is assumed to be |
768 |
I<localhost> and monit will issue a tcp connection to localhost |
I<localhost> and monit will issue a tcp connection to localhost |
769 |
at port 80. Monit will use tcp by default, if you want to connect |
at port 80. Monit will use tcp by default, if you want to connect |
770 |
with udp, you can specify this after the port-statement; |
with udp, you can specify this after the port-statement; |
771 |
|
|
772 |
port 53 use type udp ('use' is a noise keyword) |
if failed port 53 use type udp ('use' is a noise keyword) |
773 |
|
then alert |
774 |
|
|
775 |
|
monit will stop trying to connect to the port after 5 seconds and |
776 |
|
assume that the server behind the port is down. You may increase |
777 |
|
or decrease the connect timeout by explicitly add the timeout as |
778 |
|
in this example: |
779 |
|
|
780 |
|
if failed port 80 with timeout after 15 seconds then alert |
781 |
|
|
782 |
The I<TCPSSL> statement accepts optionally the md5 sum of the |
The I<TCPSSL> statement accepts optionally the md5 sum of the |
783 |
server's certificate. The md5 sum is matched against the one |
server's certificate. The md5 sum is matched against the one |
789 |
In case a server is listening to a unix socket called |
In case a server is listening to a unix socket called |
790 |
/var/run/mysocket, the following statement can be used: |
/var/run/mysocket, the following statement can be used: |
791 |
|
|
792 |
unix /var/run/mysocket |
if failed unix /var/run/mysocket then alert |
793 |
|
|
794 |
If your machine answers for several virtual hosts you can prefix |
If your machine answers for several virtual hosts you can prefix |
795 |
the port statement with a host-statement like so: |
the port statement with a host-statement like so: |
796 |
|
|
797 |
host www.sol.no port 80 |
if failed host www.sol.no port 80 then alert |
798 |
host shop.sol.no port 443 |
if failed host shop.sol.no port 443 then alert |
799 |
host kvasir.sol.no port 80 |
if failed host kvasir.sol.no port 80 then alert |
800 |
host 10.2.3.4 port 80 |
if failed host 10.2.3.4 port 80 then alert |
801 |
|
|
802 |
And as mentioned above, if you do not specify a host-statement, |
And as mentioned above, if you do not specify a host-statement, |
803 |
I<localhost> is assumed. |
I<localhost> is assumed. |
807 |
can also speak with the server in question to verify that the |
can also speak with the server in question to verify that the |
808 |
server works. For example, the following is used to test a http |
server works. For example, the following is used to test a http |
809 |
server: |
server: |
810 |
|
|
811 |
host www.tildeslash.com port 80 protocol http |
if failed host www.tildeslash.com port 80 protocol http |
812 |
|
then restart |
813 |
|
|
814 |
At the moment monit knows how to speak I<HTTP>, I<SMTP>, I<FTP>, |
At the moment monit knows how to speak I<HTTP>, I<SMTP>, I<FTP>, |
815 |
I<POP>, I<IMAP>, I<NNTP>, I<SSH>, I<DWP>, I<LDAP2>, I<LDAP3> and |
I<POP>, I<IMAP>, I<NNTP>, I<SSH>, I<DWP>, I<LDAP2>, I<LDAP3> and |
816 |
I<RDATE>. |
I<RDATE> and if you have compiled monit with ssl support, monit |
817 |
If you have compiled monit with ssl support, monit can also speak |
can also speak I<HTTPS>, I<FTPS>, I<POPS> and I<IMAPS>. |
|
I<HTTPS>, I<FTPS>, I<POPS> and I<IMAPS>. |
|
818 |
|
|
819 |
Some protocols also support a request statement. This statement |
Some protocols also support a request statement. This statement |
820 |
can be used to ask the server for a special document entity. |
can be used to ask the server for a special document entity. |
822 |
Currently B<only> the I<HTTP> protocol module supports the |
Currently B<only> the I<HTTP> protocol module supports the |
823 |
request statement, such as: |
request statement, such as: |
824 |
|
|
825 |
host www.myhost.com port 80 protocol http |
if failed host www.myhost.com port 80 protocol http |
826 |
request "/data/show.php?a=b&c=d" |
request "/data/show.php?a=b&c=d" |
827 |
|
then restart |
828 |
|
|
829 |
The request should contain an URI string specifying a document |
The request must contain an URI string specifying a document from |
830 |
from the http server. The string will be url encoded by monit |
the http server. The string will be url encoded by monit before |
831 |
before it sends the request to the http server, so it's okay to |
it sends the request to the http server, so it's okay to use url |
832 |
use url unsafe characters in the request. |
unsafe characters in the request. |
833 |
|
|
834 |
If the request statement isn't specified, the default web server |
If the request statement isn't specified, the default web server |
835 |
page will be requested. |
page will be requested. |
840 |
See also the example section below. |
See also the example section below. |
841 |
|
|
842 |
|
|
843 |
|
|
844 |
=head1 SPACE TESTING |
=head1 SPACE TESTING |
845 |
|
|
846 |
Monit supports test of devices/filesystems. You can check for |
Monit supports test of devices/filesystems. You can check for |
847 |
space usage. |
space usage. |
848 |
|
|
849 |
Full syntax of space testing statement: |
The full syntax for the space testing statement is: |
850 |
|
|
851 |
|
=over 4 |
852 |
|
|
853 |
SPACE operator value unit action |
=item if SPACE operator value unit then action |
854 |
|
|
855 |
|
=back |
856 |
|
|
857 |
I<operator> is a choice of "<",">","!=","==" in c notation, "gt", |
I<operator> is a choice of "<",">","!=","==" in c notation, "gt", |
858 |
"lt", "eq", "ne" in shell sh notation and "greater", "less", |
"lt", "eq", "ne" in shell sh notation and "greater", "less", |
863 |
alternatives "byte", "kilobyte", "megabyte", "gigabyte", |
alternatives "byte", "kilobyte", "megabyte", "gigabyte", |
864 |
"percent". |
"percent". |
865 |
|
|
866 |
I<action> is a choice of "ALERT", "RESTART", "STOP": |
I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC": |
867 |
|
|
868 |
|
=over 4 |
869 |
|
|
870 |
|
=item * |
871 |
|
|
872 |
ALERT sends the user a resource alert. |
ALERT sends the user a resource alert. |
873 |
|
|
874 |
|
=item * |
875 |
|
|
876 |
RESTART restarts the service. |
RESTART restarts the service. |
877 |
|
|
878 |
STOP stops the service. If monit stops a service it will not be |
=item * |
879 |
checked by monit anymore nor restarted again later. You must |
|
880 |
explicit start it again from the web interface or from the |
STOP stops the service. If monit stops a service it will |
881 |
|
not be checked by monit anymore nor restarted again later. You |
882 |
|
must explicit start it again from the web interface or from the |
883 |
console, like: 'monit start datafs' if you want the monit daemon |
console, like: 'monit start datafs' if you want the monit daemon |
884 |
to monitor the service again. |
to monitor the service again. |
885 |
|
|
886 |
|
=item * |
887 |
|
|
888 |
|
EXEC may be used to execute an arbitrary program. If you choose |
889 |
|
this action you must state the program to be executed. |
890 |
|
|
891 |
|
=back |
892 |
|
|
893 |
|
|
894 |
|
|
895 |
=head1 INODE TESTING |
=head1 INODE TESTING |
896 |
|
|
897 |
Monit supports test of devices/filesystems. You can check for |
Monit supports test of devices and filesystems. You can check for |
898 |
inodes usage whenever supported by filesystem. |
inodes usage if supported by the filesystem. |
899 |
|
|
900 |
In the case that the device becomes unavailable, monit will |
In the case that the device becomes unavailable, monit will |
901 |
call start/stop methods whenever defined if it is running in |
call start/stop methods whenever defined if it is running in |
905 |
|
|
906 |
Full syntax of inode testing statement: |
Full syntax of inode testing statement: |
907 |
|
|
908 |
INODE(S) operator value [unit] action |
=over 4 |
909 |
|
|
910 |
|
=item if INODE(S) operator value [unit] then action |
911 |
|
|
912 |
|
=back |
913 |
|
|
914 |
I<operator> is a choice of "<",">","!=","==" in c notation, "gt", |
I<operator> is a choice of "<",">","!=","==" in c notation, "gt", |
915 |
"lt", "eq", "ne" in shell sh notation and "greater", "less", |
"lt", "eq", "ne" in shell sh notation and "greater", "less", |
920 |
count of inodes. You can use the "%" character or the longer |
count of inodes. You can use the "%" character or the longer |
921 |
alternative "percent" as a unit. |
alternative "percent" as a unit. |
922 |
|
|
923 |
I<action> is a choice of "ALERT", "RESTART", "STOP": |
I<action> is a choice of "ALERT", "RESTART", "STOP" or "EXEC": |
924 |
|
|
925 |
|
=over 4 |
926 |
|
|
927 |
|
=item * |
928 |
|
|
929 |
ALERT sends the user a resource alert. |
ALERT sends the user a resource alert. |
930 |
|
|
931 |
|
=item * |
932 |
|
|
933 |
RESTART restarts the service. |
RESTART restarts the service. |
934 |
|
|
935 |
STOP stops the service. If monit stops a service it will not be |
=item * |
936 |
checked by monit anymore nor restarted again later. You must |
|
937 |
explicit start it again from the web interface or from the |
STOP stops the service. If monit stops a service it will |
938 |
|
not be checked by monit anymore nor restarted again later. You |
939 |
|
must explicit start it again from the web interface or from the |
940 |
console, like: 'monit start datafs' if you want the monit daemon |
console, like: 'monit start datafs' if you want the monit daemon |
941 |
to monitor the service again. |
to monitor the service again. |
942 |
|
|
943 |
|
=item * |
944 |
|
|
945 |
|
EXEC may be used to execute an arbitrary program. If you choose |
946 |
|
this action you must state the program to be executed. |
947 |
|
|
948 |
|
=back |
949 |
|
|
950 |
|
|
951 |
|
|
952 |
=head1 PERMISSION TESTING |
=head1 PERMISSION TESTING |
953 |
|
|
955 |
|
|
956 |
Full syntax is: |
Full syntax is: |
957 |
|
|
958 |
PERM(ISSION) octalnumber |
=over 4 |
959 |
|
|
960 |
|
=item if failed PERM(ISSION) octalnumber |
961 |
|
|
962 |
|
=back |
963 |
|
|
964 |
|
|
965 |
I<octalnumber> defines appropriate file or directory permissions. |
I<octalnumber> defines appropriate file or directory permissions. |
966 |
|
|
967 |
In the case that permission test will fail, monit will call |
In the case that permission test will fail, monit will call |
968 |
start/stop methods whenever defined if it is running in active |
start/stop methods whenever defined if it is running in active |
969 |
mode. In the case that it is running in passive mode or |
mode. In the case that it is running in passive mode or |
970 |
start/stop methods were not defined, it will just send failure |
start/stop methods are not defined, it will just send a failure |
971 |
alert. |
alert. |
972 |
|
|
973 |
|
|
974 |
|
|
975 |
=head1 MONIT HTTPD |
=head1 MONIT HTTPD |
976 |
|
|
977 |
If specified in the control file, monit will start a monit daemon |
If specified in the control file, monit will start a monit daemon |
983 |
The control file statement for starting a monit daemon with http |
The control file statement for starting a monit daemon with http |
984 |
support is a global set-statement: |
support is a global set-statement: |
985 |
|
|
986 |
set httpd port 2812 |
=over 4 |
987 |
|
|
988 |
|
=item set httpd port 2812 |
989 |
|
|
990 |
|
=back |
991 |
|
|
992 |
And you can use this URL, I<http://localhost:2812/>, to access |
And you can use this URL, I<http://localhost:2812/>, to access |
993 |
the daemon from a browser. |
the daemon from a browser. |
999 |
start the httpd server with ssl support, using the following |
start the httpd server with ssl support, using the following |
1000 |
expression: |
expression: |
1001 |
|
|
1002 |
set httpd port 2812 |
set httpd port 2812 |
1003 |
ssl enable |
ssl enable |
1004 |
pemfile /etc/certs/monit.pem |
pemfile /etc/certs/monit.pem |
1005 |
|
|
1006 |
And you can use this URL, I<https://localhost:2812/>, to access |
And you can use this URL, I<https://localhost:2812/>, to access |
1007 |
the monit web server over an ssl encrypted connection. |
the monit web server over an ssl encrypted connection. |
1017 |
client has to have a sufficient key and certificate in order to |
client has to have a sufficient key and certificate in order to |
1018 |
connect. This file also needs to have all necessary CA |
connect. This file also needs to have all necessary CA |
1019 |
certificates. A configuration could look like: |
certificates. A configuration could look like: |
1020 |
|
|
1021 |
set httpd port 2812 |
set httpd port 2812 |
1022 |
ssl enable |
ssl enable |
1023 |
pemfile /etc/certs/monit.pem |
pemfile /etc/certs/monit.pem |
1024 |
clientpemfile /etc/certs/monit-client.pem |
clientpemfile /etc/certs/monit-client.pem |
1025 |
|
|
1026 |
By default self signed certificates are not allowed. In case you need |
By default self signed certificates are not allowed. In case you need |
1027 |
to use them it has to be allowed explicitly with the |
to use them it has to be allowed explicitly with the |
1175 |
The full syntax for the checksum-statement is as follows: |
The full syntax for the checksum-statement is as follows: |
1176 |
(keywords are in capital) |
(keywords are in capital) |
1177 |
|
|
1178 |
CHECKSUM [file [EXPECT checksum] ]+ |
=over 4 |
1179 |
|
|
1180 |
|
=item CHECKSUM [file [EXPECT checksum] ]+ |
1181 |
|
|
1182 |
|
=back |
1183 |
|
|
1184 |
A legal (but verbose) way to write a checksum statement for a |
A legal (but verbose) way to write a checksum statement for a |
1185 |
process entry in the control file is: |
process entry in the control file is: |
1222 |
expect-statement. |
expect-statement. |
1223 |
|
|
1224 |
|
|
1225 |
|
|
1226 |
=head1 DEPENDENCY CHECKING |
=head1 DEPENDENCY CHECKING |
1227 |
|
|
1228 |
If specified in the control file, monit can do dependency |
If specified in the control file, monit can do dependency |
1229 |
checking before starting or stopping services. The syntax for |
checking before starting or stopping services. The syntax for |
1230 |
the depend statement is simply: |
the depend statement is simply: |
1231 |
|
|
1232 |
DEPENDS service[, service [,...]] |
=over 4 |
1233 |
|
|
1234 |
|
=item DEPENDS on service[, service [,...]] |
1235 |
|
|
1236 |
|
=back |
1237 |
|
|
1238 |
Where B<service> is a service entry name, for instance B<apache> |
Where B<service> is a service entry name, for instance B<apache> |
1239 |
or B<datafs>. |
or B<datafs>. |
1310 |
=back |
=back |
1311 |
|
|
1312 |
|
|
1313 |
|
|
1314 |
|
|
1315 |
=head1 THE RUN CONTROL FILE |
=head1 THE RUN CONTROL FILE |
1316 |
|
|
1317 |
The preferred way to set up monit is to write a I<.monitrc> file |
The preferred way to set up monit is to write a I<.monitrc> file |
1524 |
start The program for starting the specified |
start The program for starting the specified |
1525 |
service. Full path is required. This |
service. Full path is required. This |
1526 |
statement is optional. |
statement is optional. |
|
uid and gid Optional part of the start statement. May |
|
|
be used to specify a user id and a group id |
|
|
the program should be started as. The uid |
|
|
and gid may be specified as a name or as a |
|
|
number. This extension can only be used if |
|
|
the super-user is running monit. |
|
1527 |
stop The program for stopping the specified |
stop The program for stopping the specified |
1528 |
service. Full path is required. This |
service. Full path is required. This |
1529 |
statement is optional. |
statement is optional. |
1530 |
|
uid and gid Optional part of a start, stop or exec |
1531 |
|
statement. May be used to specify a user id and |
1532 |
|
a group id the program should be started as. The |
1533 |
|
uid and gid may be specified as a name or as a |
1534 |
|
number. This extension may only be used if the |
1535 |
|
super-user is running monit. |
1536 |
host The hostname or IP address to test the port |
host The hostname or IP address to test the port |
1537 |
at. This keyword can only be used together |
at. This keyword can only be used together |
1538 |
with a port statement. |
with a port statement. |
1571 |
unix(socket) Specifies a unix socket file and used like |
unix(socket) Specifies a unix socket file and used like |
1572 |
the port statement above to test a Unix |
the port statement above to test a Unix |
1573 |
domain network socket connection. |
domain network socket connection. |
1574 |
timeout Define service timeout. Must be followed by |
timeout after Define a port connection timeout. Must be |
1575 |
|
followed by a number in seconds and the keyword, |
1576 |
|
seconds. |
1577 |
|
timeout Define service timeout. Must be followed by |
1578 |
two digits. The first digit is max number of |
two digits. The first digit is max number of |
1579 |
restarts for the service. The second digit |
restarts for the service. The second digit |
1580 |
is the cycle interval to test restarts. |
is the cycle interval to test restarts. |
1586 |
examples above. More than one alert statement |
examples above. More than one alert statement |
1587 |
is allowed in an entry. This statement is also |
is allowed in an entry. This statement is also |
1588 |
optional. |
optional. |
1589 |
|
restart, |
1590 |
|
stop and These keywords may be used as actions for |
1591 |
|
exec various test statements. The exec statement is |
1592 |
|
special in that it requires a following string |
1593 |
|
specifying the program to be execute. You may |
1594 |
|
also specify an UID and GID to the exec |
1595 |
|
statement. The program executed will then run |
1596 |
|
using the specified user id and group id. |
1597 |
mail-format Specifies a mail format for an alert message |
mail-format Specifies a mail format for an alert message |
1598 |
This statement is an optional part of the |
This statement is an optional part of the |
1599 |
alert statement. |
alert statement. |
1607 |
timestamp Specifies expected timestamp for given object |
timestamp Specifies expected timestamp for given object |
1608 |
and optional action. More than one timeout |
and optional action. More than one timeout |
1609 |
statement are allowed. |
statement are allowed. |
1610 |
|
changed Part of a time statement and used as an operator |
1611 |
|
to simply test for a timestamp change. |
1612 |
every Validate this entry only at every n poll |
every Validate this entry only at every n poll |
1613 |
cycle. Usefull in daemon mode when the |
cycle. Usefull in daemon mode when the |
1614 |
poll-cycle is short and the service takes |
poll-cycle is short and the service takes |
1666 |
I<set>, I<daemon>, I<logfile>, I<syslog>, I<address>, I<httpd>, |
I<set>, I<daemon>, I<logfile>, I<syslog>, I<address>, I<httpd>, |
1667 |
I<ssl>, I<enable>, I<disable>, I<pemfile>, I<allow>, I<check>, |
I<ssl>, I<enable>, I<disable>, I<pemfile>, I<allow>, I<check>, |
1668 |
I<init>, I<pidfile>, I<statefile>, I<group>, I<start>, I<stop>, |
I<init>, I<pidfile>, I<statefile>, I<group>, I<start>, I<stop>, |
1669 |
I<uid>, I<gid>, I<port(number)>, I<unix(socket)>, I<type>, |
I<uid>, I<gid>, I<connection>, I<port(number)>, I<unix(socket)>, |
1670 |
I<proto(col)>, I<tcp>, I<tcpssl>, I<udp>, I<alert>, |
I<type>, I<proto(col)>, I<tcp>, I<tcpssl>, I<udp>, I<alert>, |
1671 |
I<mail-format>, I<restart>, I<timeout>, I<checksum>, I<resource>, |
I<mail-format>, I<restart>, I<timeout>, I<after>, I<checksum>, |
1672 |
I<expect>, I<mailserver>, I<every>, I<mode>, I<active>, |
I<resource>, I<expect>, I<mailserver>, I<every>, I<mode>, |
1673 |
I<passive>, I<manual>, I<depends>, I<host>, I<default>, I<http>, |
I<active>, I<passive>, I<manual>, I<depends>, I<host>, |
1674 |
I<ftp>, I<smtp>, I<pop>, I<nntp>, I<imap>, I<ssh>, I<dwp>, |
I<default>, I<http>, I<ftp>, I<smtp>, I<pop>, I<nntp>, I<imap>, |
1675 |
I<ldap2>, I<ldap3>, I<request>, I<cpu>, I<mem>, I<totalmem>, |
I<ssh>, I<dwp>, I<ldap2>, I<ldap3>, I<request>, I<cpu>, I<mem>, |
1676 |
I<children>, I<loadavg>, I<timestamp>, I<changed>, I<second(s)>, |
I<totalmem>, I<children>, I<loadavg>, I<timestamp>, I<changed>, |
1677 |
I<minute(s)>, I<hour(s)>, I<day(s)>, I<space>, I<inode>, I<perm>, |
I<second(s)>, I<minute(s)>, I<hour(s)>, I<day(s)>, I<space>, |
1678 |
I<process>, I<file>, I<directory> and I<device> |
I<inode>, I<perm>, I<process>, I<file>, I<directory> and |
1679 |
|
I<device> |
1680 |
|
|
1681 |
And here is a complete list of B<noise keywords> ignored by |
And here is a complete list of B<noise keywords> ignored by |
1682 |
monit: |
monit: |
1683 |
|
|
1684 |
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>, |
1685 |
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)>, |
1686 |
I<cycle(s)>, I<than>, I<then>, I<for>, I<usage>, I<was>. |
I<cycle(s)>, I<than>, I<then>, I<for>, I<usage>, I<was>, |
1687 |
|
I<failed>. |
1688 |
|
|
1689 |
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, |
1690 |
then the script must begin with C<#!> and the remainder of the |
then the script must begin with C<#!> and the remainder of the |
1716 |
HTTPS. In this example monit will restart apache if it's not |
HTTPS. In this example monit will restart apache if it's not |
1717 |
accepting connections at the portnumbers. The method monit use |
accepting connections at the portnumbers. The method monit use |
1718 |
for a process restart is to first execute the stop-program, wait |
for a process restart is to first execute the stop-program, wait |
1719 |
for the process to stop and then execute the start-program. |
for the process to stop and then execute the start-program. (If |
1720 |
|
monit was unable to stop or start the service a failed alert |
1721 |
|
message will be sent if you have requested alert messages to be |
1722 |
|
sent). |
1723 |
|
|
1724 |
check process apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1725 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1726 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1727 |
port 80 |
if failed port 80 then restart |
1728 |
port 443 |
if failed port 443 with timeout after 15 seconds then restart |
1729 |
|
|
1730 |
This example demonstrate how you can run a program as a specified |
This example demonstrate how you can run a program as a specified |
1731 |
user (uid) and with a specified group (gid). Many daemon programs |
user (uid) and with a specified group (gid). Many daemon programs |
1732 |
will do the uid and gid switch by itself, but for those programs |
will do the uid and gid switch by themself, but for those |
1733 |
that does not (e.g. java programs), monit's ability to start a |
programs that does not (e.g. java programs), monit's ability to |
1734 |
program as a certain user can be very useful. In this example we |
start a program as a certain user can be very useful. In this |
1735 |
start the Tomcat Java Servlet Engine as the standard I<nobody> |
example we start the Tomcat Java Servlet Engine as the standard |
1736 |
user and group. Please note that monit will only change uid and |
I<nobody> user and group. Please note that monit will only change |
1737 |
gid for a program if the super-user is running monit, otherwise |
uid and gid for a program if the super-user is running monit, |
1738 |
monit will simply ignore the request to change uid and gid. |
otherwise monit will simply ignore the request to change uid and |
1739 |
|
gid. |
1740 |
|
|
1741 |
check tomcat with pidfile /var/run/tomcat.pid |
check tomcat with pidfile /var/run/tomcat.pid |
1742 |
start program = "/etc/init.d/tomcat start" |
start program = "/etc/init.d/tomcat start" |
1744 |
stop program = "/etc/init.d/tomcat stop" |
stop program = "/etc/init.d/tomcat stop" |
1745 |
# You can also use id numbers instead and write: |
# You can also use id numbers instead and write: |
1746 |
as uid 99 and with gid 99 |
as uid 99 and with gid 99 |
1747 |
port 8080 |
if failed port 8080 then alert |
|
|
|
1748 |
|
|
1749 |
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 |
1750 |
'named' service is running and also use timeout and alert: |
'named' service is running and also use timeout and alert: |
1752 |
check process named with pidfile /var/run/named.pid |
check process named with pidfile /var/run/named.pid |
1753 |
start program = "/etc/init.d/named start" |
start program = "/etc/init.d/named start" |
1754 |
stop program = "/etc/init.d/named stop" |
stop program = "/etc/init.d/named stop" |
1755 |
port 53 use type udp |
if failed port 53 use type udp then restart |
1756 |
timeout (3,5) |
timeout (3,5) |
1757 |
alert bofh@norid.no |
alert bofh@norid.no |
1758 |
|
|
1762 |
check process sophie with pidfile /var/run/sophie.pid |
check process sophie with pidfile /var/run/sophie.pid |
1763 |
start program = "/etc/init.d/sophie start" |
start program = "/etc/init.d/sophie start" |
1764 |
stop program = "/etc/init.d/sophie stop" |
stop program = "/etc/init.d/sophie stop" |
1765 |
unix /var/run/sophie |
if failed unix /var/run/sophie then restart |
1766 |
|
|
1767 |
In this example we check an apache web-server running on |
In this example we check an apache web-server running on |
1768 |
localhost that answers for several IP-based virtual hosts or |
localhost that answers for several IP-based virtual hosts or |
1771 |
check process apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1772 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1773 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1774 |
host www.sol.no port 80 |
if failed host www.sol.no port 80 then alert |
1775 |
host shop.sol.no port 443 |
if failed host shop.sol.no port 443 then alert |
1776 |
host chat.sol.no port 80 |
if failed host chat.sol.no port 80 then alert |
1777 |
host www.tildeslash.com port 80 |
if failed host www.tildeslash.com port 80 then alert |
1778 |
|
|
1779 |
In the following example we ask monit to compute and verify the |
In the following example we ask monit to compute and verify the |
1780 |
checksum for the underlying apache binary used by the start and |
checksum for the underlying apache binary used by the start and |
1783 |
check process apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1784 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1785 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1786 |
host www.tildeslash.com port 80 |
if failed host www.tildeslash.com port 80 then restart |
1787 |
checksum /usr/local/apache/bin/httpd |
checksum /usr/local/apache/bin/httpd |
1788 |
|
|
1789 |
Some servers are slow starters, like for example Java based |
Some servers are slow starters, like for example Java based |
1794 |
check process dynamo with pidfile /etc/dynamo.pid |
check process dynamo with pidfile /etc/dynamo.pid |
1795 |
start program = "/etc/init.d/dynamo start" |
start program = "/etc/init.d/dynamo start" |
1796 |
stop program = "/etc/init.d/dynamo stop" |
stop program = "/etc/init.d/dynamo stop" |
1797 |
port 8840 |
if failed port 8840 then alert |
1798 |
every 2 cycle |
every 2 cycle |
1799 |
|
|
1800 |
Here is an example where we group together two database entries. |
Here is an example where we group together two database entries. |
1812 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1813 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1814 |
mode active # Not necessary really, since this is the default |
mode active # Not necessary really, since this is the default |
1815 |
port 9001 |
if failed port 9001 then restart |
1816 |
alert bofh@foo.bar |
alert bofh@foo.bar |
1817 |
group database |
group database |
1818 |
|
|
1831 |
if mem > 100 MB for 5 cycles then stop |
if mem > 100 MB for 5 cycles then stop |
1832 |
if loadavg(5min) greater than 10.0 for 8 cycles then stop |
if loadavg(5min) greater than 10.0 for 8 cycles then stop |
1833 |
|
|
1834 |
|
This examples demonstrate the timestamp statement with exec and |
1835 |
|
how you may restart apache if it's configuration file was |
1836 |
|
changed. |
1837 |
|
|
1838 |
|
check process apache with pidfile /var/run/httpd.pid |
1839 |
|
start program = "/etc/init.d/httpd start" |
1840 |
|
stop program = "/etc/init.d/httpd stop" |
1841 |
|
if timestamp /usr/local/apache/conf/httpd.conf was changed |
1842 |
|
then exec "/etc/init.d/httpd restart" |
1843 |
|
|
1844 |
In this example we demonstrate usage of the extended alert |
In this example we demonstrate usage of the extended alert |
1845 |
statement: |
statement: |
1847 |
check process apache with pidfile /var/run/httpd.pid |
check process apache with pidfile /var/run/httpd.pid |
1848 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1849 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1850 |
host www.tildeslash.com port 80 |
if failed host www.tildeslash.com port 80 then restart |
1851 |
checksum /usr/local/apache/bin/httpd |
checksum /usr/local/apache/bin/httpd |
1852 |
alert security@bar on {checksum} |
alert security@bar on {checksum} |
1853 |
with mail-format {subject: Alaaarrm! on $HOST} |
with mail-format {subject: Alaaarrm! on $HOST} |
1876 |
check process oracle with pidfile /var/run/oracle.pid |
check process oracle with pidfile /var/run/oracle.pid |
1877 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1878 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1879 |
port 9001 |
if failed port 9001 then restart |
1880 |
|
|
1881 |
In the next example, we have a standard three tier setup with |
In the next example, we have a standard three tier setup with |
1882 |
apache, an application server and a back end database server. |
apache, an application server and a back end database server. |
1896 |
check process oracle with pidfile /var/run/oracle.pid |
check process oracle with pidfile /var/run/oracle.pid |
1897 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1898 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1899 |
port 9001 |
if failed port 9001 then restart |
|
|
|
1900 |
|
|
1901 |
Next, we have 2 services oracle-import and oracle-export that |
Next, we have 2 services oracle-import and oracle-export that |
1902 |
need to be restarted if oracle is restarted, but are independent |
need to be restarted if oracle is restarted, but are independent |
1905 |
check process oracle with pidfile /var/run/oracle.pid |
check process oracle with pidfile /var/run/oracle.pid |
1906 |
start program = "/etc/init.d/oracle start" |
start program = "/etc/init.d/oracle start" |
1907 |
stop program = "/etc/init.d/oracle stop" |
stop program = "/etc/init.d/oracle stop" |
1908 |
port 9001 |
if failed port 9001 then restart |
1909 |
|
|
1910 |
check process oracle-import with pidfile /var/run/oracle-import.pid |
check process oracle-import with pidfile /var/run/oracle-import.pid |
1911 |
start program = "/etc/init.d/oracle-import start" |
start program = "/etc/init.d/oracle-import start" |
1923 |
group server |
group server |
1924 |
start program = "/etc/init.d/httpd start" |
start program = "/etc/init.d/httpd start" |
1925 |
stop program = "/etc/init.d/httpd stop" |
stop program = "/etc/init.d/httpd stop" |
1926 |
checksum /usr/local/apache/bin/httpd |
if failed host www.sol.no port 80 type tcp protocol http |
1927 |
and expect the sum 8f7f419955cefa0b33a2ba316cba3659 |
then restart |
1928 |
host www.sol.no port 80 type tcp protocol http |
if failed host kvasir.sol.no port 80 type tcp protocol http |
|
host kvasir.sol.no port 80 type tcp protocol http |
|
1929 |
and use the request "/login.cgi" |
and use the request "/login.cgi" |
1930 |
host shop.sol.no port 443 type tcpssl proto http |
then alert |
1931 |
timeout (2,3) |
if failed host shop.sol.no port 443 type tcpssl proto http |
1932 |
|
and with timeout after 15 seconds |
1933 |
|
then restart |
1934 |
if cpu is greater than 60% for 2 cycles then alert |
if cpu is greater than 60% for 2 cycles then alert |
1935 |
if cpu > 80% for 5 cycles then restart |
if cpu > 80% for 5 cycles then restart |
1936 |
if mem > 100 MB then stop |
if mem > 100 MB then stop |
1937 |
if timestamp "/usr/local/apache/logs/httpd.pid" > 7 days |
if timestamp |
1938 |
then restart |
"/usr/local/apache/logs/httpd.pid" > 7 days |
1939 |
|
then restart |
1940 |
|
if timestamp |
1941 |
|
/usr/local/apache/conf/httpd.conf was changed |
1942 |
|
then exec "/etc/init.d/httpd restart" |
1943 |
|
checksum /usr/local/apache/bin/httpd |
1944 |
|
and expect the sum 8f7f419955cefa0b33a2ba316cba3659 |
1945 |
alert foo@bar on { checksum } |
alert foo@bar on { checksum } |
1946 |
alert bofh@bar with mail-format {from: monit@foo.bar.no} |
alert bofh@bar with mail-format {from: monit@foo.bar.no} |
1947 |
every 2 cycles |
every 2 cycles |
1948 |
mode active |
mode active |
1949 |
depends on weblogic |
depends on weblogic |
1950 |
|
timeout (2,3) |
1951 |
|
|
1952 |
Note; only the B<check-> and B<pidfile statement> are mandatory, |
Note; only the B<check-> and B<pidfile statement> are mandatory, |
1953 |
the other statements are optional and the order of the optional |
the other statements are optional and the order of the optional |