Sha256: 9c05e3ec709ca813c80dd57dc459dad319d5515f6051b529543d424410bf2538

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

module ITrigga
  module Generator
    
    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

    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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itrigga-generator-0.1.3 lib/itrigga-generator/constants.rb
itrigga-generator-0.1.2 lib/itrigga-generator/constants.rb