Class: Jvm

Inherits:
Object
  • Object
show all
Includes:
Graphs::AreaNotStackedChart, Mongoid::Attributes::Dynamic, Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/app/models/jvm.rb

Class Method Summary collapse

Class Method Details

.chart_data(options = {}) ⇒ Object



9
10
11
12
13
# File 'lib/app/models/jvm.rb', line 9

def self.chart_data(options = {})
  charts = []

  charts << self.threads_chart(options)
end

.threads_chart(options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/app/models/jvm.rb', line 15

def self.threads_chart(options)
  graphs = [:free, :swap_used]
  graph_fields = graphs << :timestamp
  chart = area_stacked_chart(:graphs => graphs, :value_axis_title => 'Number of threads', :chart_title => 'Java threads')
  chart[:graph_data] = Jvm.where(:timestamp.gte => options[:start]).
                           where(:timestamp.lt => options[:end]).
       where(:host_id => options[:host_id]).
       where(:plugin_id => options[:plugin_id]).
       order_by(timestamp: :asc)
  return chart
end