/[monit]/monit/monitrc
ViewVC logotype

Diff of /monit/monitrc

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

revision 1.72 by martinp, Fri Nov 18 22:52:39 2005 UTC revision 1.73 by martinp, Mon Nov 28 00:02:19 2005 UTC
# Line 1  Line 1 
1  # Monit control file  ###############################################################################
2    ## Monit control file
3    ###############################################################################
4    ##
5    ## Comments begin with a '#' and extend through the end of the line. Keywords
6    ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
7    ##
8    ## Bellow is the example of some frequently used statements. For information
9    ## about the control file, complete list of statements and options please see
10    ## the monit manual.
11    ##
12    ##
13    ###############################################################################
14    ## Global section
15    ###############################################################################
16    ##
17    ## Start monit in background (run as daemon) and check the services at 2-minute
18    ## intervals.
19  #  #
20  # Comments begin with a '#' and extend through the end of the line.  # set daemon  120
 # Blank lines between program entries are ignored. Keywords are case  
 # insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'  
 #  
 # Legal keywords are  
 #   check          -- Must be followed by the type of monitored service  
 #                     {device|directory|file|process} and a descriptive  
 #                     name for the service.  
 #  
 #   pidfile        -- Must be followed by a path to a process pidfile.  
 #                     Such a file should contain only one entry, a number  
 #                     representing the process pid. (See the apache pid  
 #                     file for an example).  
 #  
 #   path           -- Must be followed by a path to the block special file  
 #                     for filesystem (device), regular file or directory.  
 #  
 #   group          -- Must be followed by a descriptive name for a monitored  
 #                     services group. This statement can be used to group  
 #                     together several services. Monit can start/stop/restart a  
 #                     group of services.  
 #                      
 #   start          -- Must be followed by a full path to a program for  
 #                     starting the service. If you need to specify arguments  
 #                     to the program, enclose the program and arguments in  
 #                     quotes - like: "/local/bin/program -i start".  
 #  
 #   stop           -- Must be followed by a full path to a program for  
 #                     stopping the service. If you need to specify arguments  
 #                     to the program, enclose the program and arguments in  
 #                     quotes - like: "/local/bin/program -i stop".  
 #  
 #   uid            -- Must be followed by a user (name or uid number). This  
 #                     statement is an optionally part of the start/stop  
 #                     statement described above (if so, it makes monit start  
 #                     the program as the user given in the uid). uid can also  
 #                     be  used as a standalone statement in a file service  
 #                     check entry to check for changes in uid.  
 #  
 #   gid            -- Must be followed by a group (name or gid number). This  
 #                     statement is an optionally part of the start/stop  
 #                     statement described above (if so, it makes monit start  
 #                     the program as the group given in the gid). gid can also  
 #                     be  used as a standalone statement in a file service  
 #                     check entry to check for changes in gid.  
 #  
 #   pid            -- This statement is an optionally part of process service  
 #                     check entry to override default alert action in the case  
 #                     of pid change.  
 #  
 #   ppid           -- This statement is an optionally part of process service  
 #                     check entry to override default alert action in the case  
 #                     of parent pid change.  
 #  
 #   host           -- Specify a hostname or an ip-address to test port  
 #                     connection at. This statement must be followed by a  
 #                     port statement.  
 #  
 #   port(number)   -- Must be followed by an integer representing a portnumber.  
 #                     The monit program will try to connect to this port to  
 #                     to verify that there is a server listening behind the  
 #                     portnumber.  
 #  
 #   unix(socket)   -- Must be followed by a string representing a pathname.  
 #                     The monit program will try to connect to this socket to  
 #                     to verify that there is a server listening behind the  
 #                     unix socket.  
 #  
 #   type           -- Must be followed by the keyword udp or tcp. This keyword  
 #                     specifies the type of socket the monit program should  
 #                     use when testing the connection to the portnumber. If the  
 #                     type keyword is omitted, tcp is used.  
 #  
 #   tcp            -- Specifies that monit should use a TCP socket type  
 #                     (stream socket) when testing the port  
 #  
 #   tcpssl         -- Specifies that monit should use a TCP socket type  
 #                     (stream socket) with ssl when testing the port.  
 #  
 #   certmd5        -- The md5 sum of a certificate a ssl forged  
 #                     server has to deliver.  
 #  
 #   udp            -- Specifies that monit should use a UDP socket type  
 #                     (datagram socket) when testing the port  
 #  
 #   protocol       -- Must be followed by a protocol keyword. This keyword  
 #                     specifies the type of service found at the port.  
 #                     monit knows how to speak many standard protocols, e.g.  
 #                     HTTP, SMTP, and FTP. See the monit man file for the  
 #                     complete protocol list. If no protocol is specified  
 #                     monit will use a default test which in most cases is  
 #                     good enough to test if a server is up or down.  
 #  
 #   request        -- Must be followed by a request string specifying a  
 #                     document or entity to fetch from the server. Currently  
 #                     only the HTTP protocol module supports the request  
 #                     statement, such as: "/data/show.php?a=b&c=d"  
 #   send/expect    -- These keywords specify a generic protocol.  Both require  
 #                     a string whether to be sent or to be matched against (as  
 #                     extended regex if supported).  
 #                        
 #   timeout        -- Part of the timeout statement or used in a connection  
 #                     statement for connect timeout.  
 #  
 #   alert          -- Specifies an email address for notification if an  
 #                     error occured on a service. This statement is optional.  
 #                     More than one alert statement is allowed.  
 #  
 #   checksum       -- Used in a file check entry to test the file for  
 #                     checksum changes. See the monit man file for more  
 #                     information.  
 #    
 #   expect         -- Specify a md5 string digest monit should expect when  
 #                     testing a particular file's checksum. This statement is  
 #                     an optional part of the checksum statement.  
 #  
 #   timestamp      -- Must be followed by compare operator, number, optional  
 #                     a time unit and an action.  
 #    
 #   size           -- Must be followed by compare operator, number, optional  
 #                     a size unit and an action.  
 #  
 #   match          -- Must be followed by a regular expression and an action.  
 #    
 #   every          -- Only check the service at every n cycles.  
 #  
 #   mode           -- Must be followed either by the keyword active, passive  
 #                     or manual. If active, monit will restart the service  
 #                     if it is not running (this is the default behaviour).  
 #                     If passive, monit will only monitor and send alerts  
 #                     (resource related restart and stop options are ignored  
 #                     in this mode also). If manual, monit will enter active  
 #                     mode only if service was brough under monit's control  
 #                     otherwise the service isn't monitored.  
 #  
 #   cpu            -- Must be followed by a compare operator, a number with  
 #                     percent {%|percent}, optionally a maximum number of  
 #                     cycles and an action.  This statement is used to check  
 #                     the cpu usage in percent of a process with its children  
 #                     over a number of cycles. If the compare expression  
 #                     matches then the action is executed.  
 #  
 #   mem            -- The equivalent to cpu usage for memory of a process  
 #                     (w/o children!).  The syntax is equivilent to cpu,  
 #                     but additionally amount units are accepted, expressed in  
 #                     {B|KB|MB|GB|%|byte|kilobyte|megabyte|gigabyte|  
 #                     percent}  
 #    
 #   children       -- Must be followed by a number without unit. It  
 #                     represents number of child processes. The syntax is  
 #                     equivilent to cpu,  
 #  
 #   totalmem       -- The equivalent to mem for memory of a process  
 #                     (with children!). The syntax is the same  
 #    
 #   loadavg        -- Must be followed by [1min,5min,15min] in (), a  
 #                     compare operator, a  number, optionally a  
 #                     maximum number of cycles and an action.  This statement  
 #                     is used to check the system load average over a number  
 #                     of cycles.  If the compare expression matches then the  
 #                     action (restart, alert, exec, stop or unmonitor) is  
 #                     executed.  
 #  
 #   space          -- Must be followed by a compare operator, number,  
 #                     unit and action, where the unit is expressed in one of  
 #                     {B|KB|MB|GB|%|byte|kilobyte|megabyte|gigabyte|percent}  
 #    
 #   inode(s)       -- Must be followed by a compare operator, integer number,  
 #                     optionaly by a percent sign (if not, the limit is  
 #                     absolute) and an action (required).  
 #  
 #   perm(ission)   -- Must be followed by an octal number describing  
 #                     the permissions monit should expect for a file, directory  
 #                     or device.  
 #  
 #   depends        -- Must be followed by the name of a service or a list of  
 #                     services *this* service depends on to run before it  
 #                     starts. The list of depend services will be stopped  
 #                     before the current service is started and started again  
 #                     after.  
 #    
 # Legal global option statements are  
 #  
 #   set daemon     -- Must be followed by a number (in seconds)  
 #  
 #   set init       -- If specified, do not background monit. This allows  
 #                     init to control and restart monit. To work properly,  
 #                     modification of /etc/inittab is required.  
 #                     (see the FAQ.txt for details)  
 #  
 #   set logfile    -- Must be followed by either a filename (full path is  
 #                     required) or the string 'syslog'. If 'syslog' is used,  
 #                     it can be optionally followed by 'facility <facility>'  
 #                     where <facility> is one of 'log_local0' - 'log_local7'  
 #                     or 'log_daemon'. If no facility is set it will default  
 #                     to LOG_USER  
 #  
 #   set pidfile    -- Must be followed by a filename (full path is  
 #                     required) specifying the pid file for a monit daemon.  
 #                     See the manual for default value if not specified.  
 #  
 #   set statefile --  Must be followed by a filename (full path is  
 #                     required) specifying where monit should store  
 #                     its state file. If not defined monit will use  
 #                     the file, $HOME/.monit.state  
 #  
 #   set mailserver -- Must be followed by one or more mail server hostnames.  
 #                     If a  mailserver is not defined, monit will try to use  
 #                     'localhost' as the smtp-server for sending mail  
 #                     notification.  
 #  
 #   set mail-format - Must be followed by a mail format list containing at  
 #                     least one of the keywords; from: subject: or message:  
 #  
 #   set alert      -- Specifies an global email address for notification if an  
 #                     error occured on any service. This statement is optional.  
 #                     More than one alert statement is allowed.  
 #  
 #   set httpd port -- Must be followed by a portnumber for the monit http  
 #   set httpd port -- Must be followed by a portnumber for the monit http  
 #                     server.  
 #  
 #   ssl enable     -- Enables ssl support for the httpd server.  
 #                     It requires the use of the pemfile statement.  
 #  
 #   ssl disable    -- Disables ssl support for the httpd server.  
 #                     It is equal to omitting any ssl statement.  
 #  
 #   signature enable -- Enables http server version signature  
 #  
 #   signature disable - Disables http server version signature  
 #  
 #   address        -- If specified, the http server will only accept connect  
 #                     requests to this addresses This statement is an optional  
 #                     part of the set httpd statement.  
 #    
 #   pemfile        -- Specifies the file with the private key and the  
 #                     certificate for ssl support  
 #  
 #   allow          -- Specify a hostnames or IP addresses allowed to connect  
 #                     to the http server (one allow statement per host)  
 #         and/or  
 #   allow          -- Specify a username:password in clear text for  
 #                     connecting to monit httpd  
 #         and/or  
 #   allow          -- Specify a "htpasswd" styled file in clear text,  
 #                     MD5 or crypt for for users to connect to monit httpd  
 #                     Attention: at least one clear text user credential  
 #                     is necessary for the command line interface to  
 #                     connect to monit  
 #  
 #   include        -- include a file or files matching the globstring  
 #  
 #  
 # The noise keywords `is', `as', `are', `for', `and', `the', `with',  
 # `has', `using', `use', `on(ly)', `with(in)', `was', `than`, `usage'  
 # and `program(s)' are ignored anywhere in an entry; they can be used  
 # to make it resemble English.  The punctuation characters `,' `;' and  
 # '=' are also ignored.  
