Module: ITrigga::Generator

Defined in:
lib/itrigga-generator/constants.rb,
lib/itrigga-generator/generator.rb

Defined Under Namespace

Classes: Generator

Class Method Summary collapse

Class Method Details

.disksObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/itrigga-generator/constants.rb', line 11

def self.disks
  @devices ||= `df | grep ^/dev/`
  disks = {}
  @devices.split("\n").each{ |l| 
    cols = l.split("\s")
    # note: on mac, we can get spaces in filenames. Meh...
    disks[cols.first] = cols[5..(cols.size-1)].join(" ")
  }
  disks
end

.std_alert(max_memory = 1000) ⇒ Object



4
5
6
7
8
9
# File 'lib/itrigga-generator/constants.rb', line 4

def self.std_alert(max_memory = 1000)
  "if totalmem is greater than #{max_memory} Mb for 5 cycles then alert          
  if cpu is greater than 50% for 4 cycles then alert                  
	if cpu is greater than 80% for 6 cycles then restart                
	if loadavg(5min) greater than 10 for 8 cycles then restart" 
end