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