]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/monit/templates/monitrc.erb
727e3aec965c7a99697c5ad5a2cfde373d7f9cd9
[dsa-puppet.git] / modules / monit / templates / monitrc.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ##
5 ###############################################################################
6 ## Monit control file
7 ###############################################################################
8 ##
9 ## Comments begin with a '#' and extend through the end of the line. Keywords
10 ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
11 ##
12 ## Below you will find examples of some frequently used statements. For 
13 ## information about the control file, a complete list of statements and 
14 ## options please have a look in the monit manual.
15 ##
16 ##
17 ###############################################################################
18 ## Global section
19 ###############################################################################
20 ##
21 ## Start monit in the background (run as a daemon) and check services at 
22 ## 2-minute intervals.
23 #
24 <% if (nodeinfo.has_key?('squeeze') and nodeinfo['squeeze']) or (nodeinfo.has_key?('wheezy') and nodeinfo['wheezy']) %>
25 set daemon 300
26 <% end %>
27 #
28 #
29 ## Set syslog logging with the 'daemon' facility. If the FACILITY option is
30 ## omitted, monit will use 'user' facility by default. If you want to log to 
31 ## a stand alone log file instead, specify the path to a log file
32 #
33 # set logfile syslog facility log_daemon                       
34 #
35 #
36 ## Set the list of mail servers for alert delivery. Multiple servers may be 
37 ## specified using comma separator. By default monit uses port 25 - this
38 ## is possible to override with the PORT option.
39 #
40 # set mailserver mail.bar.baz,               # primary mailserver
41 #                backup.bar.baz port 10025,  # backup mailserver on port 10025
42 #                localhost                   # fallback relay
43 #
44 #
45 ## By default monit will drop alert events if no mail servers are available. 
46 ## If you want to keep the alerts for a later delivery retry, you can use the 
47 ## EVENTQUEUE statement. The base directory where undelivered alerts will be 
48 ## stored is specified by the BASEDIR option. You can limit the maximal queue
49 ## size using the SLOTS option (if omitted, the queue is limited by space 
50 ## available in the back end filesystem).
51 #
52 # set eventqueue
53 #     basedir /var/monit  # set the base directory where events will be stored
54 #     slots 100           # optionaly limit the queue size
55 #
56 #
57 ## Monit by default uses the following alert mail format:
58 ##
59 ## --8<--
60 ## From: monit@$HOST                         # sender
61 ## Subject: monit alert --  $EVENT $SERVICE  # subject
62 ##
63 ## $EVENT Service $SERVICE                   #
64 ##                                           #
65 ##      Date:        $DATE                   #
66 ##      Action:      $ACTION                 #
67 ##      Host:        $HOST                   # body
68 ##      Description: $DESCRIPTION            #
69 ##                                           #
70 ## Your faithful employee,                   #
71 ## monit                                     #
72 ## --8<--
73 ##
74 ## You can override this message format or parts of it, such as subject
75 ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc.
76 ## are expanded at runtime. For example, to override the sender:
77 #
78 # set mail-format { from: monit@foo.bar }
79 #
80 #
81 ## You can set alert recipients here whom will receive alerts if/when a 
82 ## service defined in this file has errors. Alerts may be restricted on 
83 ## events by using a filter as in the second example below. 
84 #
85 # set alert sysadm@foo.bar                       # receive all alerts
86 # set alert manager@foo.bar only on { timeout }  # receive just service-
87 #                                                # timeout alert
88 #
89 #
90 ## Monit has an embedded web server which can be used to view status of 
91 ## services monitored, the current configuration, actual services parameters
92 ## and manage services from a web interface.
93 #
94 # set httpd port 2812 and
95 #     use address localhost  # only accept connection from localhost
96 #     allow localhost        # allow localhost to connect to the server and
97 #     allow admin:monit      # require user 'admin' with password 'monit'
98 #
99 #
100 ###############################################################################
101 ## Services
102 ###############################################################################
103 ##
104 ## Check general system resources such as load average, cpu and memory
105 ## usage. Each test specifies a resource, conditions and the action to be
106 ## performed should a test fail.
107 #
108 #  check system myhost.mydomain.tld
109 #    if loadavg (1min) > 4 then alert
110 #    if loadavg (5min) > 2 then alert
111 #    if memory usage > 75% then alert
112 #    if cpu usage (user) > 70% then alert
113 #    if cpu usage (system) > 30% then alert
114 #    if cpu usage (wait) > 20% then alert
115 #
116 #    
117 ## Check a file for existence, checksum, permissions, uid and gid. In addition
118 ## to alert recipients in the global section, customized alert will be sent to 
119 ## additional recipients by specifying a local alert handler. The service may 
120 ## be grouped using the GROUP option.
121 #    
122 #  check file apache_bin with path /usr/local/apache/bin/httpd
123 #    if failed checksum and 
124 #       expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
125 #    if failed permission 755 then unmonitor
126 #    if failed uid root then unmonitor
127 #    if failed gid root then unmonitor
128 #    alert security@foo.bar on {
129 #           checksum, permission, uid, gid, unmonitor
130 #        } with the mail-format { subject: Alarm! }
131 #    group server
132 #
133 #    
134 ## Check that a process is running, in this case Apache, and that it respond
135 ## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory,
136 ## and number of children. If the process is not running, monit will restart 
137 ## it by default. In case the service was restarted very often and the 
138 ## problem remains, it is possible to disable monitoring using the TIMEOUT
139 ## statement. This service depends on another service (apache_bin) which
140 ## is defined above.
141 #    
142 #  check process apache with pidfile /usr/local/apache/logs/httpd.pid
143 #    start program = "/etc/init.d/httpd start"
144 #    stop program  = "/etc/init.d/httpd stop"
145 #    if cpu > 60% for 2 cycles then alert
146 #    if cpu > 80% for 5 cycles then restart
147 #    if totalmem > 200.0 MB for 5 cycles then restart
148 #    if children > 250 then restart
149 #    if loadavg(5min) greater than 10 for 8 cycles then stop
150 #    if failed host www.tildeslash.com port 80 protocol http
151 #       and request "/monit/doc/next.php"
152 #       then restart
153 #    if failed port 443 type tcpssl protocol http
154 #       with timeout 15 seconds
155 #       then restart
156 #    if 3 restarts within 5 cycles then timeout
157 #    depends on apache_bin
158 #    group server
159 #    
160 #    
161 ## Check device permissions, uid, gid, space and inode usage. Other services,
162 ## such as databases, may depend on this resource and an automatically graceful
163 ## stop may be cascaded to them before the filesystem will become full and data
164 ## lost.
165 #
166 #  check device datafs with path /dev/sdb1
167 #    start program  = "/bin/mount /data"
168 #    stop program  = "/bin/umount /data"
169 #    if failed permission 660 then unmonitor
170 #    if failed uid root then unmonitor
171 #    if failed gid disk then unmonitor
172 #    if space usage > 80% for 5 times within 15 cycles then alert
173 #    if space usage > 99% then stop
174 #    if inode usage > 30000 then alert
175 #    if inode usage > 99% then stop
176 #    group server
177 #
178 #
179 ## Check a file's timestamp. In this example, we test if a file is older 
180 ## than 15 minutes and assume something is wrong if its not updated. Also,
181 ## if the file size exceed a given limit, execute a script
182 #
183 #  check file database with path /data/mydatabase.db
184 #    if failed permission 700 then alert
185 #    if failed uid data then alert
186 #    if failed gid data then alert
187 #    if timestamp > 15 minutes then alert
188 #    if size > 100 MB then exec "/my/cleanup/script"
189 #
190 #
191 ## Check directory permission, uid and gid.  An event is triggered if the 
192 ## directory does not belong to the user with uid 0 and gid 0.  In addition, 
193 ## the permissions have to match the octal description of 755 (see chmod(1)).
194 #
195 #  check directory bin with path /bin
196 #    if failed permission 755 then unmonitor
197 #    if failed uid 0 then unmonitor
198 #    if failed gid 0 then unmonitor
199 #
200 #
201 ## Check a remote host network services availability using a ping test and 
202 ## check response content from a web server. Up to three pings are sent and 
203 ## connection to a port and a application level network check is performed.
204 #
205 #  check host myserver with address 192.168.1.1
206 #    if failed icmp type echo count 3 with timeout 3 seconds then alert
207 #    if failed port 3306 protocol mysql with timeout 15 seconds then alert
208 #    if failed url
209 #       http://user:password@www.foo.bar:8080/?querystring
210 #       and content == 'action="j_security_check"'
211 #       then alert
212 #
213 #
214 ###############################################################################
215 ## Includes
216 ###############################################################################
217 ##
218 ## It is possible to include additional configuration parts from other files or
219 ## directories.
220 #
221 include /etc/monit/monit.d/*