21  #  #
22  #  #
23  ## Here's an example for monitoring an apache web-server on port  ## Set syslog logging with the 'daemon' facility. If the facility option is
24  ## HTTP and HTTPS, Sybase Database Server and various filesystems:  ## omited, monit will use 'user' facility by default. You can specify the
25    ## path to the file for monit native logging.
26  #  #
27  ## [NB! Check and edit for your system and uncomment below]  # set logfile syslog facility log_daemon
28  #  #
 ## Daemonize monit and poll at 2-minute intervals.  
 # set daemon  120  
29  #  #
30  ## Set syslog logging.  ## Set list of mailservers for alert delivery. Multiple servers may be specified
31  # set logfile syslog facility log_daemon  ## using comma separator. By default monit uses port 25 - it is possible to
32    ## override it with the port option.
33    #
34    # set mailserver mail.bar.baz,               # primary mailserver
35    #                backup.bar.baz port 10025,  # backup mailserver on port 10025
36    #                localhost                   # fallback relay
37    #
38    #
39    ## By default will monit frop the event alert, in the case that there is no
40    ## mailserver available. In the case that you want to keep the events for
41    ## later delivery retry, you can use the eventqueue statement. The base
42    ## directory where undelivered events will be stored is specified by the
43    ## basedir option. You can limit the maximal queue size using the slots
44    ## option (if omited then the queue is limited just by the backend filesystem).
45  #  #
 ## Set event queue properties  
