Class: What::Modules::Unicorn
- Inherits:
-
Base
- Object
- Base
- What::Modules::Unicorn
show all
- Defined in:
- lib/what/modules/unicorn.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #name, #status
Instance Method Details
#check! ⇒ Object
4
5
6
7
8
9
|
# File 'lib/what/modules/unicorn.rb', line 4
def check!
@unicorns = `ps aux`.split("\n").grep(/unicorn_rails worker/).map do |ln|
ln =~ /^\w+\s+(\d+).*(\d+:\d\d(?:\.\d\d)?) unicorn/
{:pid => $1, :cpu_time => $2}
end
end
|
#details ⇒ Object
19
20
21
|
# File 'lib/what/modules/unicorn.rb', line 19
def details
{:workers => @unicorns.count, :details => @unicorns}
end
|
#health ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/what/modules/unicorn.rb', line 11
def health
if @unicorns.count > 0
:ok
else
:alert
end
end
|