Top Level Namespace

Defined Under Namespace

Modules: Apt, Deprec2, Emerge, Gem, Std, Yum

Constant Summary collapse

OK =

Exit status

0
WARNING =
1
CRITICAL =
2

Instance Method Summary collapse

Instance Method Details

#chdir_cwdObject



20
21
22
23
24
25
# File 'lib/deprec/templates/nagios/check_mongrel_cluster.rb', line 20

def chdir_cwd
  pwd = Dir.pwd
  Dir.chdir(@options["cwd"]) if @options["cwd"]     
  yield
  Dir.chdir(pwd) if @options["cwd"]
end

#read_pid(port) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/deprec/templates/nagios/check_mongrel_cluster.rb', line 27

def read_pid(port)
  pid_file = port_pid_file(port)
  pid = 0
  chdir_cwd do     
    pid = File.read(pid_file)
  end
  pid
end

#running?(pid) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/deprec/templates/nagios/check_mongrel_cluster.rb', line 14

def running?(pid)
  # check if pid is running
  ps_output = `ps -p #{pid}`
  ps_output =~ /mongrel_rails/
end