Class: What::Modules::Unicorn

Inherits:
Base
  • Object
show all
Defined in:
lib/what/modules/unicorn.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #name, #status

Constructor Details

This class inherits a constructor from What::Modules::Base

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

#detailsObject



19
20
21
# File 'lib/what/modules/unicorn.rb', line 19

def details
  {:workers => @unicorns.count, :details => @unicorns}
end

#healthObject



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