class Malsh::HostMetrics::Cpu
Public Class Methods
get_max_value(host_metrics)
click to toggle source
# File lib/malsh/host_metrics/cpu.rb, line 8 def get_max_value(host_metrics) host_metrics.max_by do |time,cpu| resources.map { |name| cpu[name] }.inject(:+) if all_keys?(cpu) end end
normalize_result(max, host)
click to toggle source
# File lib/malsh/host_metrics/cpu.rb, line 14 def normalize_result(max, host) resources.map { |name| max.last[name] }.inject(:+) / host["meta"]["cpu"].size end
option_name()
click to toggle source
# File lib/malsh/host_metrics/cpu.rb, line 18 def option_name :cpu_threshold end
resources()
click to toggle source
# File lib/malsh/host_metrics/cpu.rb, line 4 def resources %w(cpu.user.percentage cpu.iowait.percentage cpu.system.percentage) end