breeze 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +4 -0
  5. data/Rakefile +2 -0
  6. data/bin/breeze +17 -0
  7. data/breeze.gemspec +28 -0
  8. data/lib/breeze.rb +6 -0
  9. data/lib/breeze/fog_extensions.rb +2 -0
  10. data/lib/breeze/fog_extensions/aws.rb +65 -0
  11. data/lib/breeze/initializer.rb +40 -0
  12. data/lib/breeze/tasks.rb +10 -0
  13. data/lib/breeze/tasks/app.rb +145 -0
  14. data/lib/breeze/tasks/configuration.rb +63 -0
  15. data/lib/breeze/tasks/db.rb +31 -0
  16. data/lib/breeze/tasks/dns.rb +67 -0
  17. data/lib/breeze/tasks/list.rb +74 -0
  18. data/lib/breeze/tasks/server.rb +72 -0
  19. data/lib/breeze/tasks/server/address.rb +27 -0
  20. data/lib/breeze/tasks/server/image.rb +27 -0
  21. data/lib/breeze/tasks/server/tag.rb +16 -0
  22. data/lib/breeze/veur.rb +86 -0
  23. data/lib/templates/Thorfile +122 -0
  24. data/lib/templates/maintenance.html +23 -0
  25. data/lib/templates/profiles/minimal/scripts/install_conf.sh +4 -0
  26. data/lib/templates/profiles/minimal/scripts/install_cust.sh +7 -0
  27. data/lib/templates/profiles/rails_and_image_magick/configs/database.yml +18 -0
  28. data/lib/templates/profiles/rails_and_image_magick/configs/memcached.conf +51 -0
  29. data/lib/templates/profiles/rails_and_image_magick/configs/nginx/logrotate +26 -0
  30. data/lib/templates/profiles/rails_and_image_magick/configs/nginx/monit +9 -0
  31. data/lib/templates/profiles/rails_and_image_magick/configs/nginx/nginx.conf +99 -0
  32. data/lib/templates/profiles/rails_and_image_magick/scripts/install_conf.sh +33 -0
  33. data/lib/templates/profiles/rails_and_image_magick/scripts/install_cust.sh +24 -0
  34. data/lib/templates/shared/configs/crontab +10 -0
  35. data/lib/templates/shared/configs/monitrc +248 -0
  36. data/lib/templates/shared/scripts/credentials.sh +5 -0
  37. data/lib/templates/shared/scripts/deploy.sh +43 -0
  38. data/lib/templates/shared/scripts/install.sh +38 -0
  39. data/lib/templates/user_data.sh +4 -0
  40. metadata +133 -0
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>down for maintenance</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 24em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ }
13
+ h1 { font-size: 100%; line-height: 1.5em; }
14
+ </style>
15
+ </head>
16
+
17
+ <body>
18
+ <div class="dialog">
19
+ <h1>The system is down for maintenance</h1>
20
+ <p>It will be back shortly.</p>
21
+ </div>
22
+ </body>
23
+ </html>
@@ -0,0 +1,4 @@
1
+ # This script is sourced at the beginning of install.sh.
2
+
3
+ # define packages to install
4
+ PACKAGES="git-core mysql-client monit"
@@ -0,0 +1,7 @@
1
+ # This script is sourced at the end of install.sh when packages have been installed
2
+ # and aliases and functions have been defined.
3
+
4
+ # set up the shell environment for user ubuntu
5
+ cat >> $HOME/.profile <<END_PROFILE
6
+ # export EDITOR=vi
7
+ END_PROFILE
@@ -0,0 +1,18 @@
1
+ <%
2
+ @path = "#{CONFIGURATION[:app_path]}/config/database.yml"
3
+ @owner = 'rails'
4
+ @group = 'rails'
5
+ @perms = 0640
6
+ @post = 'rake db:migrate'
7
+
8
+ conf = CONFIGURATION[:default_db_options]
9
+ %>
10
+ # Database configuration
11
+
12
+ production:
13
+ adapter: mysql2
14
+ host: <%= ENV['DB_SERVER'] %>
15
+ database: MY-DB-NAME
16
+ encoding: utf8
17
+ username: <%= conf[:master_username] %>
18
+ password: <%= conf[:password] %>
@@ -0,0 +1,51 @@
1
+ <%
2
+ @path = "/etc/memcached.conf"
3
+ @post = "/etc/init.d/memcached restart"
4
+ %>
5
+ # memcached default config file
6
+ # 2003 - Jay Bonci <jaybonci@debian.org>
7
+ # This configuration file is read by the start-memcached script provided as
8
+ # part of the Debian GNU/Linux distribution.
9
+
10
+ # Run memcached as a daemon. This command is implied, and is not needed for the
11
+ # daemon to run. See the README.Debian that comes with this package for more
12
+ # information.
13
+ -d
14
+
15
+ # Log memcached's output to /var/log/memcached
16
+ logfile /var/log/memcached.log
17
+
18
+ # Be verbose
19
+ # -v
20
+
21
+ # Be even more verbose (print client commands as well)
22
+ # -vv
23
+
24
+ # Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
25
+ # Note that the daemon will grow to this size, but does not start out holding this much
26
+ # memory
27
+ -m 64
28
+
29
+ # Default connection port is 11211
30
+ -p 11211
31
+
32
+ # Run the daemon as root. The start-memcached will default to running as root if no
33
+ # -u command is present in this config file
34
+ -u memcache
35
+
36
+ # Specify which IP address to listen on. The default is to listen on all IP addresses
37
+ # This parameter is one of the only security measures that memcached has, so make sure
38
+ # it's listening on a firewalled interface.
39
+ -l 127.0.0.1
40
+
41
+ # Limit the number of simultaneous incoming connections. The daemon default is 1024
42
+ # -c 1024
43
+
44
+ # Lock down all paged memory. Consult with the README and homepage before you do this
45
+ # -k
46
+
47
+ # Return error when memory is exhausted (rather than removing items)
48
+ # -M
49
+
50
+ # Maximize core file limit
51
+ # -r
@@ -0,0 +1,26 @@
1
+ <%
2
+ @path = "/etc/logrotate.d/nginx"
3
+ shared_rotate_conf = <<-END_SHARED_ROTATE_CONF
4
+ size 1M
5
+ missingok
6
+ rotate 5
7
+ compress
8
+ delaycompress
9
+ notifempty
10
+ END_SHARED_ROTATE_CONF
11
+ %>
12
+ # Nginx logs
13
+ /var/log/nginx/*.log {
14
+ <%= shared_rotate_conf %>
15
+ create 640 root adm
16
+ sharedscripts
17
+ postrotate
18
+ [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
19
+ endscript
20
+ }
21
+
22
+ # Rails application logs
23
+ <%= CONFIGURATION[:app_path] %>/log/*.log {
24
+ <%= shared_rotate_conf %>
25
+ copytruncate
26
+ }
@@ -0,0 +1,9 @@
1
+ <%
2
+ @path = '/etc/monit/conf.d/nginx'
3
+ %>
4
+ check process nginx with pidfile /var/run/nginx.pid
5
+ group nginx-production
6
+ start program = "/etc/init.d/nginx start"
7
+ stop program = "/etc/init.d/nginx stop"
8
+ if failed host localhost port 80 protocol http and request "/robots.txt" with timeout 5 seconds then restart
9
+ if 2 restarts within 3 cycles then timeout
@@ -0,0 +1,99 @@
1
+ <%
2
+ @path = "/etc/nginx/nginx.conf"
3
+
4
+ %w[ /tmp/nginx ].each do |dir|
5
+ system("mkdir -p #{dir} && chown www-data #{dir}") unless File.directory?(dir)
6
+ end
7
+
8
+ passenger_version = "3.0.2"
9
+ server_name = ENV['PUBLIC_SERVER_NAME']
10
+ server_root = "/srv/your-app/public"
11
+
12
+ shared_server_conf = <<-END_SHARED_SERVER_CONF
13
+
14
+ server_name #{server_name};
15
+ client_max_body_size 20M;
16
+
17
+ # redirect www.example.com to example.com
18
+ if ( $host = www.#{server_name} ) {
19
+ rewrite ^\/(.*)$ http://#{server_name}/$1 permanent;
20
+ }
21
+
22
+ # let browsers cache static assets
23
+ location ~ ^/(images|javascripts|stylesheets)/ { expires 1y; }
24
+
25
+ # always display system/maintenance.html if it exists
26
+ if ($request_filename ~* \.(js|css|gif|png|jpg)$) { break; }
27
+ if (-f $document_root/system/maintenance.html) {
28
+ rewrite ^(.*)$ /system/maintenance.html last;
29
+ break;
30
+ }
31
+
32
+ location / {
33
+ passenger_enabled on;
34
+ }
35
+
36
+ error_page 500 502 503 504 /500.html;
37
+ error_page 404 /404.html;
38
+
39
+ END_SHARED_SERVER_CONF
40
+
41
+ @post = <<-POST
42
+ if [ -f /var/run/nginx.pid ]; then
43
+ /etc/init.d/nginx reload
44
+ else
45
+ /etc/init.d/nginx start
46
+ fi
47
+ POST
48
+ %>
49
+ user www-data;
50
+ pid /var/run/nginx.pid;
51
+ error_log /var/log/nginx/error.log;
52
+
53
+ worker_processes 2;
54
+ events {
55
+ worker_connections 1024;
56
+ use epoll;
57
+ }
58
+
59
+ http {
60
+
61
+ root <%= server_root %>;
62
+
63
+ include /etc/nginx/mime.types;
64
+ default_type text/html;
65
+
66
+ access_log /var/log/nginx/access.log;
67
+
68
+ sendfile on;
69
+ tcp_nopush on;
70
+ tcp_nodelay on;
71
+
72
+ gzip on;
73
+ gzip_disable "msie6";
74
+ gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
75
+
76
+ passenger_root /usr/lib/ruby/gems/1.9.1/gems/passenger-<%= passenger_version %>;
77
+ passenger_ruby /usr/bin/ruby;
78
+ passenger_log_level 0;
79
+ passenger_max_pool_size 4; # for micro instances
80
+ passenger_min_instances 2;
81
+ passenger_pool_idle_time 0;
82
+ rails_app_spawner_idle_time 0;
83
+ passenger_pre_start http://<%= server_name %>/;
84
+
85
+ server {
86
+ listen 80;
87
+ <%= shared_server_conf %>
88
+ }
89
+
90
+ # remove this server block if you don't have ssl certificates
91
+ server {
92
+ listen 443;
93
+ ssl on;
94
+ ssl_certificate /etc/nginx/YOUR-CERTIFICATE-FILE.crt;
95
+ ssl_certificate_key /etc/nginx/YOUR-CERTIFICATE-FILE.key;
96
+ <%= shared_server_conf.gsub('http://', 'https://') %>
97
+ }
98
+
99
+ }
@@ -0,0 +1,33 @@
1
+ # This script is sourced at the beginning of install.sh.
2
+ # PACKAGES, RUBY_PACKAGE, IMAGE_MAGICK_PACKAGE, IMAGE_MAGICK_OPTIONS and NGINX_OPTIONS are required.
3
+ # The IMAGE_MAGICK_PACKAGE defined below may no longer be available from the download url specified
4
+ # in install_cust.sh. Find the latest release at http://www.imagemagick.org/script/download.php.
5
+
6
+ # define packages to install
7
+ # passenger will replace the nginx binary, but the package provides startup script, user etc.
8
+ SYSTEM_PACKAGES="git-core monit nginx memcached"
9
+ DB_CLIENT_PACKAGES="mysql-client libmysqlclient16 libmysqlclient16-dev"
10
+ RUBY_BUILD_DEPENDENCIES="\
11
+ build-essential bison openssl zlib1g libxslt1.1 libssl-dev libxslt1-dev libxml2 \
12
+ libffi-dev libyaml-dev libxslt-dev autoconf libc6-dev libreadline6-dev zlib1g-dev"
13
+ NGINX_AND_PASSENGER_DEPENDENCIES="libpcre3-dev libcurl4-openssl-dev"
14
+
15
+ # $PACKAGES is used by install.sh
16
+ PACKAGES="$SYSTEM_PACKAGES $DB_CLIENT_PACKAGES $RUBY_BUILD_DEPENDENCIES $NGINX_AND_PASSENGER_DEPENDENCIES"
17
+
18
+ # the rest is used by install_cust.sh
19
+ RUBY_PACKAGE=ruby-1.9.2-p180
20
+ IMAGE_MAGICK_PACKAGE=ImageMagick-6.6.7-8
21
+ IMAGE_MAGICK_OPTIONS='--disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8'
22
+ NGINX_OPTIONS="\
23
+ --conf-path=/etc/nginx/nginx.conf \
24
+ --lock-path=/var/lock/nginx.lock \
25
+ --http-client-body-temp-path=/tmp/nginx/client_body_temp \
26
+ --http-proxy-temp-path=/tmp/nginx/proxy_temp \
27
+ --http-fastcgi-temp-path=/tmp/nginx/fastcgi_temp \
28
+ --http-uwsgi-temp-path=/tmp/nginx/uwsgi_temp \
29
+ --http-scgi-temp-path=/tmp/nginx/scgi_temp \
30
+ --with-pcre \
31
+ --with-http_ssl_module \
32
+ --with-http_realip_module"
33
+ # more options at http://wiki.nginx.org/Modules
@@ -0,0 +1,24 @@
1
+ # This script is sourced at the end of install.sh when packages have been installed
2
+ # and aliases and functions have been defined.
3
+
4
+ # install ruby
5
+ download ftp://ftp.ruby-lang.org//pub/ruby/1.9/$RUBY_PACKAGE.tar.gz
6
+ extract_and_install $RUBY_PACKAGE
7
+ sudo gem update --system
8
+ sudo gem install --no-ri --no-rdoc bundler passenger
9
+
10
+ # install nginx and passenger
11
+ sudo passenger-install-nginx-module --auto --auto-download --prefix=/usr --extra-configure-flags="$NGINX_OPTIONS"
12
+ # remove confusing nginx configuration files that are not used
13
+ sudo rm -rf /etc/nginx/{conf.d,fastcgi*,scgi_params*,sites-*,uwsgi*}
14
+
15
+ # install ImageMagick
16
+ package_manager -y build-dep imagemagick
17
+ download ftp://ftp.imagemagick.org/pub/ImageMagick/$IMAGE_MAGICK_PACKAGE.tar.gz
18
+ extract_and_install $IMAGE_MAGICK_PACKAGE "$IMAGE_MAGICK_OPTIONS"
19
+
20
+ # set up the shell environment for user ubuntu
21
+ cat >> $HOME/.profile <<END_PROFILE
22
+ # export RAILS_ENV=production
23
+ # export EDITOR=vi
24
+ END_PROFILE
@@ -0,0 +1,10 @@
1
+ <%
2
+ @read_cmd = 'crontab -l | crontab -'
3
+ @write_cmd = 'crontab -'
4
+ %>
5
+
6
+ PATH=/usr/bin:/bin:/sbin:/usr/sbin
7
+ MAILTO=<%= CONFIGURATION[:admin_email] %>
8
+
9
+ # Keep the system clock on time
10
+ <%= rand(59) %> 4 * * * ntpdate -s pool.ntp.org
@@ -0,0 +1,248 @@
1
+ <%
2
+ @path = '/etc/monit/monitrc'
3
+ @perms = 0600
4
+ @post = 'echo startup=1 > /etc/default/monit'
5
+ %>
6
+ ###############################################################################
7
+ ## Monit control file
8
+ ###############################################################################
9
+ ##
10
+ ## Comments begin with a '#' and extend through the end of the line. Keywords
11
+ ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
12
+ ##
13
+ ## Below you will find examples of some frequently used statements. For
14
+ ## information about the control file and a complete list of statements and
15
+ ## options, please have a look in the Monit manual.
16
+ ##
17
+ ##
18
+ ###############################################################################
19
+ ## Global section
20
+ ###############################################################################
21
+ ##
22
+ ## Start Monit in the background (run as a daemon):
23
+ #
24
+ set daemon 45 # check services at 45-second intervals
25
+ with start delay 120 # optional: delay the first check by 2-minutes (by
26
+ # default Monit check immediately after Monit start)
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 standalone log file instead, specify the full path to the log file
32
+ #
33
+ # set logfile syslog facility log_daemon
34
+ #
35
+ #
36
+ ### Set the location of the Monit id file which stores the unique id for the
37
+ ### Monit instance. The id is generated and stored on first Monit start. By
38
+ ### default the file is placed in $HOME/.monit.id.
39
+ #
40
+ # set idfile /var/.monit.id
41
+ #
42
+ ### Set the location of the Monit state file which saves monitoring states
43
+ ### on each cycle. By default the file is placed in $HOME/.monit.state. If
44
+ ### the state file is stored on a persistent filesystem, Monit will recover
45
+ ### the monitoring state across reboots. If it is on temporary filesystem, the
46
+ ### state will be lost on reboot which may be convenient in some situations.
47
+ #
48
+ # set statefile /var/.monit.state
49
+ #
50
+ ## Set the list of mail servers for alert delivery. Multiple servers may be
51
+ ## specified using a comma separator. By default Monit uses port 25 - it is
52
+ ## possible to override this with the PORT option.
53
+ #
54
+ # set mailserver mail.bar.baz, # primary mailserver
55
+ # backup.bar.baz port 10025, # backup mailserver on port 10025
56
+ # localhost # fallback relay
57
+ #
58
+ #
59
+ ## By default Monit will drop alert events if no mail servers are available.
60
+ ## If you want to keep the alerts for later delivery retry, you can use the
61
+ ## EVENTQUEUE statement. The base directory where undelivered alerts will be
62
+ ## stored is specified by the BASEDIR option. You can limit the maximal queue
63
+ ## size using the SLOTS option (if omitted, the queue is limited by space
64
+ ## available in the back end filesystem).
65
+ #
66
+ # set eventqueue
67
+ # basedir /var/monit # set the base directory where events will be stored
68
+ # slots 100 # optionally limit the queue size
69
+ #
70
+ #
71
+ ## Send status and events to M/Monit (for more informations about M/Monit
72
+ ## see http://mmonit.com/).
73
+ #
74
+ # set mmonit http://monit:monit@192.168.1.10:8080/collector
75
+ #
76
+ #
77
+ ## Monit by default uses the following alert mail format:
78
+ ##
79
+ ## --8<--
80
+ ## From: monit@$HOST # sender
81
+ ## Subject: monit alert -- $EVENT $SERVICE # subject
82
+ ##
83
+ ## $EVENT Service $SERVICE #
84
+ ## #
85
+ ## Date: $DATE #
86
+ ## Action: $ACTION #
87
+ ## Host: $HOST # body
88
+ ## Description: $DESCRIPTION #
89
+ ## #
90
+ ## Your faithful employee, #
91
+ ## Monit #
92
+ ## --8<--
93
+ ##
94
+ ## You can override this message format or parts of it, such as subject
95
+ ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc.
96
+ ## are expanded at runtime. For example, to override the sender, use:
97
+ #
98
+ # set mail-format { from: monit@foo.bar }
99
+ #
100
+ #
101
+ ## You can set alert recipients whom will receive alerts if/when a
102
+ ## service defined in this file has errors. Alerts may be restricted on
103
+ ## events by using a filter as in the second example below.
104
+ #
105
+ # set alert sysadm@foo.bar # receive all alerts
106
+ # set alert manager@foo.bar only on { timeout } # receive just service-
107
+ # # timeout alert
108
+ #
109
+ #
110
+ ## Monit has an embedded web server which can be used to view status of
111
+ ## services monitored and manage services from a web interface. See the
112
+ ## Monit Wiki if you want to enable SSL for the web server.
113
+ #
114
+ # set httpd port 2812 and
115
+ # use address localhost # only accept connection from localhost
116
+ # allow localhost # allow localhost to connect to the server and
117
+ # allow admin:monit # require user 'admin' with password 'monit'
118
+ # allow @monit # allow users of group 'monit' to connect (rw)
119
+ # allow @users readonly # allow users of group 'users' to connect readonly
120
+ #
121
+ #
122
+ ###############################################################################
123
+ ## Services
124
+ ###############################################################################
125
+ ##
126
+ ## Check general system resources such as load average, cpu and memory
127
+ ## usage. Each test specifies a resource, conditions and the action to be
128
+ ## performed should a test fail.
129
+ #
130
+ check system <%= host_name %>
131
+ if loadavg (1min) > 4 then alert
132
+ if loadavg (5min) > 2 then alert
133
+ if memory usage > 75% then alert
134
+ if cpu usage (user) > 70% then alert
135
+ if cpu usage (system) > 30% then alert
136
+ if cpu usage (wait) > 20% then alert
137
+
138
+ check device rootfs with path /
139
+ if space usage > 75% then alert
140
+ if inode usage > 75% then alert
141
+
142
+ #
143
+ #
144
+ ## Check a file for existence, checksum, permissions, uid and gid. In addition
145
+ ## to alert recipients in the global section, customized alert can be sent to
146
+ ## additional recipients by specifying a local alert handler. The service may
147
+ ## be grouped using the GROUP option. More than one group can be specified by
148
+ ## repeating the 'group name' statement.
149
+ #
150
+ # check file apache_bin with path /usr/local/apache/bin/httpd
151
+ # if failed checksum and
152
+ # expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
153
+ # if failed permission 755 then unmonitor
154
+ # if failed uid root then unmonitor
155
+ # if failed gid root then unmonitor
156
+ # alert security@foo.bar on {
157
+ # checksum, permission, uid, gid, unmonitor
158
+ # } with the mail-format { subject: Alarm! }
159
+ # group server
160
+ #
161
+ #
162
+ ## Check that a process is running, in this case Apache, and that it respond
163
+ ## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory,
164
+ ## and number of children. If the process is not running, Monit will restart
165
+ ## it by default. In case the service is restarted very often and the
166
+ ## problem remains, it is possible to disable monitoring using the TIMEOUT
167
+ ## statement. This service depends on another service (apache_bin) which
168
+ ## is defined above.
169
+ #
170
+ # check process apache with pidfile /usr/local/apache/logs/httpd.pid
171
+ # start program = "/etc/init.d/httpd start" with timeout 60 seconds
172
+ # stop program = "/etc/init.d/httpd stop"
173
+ # if cpu > 60% for 2 cycles then alert
174
+ # if cpu > 80% for 5 cycles then restart
175
+ # if totalmem > 200.0 MB for 5 cycles then restart
176
+ # if children > 250 then restart
177
+ # if loadavg(5min) greater than 10 for 8 cycles then stop
178
+ # if failed host www.tildeslash.com port 80 protocol http
179
+ # and request "/somefile.html"
180
+ # then restart
181
+ # if failed port 443 type tcpssl protocol http
182
+ # with timeout 15 seconds
183
+ # then restart
184
+ # if 3 restarts within 5 cycles then timeout
185
+ # depends on apache_bin
186
+ # group server
187
+ #
188
+ #
189
+ ## Check filesystem permissions, uid, gid, space and inode usage. Other services,
190
+ ## such as databases, may depend on this resource and an automatically graceful
191
+ ## stop may be cascaded to them before the filesystem will become full and data
192
+ ## lost.
193
+ #
194
+ # check filesystem datafs with path /dev/sdb1
195
+ # start program = "/bin/mount /data"
196
+ # stop program = "/bin/umount /data"
197
+ # if failed permission 660 then unmonitor
198
+ # if failed uid root then unmonitor
199
+ # if failed gid disk then unmonitor
200
+ # if space usage > 80% for 5 times within 15 cycles then alert
201
+ # if space usage > 99% then stop
202
+ # if inode usage > 30000 then alert
203
+ # if inode usage > 99% then stop
204
+ # group server
205
+ #
206
+ #
207
+ ## Check a file's timestamp. In this example, we test if a file is older
208
+ ## than 15 minutes and assume something is wrong if its not updated. Also,
209
+ ## if the file size exceed a given limit, execute a script
210
+ #
211
+ # check file database with path /data/mydatabase.db
212
+ # if failed permission 700 then alert
213
+ # if failed uid data then alert
214
+ # if failed gid data then alert
215
+ # if timestamp > 15 minutes then alert
216
+ # if size > 100 MB then exec "/my/cleanup/script" as uid dba and gid dba
217
+ #
218
+ #
219
+ ## Check directory permission, uid and gid. An event is triggered if the
220
+ ## directory does not belong to the user with uid 0 and gid 0. In addition,
221
+ ## the permissions have to match the octal description of 755 (see chmod(1)).
222
+ #
223
+ # check directory bin with path /bin
224
+ # if failed permission 755 then unmonitor
225
+ # if failed uid 0 then unmonitor
226
+ # if failed gid 0 then unmonitor
227
+ #
228
+ #
229
+ ## Check a remote host availability by issuing a ping test and check the
230
+ ## content of a response from a web server. Up to three pings are sent and
231
+ ## connection to a port and an application level network check is performed.
232
+ #
233
+ # check host myserver with address 192.168.1.1
234
+ # if failed icmp type echo count 3 with timeout 3 seconds then alert
235
+ # if failed port 3306 protocol mysql with timeout 15 seconds then alert
236
+ # if failed url http://user:password@192.168.1.1:8080/?querystring
237
+ # and content == 'action="j_security_check"'
238
+ # then alert
239
+ #
240
+ ###############################################################################
241
+ ## Includes
242
+ ###############################################################################
243
+ ##
244
+ ## It is possible to include additional configuration parts from other files or
245
+ ## directories.
246
+ #
247
+
248
+ include /etc/monit/conf.d/*