class Malsh::HostMetrics::Memory

Public Class Methods

get_max_value(host_metrics) click to toggle source
# File lib/malsh/host_metrics/memory.rb, line 8
def get_max_value(host_metrics)
  host_metrics.max_by do |time,memory|
    resources.map { |name| memory[name] }.inject(:+) if all_keys?(memory)
    (memory["memory.used"] + memory["memory.cached"]) / memory["memory.total"] * 100 if all_keys?(memory)
  end
end
normalize_result(max, host) click to toggle source
# File lib/malsh/host_metrics/memory.rb, line 15
def normalize_result(max, host)
  (max.last["memory.used"] + max.last["memory.cached"]) / max.last["memory.total"] * 100
end
option_name() click to toggle source
# File lib/malsh/host_metrics/memory.rb, line 19
def option_name
  :memory_threshold
end
resources() click to toggle source
# File lib/malsh/host_metrics/memory.rb, line 4
def resources
  %w(memory.total memory.used memory.cached)
end