46  # set eventqueue  # set eventqueue
47  #     basedir /var/monit  #     basedir /var/monit  # set the base directory where events will be stored
48  #     slots 100  #     slots 100           # optionaly limit the queue size
49    #
50  #  #
51  ## Set localhost as a fall back server if the primary and backup  mailserver  ## Monit by default uses the following alert mail format:
52  ## fails.  ##
53  # set mailserver mail.bar.baz,  ## --8<--
54  #                backup.bar.baz port 10025,  ## From: monit@$HOST                         # sender
55  #                localhost  ## Subject: monit alert --  $EVENT $SERVICE  # subject
56    ##
57    ## $EVENT Service $SERVICE                   #
58    ##                                           #
59    ##      Date:   $DATE                        #
60    ##      Action: $ACTION                      # body
61    ##      Host:   $HOST                        #
62    ##                                           #
63    ## Your faithful employee,                   #
64    ## monit                                     #
65    ## --8<--
66    ##
67    ## You can override the alert message format or its parts such as subject
68    ## or sender using the mail-format statement. Macros such as $DATE, etc.
69    ## are expanded on runtime. For example to override the sender:
70  #  #
 ## Set a default mail from-address for all alert messages emitted by monit.  
71  # set mail-format { from: monit@foo.bar }  # set mail-format { from: monit@foo.bar }
72  #  #
 ## Send alert to system admin on any event  
 # set alert sysadm@foo.bar  
