Commit e2202625 authored by Marin Jankovski's avatar Marin Jankovski

Extend unicorn attributes.

parent c0d7da52
......@@ -104,8 +104,8 @@ default['gitlab']['aws'] = {
:endpoint => 'https://s3.example.com:8080' # optional, defaults to nil
}
default['gitlab']['monitrc']['unicorn'] = {
:pid_path => "#{default['gitlab']['path']}/tmp/pids/unicorn.pid",
default['gitlab']['monitrc']['sidekiq'] = {
:pid_path => "#{default['gitlab']['path']}/tmp/pids/sidekiq.pid",
:start_timeout => "80", # in seconds
:stop_timeout => "40", # in seconds
:cpu_threshold => "40", # in %
......@@ -116,5 +116,11 @@ default['gitlab']['monitrc']['unicorn'] = {
:restart_cycles_number => "5" # Number of cycles to monitor for consecutive restarts.
}
default['gitlab']['monitrc']['sidekiq_pid_path'] = "#{default['gitlab']['path']}/tmp/pids/sidekiq.pid"
default['gitlab']['monitrc']['unicorn'] = {
:pid_path => "#{default['gitlab']['path']}/tmp/pids/unicorn.pid",
:mem_threshold => "1000.0", # in MB
:mem_cycles_number => "25",
:cpu_threshold => "80", # in %
:cpu_cycles_number => "50"
}
default['gitlab']['monitrc']['notify_email'] = "monitrc@localhost"
......@@ -25,11 +25,16 @@ monit_monitrc "sidekiq" do
})
end
unicorn = monitrc['unicorn']
monit_monitrc "unicorn" do
variables ({
gitlab_user: gitlab['user'],
gitlab_path: gitlab['path'],
unicorn_pid_path: monitrc['unicorn_pid_path'],
unicorn_pid_path: unicorn['pid_path'],
mem_threshold: unicorn['mem_threshold'],
mem_cycles_number: unicorn['mem_cycles_number'],
cpu_threshold: unicorn['cpu_threshold'],
cpu_cycles_number: unicorn['cpu_cycles_number'],
notify_email: monitrc['notify_email']
})
end
......
......@@ -2,5 +2,5 @@ check process unicorn with pidfile <%= @unicorn_pid_path %>
alert <%= @notify_email %> but not on { ppid }
start program = "/bin/cat /dev/null"
stop program = "/bin/su - <%= @gitlab_user %> -c 'RAILS_ENV=production <%= @gitlab_path %>/script/web reload'"
if totalmem is greater than 1000.0 MB for 25 cycles then restart
if cpu is greater than 80% for 50 cycles then restart
if totalmem is greater than <%= @mem_threshold %> MB for <%= @mem_cycles_number %> cycles then restart
if totalcpu is greater than <%= @cpu_threshold %>% for <%= @cpu_cycles_number %> cycles then restart
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment