Class: Age

Inherits:
Object
  • Object
show all
Includes:
Sys
Defined in:
lib/check/age.rb

Class Method Summary collapse

Class Method Details

.checkObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/check/age.rb', line 8

def self.check
  return_value = nil
  perf_string = "age_in_days=#{uptime.days}"
  message = nil
  if uptime.days == 20 
    message = "CRITICAL:I should die today, remember i'll shout only today"
    return_value = 2
  elsif uptime.days > 20 
    message = "WARNING: I'm dead man fucker"
    return_value = 1
  elsif uptime.days > 15
    message = "WARNING: I'm too old to serve, kill me please!"
    return_value = 1
  else
    message = "OK : I'm young are you?"
    return_value = 0
  end 
  return({ :return_value =>return_value,
     :message => message,
     :perf_string=> perf_string })
end

.uptimeObject


31
32
33
# File 'lib/check/age.rb', line 31

def self.uptime
  Uptime
end