Skip to content

Commit

Permalink
Normal Operating Range cpu/mem usage rate to use avg
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswnl committed Jul 2, 2018
1 parent 362b5ff commit 4c59961
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/metric/long_term_averages.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Metric::LongTermAverages
AVG_COLS_TO_OVERHEAD_TYPE = {
:cpu_usagemhz_rate_average => nil,
:cpu_usage_rate_average => nil,
:mem_usage_absolute_average => nil,
:derived_memory_used => nil,
:max_cpu_usage_rate_average => :cpu,
:max_mem_usage_absolute_average => :memory
Expand Down
2 changes: 2 additions & 0 deletions app/models/vm_or_template/right_sizing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ def max_cpu_usage_rate_average_max_over_time_period
p.abs_max_cpu_usage_rate_average_value
end.compact.max
end
alias_method :cpu_usage_rate_average_max_over_time_period, :max_cpu_usage_rate_average_max_over_time_period

def max_mem_usage_absolute_average_max_over_time_period
end_date = Time.now.utc.beginning_of_day - 1
perfs = VimPerformanceAnalysis.find_perf_for_time_period(self, "daily", :end_date => end_date, :days => Metric::LongTermAverages::AVG_DAYS)
perfs.collect(&:abs_max_mem_usage_absolute_average_value).compact.max
end
alias_method :mem_usage_absolute_average_max_over_time_period, :max_mem_usage_absolute_average_max_over_time_period

def cpu_usagemhz_rate_average_max_over_time_period
end_date = Time.now.utc.beginning_of_day - 1
Expand Down

0 comments on commit 4c59961

Please sign in to comment.