73  #  #
74  ## Make monit start its web-server.  ## You can set the alert recipients here, which will receive the alert for
75    ## each service. The event alerts may be restricted using the list.
76    #
77    # set alert sysadm@foo.bar                       # receive all alerts
78    # set alert manager@foo.bar only on { timeout }  # receive just service-
79    #                                                # timeout alert
80    #
81    #
82    ## Monit has embedded webserver, which can be used to view the configuration,
83    ## actual services parameters or manage the services using the web interface.
84    #
85  # set httpd port 2812 and  # set httpd port 2812 and
86  #     use address localhost # and only accept connection from localhost  #     use address localhost  # only accept connection from localhost
87  #     allow localhost       # allow localhost to connect to the server and  #     allow localhost        # allow localhost to connect to the server and
88  #     allow admin:monit     # user 'admin' with password 'monit'  #     allow admin:monit      # require user 'admin' with password 'monit'
89    #
90    #
91    ###############################################################################
92    ## Services
93    ###############################################################################
94    ##
95    ## Check the general system resources such as load average, cpu and memory
96    ## usage. Each tule specifies the tested resource, the limit and the action
97    ## which will be performed in the case that the test failed.
98  #  #
 #      
99  #  check system myhost.mydomain.tld  #  check system myhost.mydomain.tld
100  #    if loadavg (1min) > 4 then alert  #    if loadavg (1min) > 4 then alert
101  #    if loadavg (5min) > 2 then alert  #    if loadavg (5min) > 2 then alert
# Line 305  Line 105 
105  #    if cpu usage (wait) > 20% then alert  #    if cpu usage (wait) > 20% then alert
106  #  #
107  #      #    
108  #  check process apache with pidfile /usr/local/apache/logs/httpd.pid  ## Check the apache binary file for existence, checksum, permissions, uid and
109  #    start program = "/etc/init.d/httpd start"  ## gid. In addition to the recipients in the Global section, customized alert
110  #    stop program  = "/etc/init.d/httpd stop"  ## will be send to the additional recipient. The service may be grouped using
111  #    if failed host www.tildeslash.com port 80 protocol http  ## the group option.
 #       and request "/monit/next.html" then restart  
 #    if failed port 443 type tcpssl proto http with timeout 15 seconds  
 #       then restart  
 #    if cpu is greater than 60% for 2 cycles then alert  
 #    if cpu > 80% for 5 cycles then restart  
 #    if totalmem > 200.0 MB for 5 cycles then restart  
 #    if children > 250 then restart  
 #    if loadavg(5min) greater than 10 for 8 cycles then stop  
 #    if 3 restarts within 5 cycles then timeout  
 #    group server  
 #      
112  #      #    
113  #  check file apache_bin with path /usr/local/apache/bin/httpd  #  check file apache_bin with path /usr/local/apache/bin/httpd
114  #    if failed checksum and  #    if failed checksum and
# Line 333  Line 122 
122  #    group server  #    group server
123  #  #
124  #      #    
125  #  check process sybase with pidfile /var/run/sybase.pid  ## Check that the process apache is running, responding on the HTTP and HTTPS
126  #    start program = "/etc/init.d/sybase start"  ## request, check its resource usage such as cpu and memory, number of
127  #    stop program  = "/etc/init.d/sybase stop"  ## childrens. In the case that the process is not running, monit will restart
128  #    if failed port 4001 then restart  ## it by default. In the case that the service was restarted very often and
129  #    if 2 restarts within 3 cycles then timeout  ## the problem remains, it is possible to disable the monitoring using the
130    ## timeout statement. The service depends on another service (apache_bin) which
131    ## is defined in the monit control file as well.
132    #    
133    #  check process apache with pidfile /usr/local/apache/logs/httpd.pid
134    #    start program = "/etc/init.d/httpd start"
135    #    stop program  = "/etc/init.d/httpd stop"
136    #    if cpu > 60% for 2 cycles then alert
137    #    if cpu > 80% for 5 cycles then restart
138    #    if totalmem > 200.0 MB for 5 cycles then restart
139    #    if children > 250 then restart
140    #    if loadavg(5min) greater than 10 for 8 cycles then stop
141    #    if failed host www.tildeslash.com port 80 protocol http
142    #       and request "/monit/next.html"
143    #       then restart
144    #    if failed port 443 type tcpssl protocol http
145    #       with timeout 15 seconds
146    #       then restart
147    #    if 3 restarts within 5 cycles then timeout
148    #    depends on apache_bin
149  #    group server  #    group server
150  #    mode passive  #    
151  #    depends on datafs  #    
152  #  ## Check the device permissions, uid, gid, space and inode usage. Other
153    ## services such as databases may depend on this resource and automatical
154    ## graceful stop may be cascaded to them before the filesystem will become
155    ## full and the data will be lost.
156  #  #
157  #  check device datafs with path /dev/sdb1  #  check device datafs with path /dev/sdb1
158  #    start program  = "/bin/mount /data"  #    start program  = "/bin/mount /data"
# Line 349  Line 160 
160  #    if failed permission 660 then unmonitor  #    if failed permission 660 then unmonitor
161  #    if failed uid root then unmonitor  #    if failed uid root then unmonitor
162  #    if failed gid disk then unmonitor  #    if failed gid disk then unmonitor
163  #    if space usage > 80% then alert  #    if space usage > 80% for 5 times within 15 cycles then alert
164  #    if space usage > 99% then stop  #    if space usage > 99% then stop
165  #    if inode usage > 80% then alert  #    if inode usage > 30000 then alert
166  #    if inode usage > 99% then stop  #    if inode usage > 99% then stop
167  #    group server  #    group server
168  #  #
169  #  #
170  #  check device rootfs with path /dev/sda1  ## Check the database timestamp: when it becomes older then 15 minites,
171  #    if failed permission 660 then unmonitor  ## the database is not updated and something is wrong. In the case that
172  #    if failed uid root then unmonitor  ## the size of the database exceeded given limit, perform the script.
 #    if failed gid disk then unmonitor  
 #    if space usage > 3 GB 5 times within 15 cycles then alert  
 #    if inode usage > 30000 then alert  
 #    mode passive  
 #  
173  #  #
174  #  check file database with path /data/mydatabase.db  #  check file database with path /data/mydatabase.db
175  #    if failed permission 700 then alert  #    if failed permission 700 then alert
176  #    if failed uid data then alert  #    if failed uid data then alert
177  #    if failed gid data then alert  #    if failed gid data then alert
178  #    if timestamp > 15 minutes then alert  #    if timestamp > 15 minutes then alert
179  #    if size > 100 MB then alert  #    if size > 100 MB then exec "/my/cleanup/script"
180  #       else if recovered then exec "/check/my/db"  #
181  #  #
182    ## Check the directory permission, uid and gid.
183  #  #
184  #  check directory bin with path /bin  #  check directory bin with path /bin
185  #    if failed permission 755 then unmonitor  #    if failed permission 755 then unmonitor
# Line 380  Line 187 
187  #    if failed gid 0 then unmonitor  #    if failed gid 0 then unmonitor
188  #  #
189  #  #
190    ## Check the remote host network services availability and the response
191    ## content.
192    #
193  #  check host myserver with address 192.168.1.1  #  check host myserver with address 192.168.1.1
194  #    if failed icmp type echo count 3 with timeout 3 seconds then alert  #    if failed icmp type echo count 3 with timeout 3 seconds then alert
195  #    if failed port 3306 protocol mysql then alert  #    if failed port 3306 protocol mysql then alert
 #    if failed port 80 protocol http then alert  
196  #    if failed port 443 type tcpssl protocol http  #    if failed port 443 type tcpssl protocol http
197  #       with timeout 15 seconds then alert  #       with timeout 15 seconds
198  #    if failed host virtual.web.org port 80 protocol http  #       then alert
199  #       and request "/help/info.html" then alert  #    if failed url
200    #       http://user:password@www.foo.bar:8080/?querystring
201    #       and content == 'action="j_security_check"'
202    #       and request "/help/info.html"
203    #       then alert
204    #
205    #
206    ###############################################################################
207    ## Includes
208    ###############################################################################
209    ##
210    ## It is possible to include the configuration or its parts from other files or
211    ## directories.
212  #  #
213  #  include /etc/monit/mysql.monitrc  #  include /etc/monit.d/*
 #  include /etc/monit/mail/*.monitrc  
214  #  #
 #  check file foobar with path /somewhere  
 #     include /etc/monit/defaultfile.monitrc  
215  #  #
   

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73

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