Class: DiskIo

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

Class Method Summary collapse

Class Method Details

.chart_data(options = {}) ⇒ Object



10
11
12
13
14
# File 'lib/app/models/disk_io.rb', line 10

def self.chart_data(options = {})
  charts = []
  charts << self.disk_io_charts(options)
  return charts
end

.disk_io_charts(options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/app/models/disk_io.rb', line 16

def self.disk_io_charts(options)
  chart = self.chart_structure({:title => "Host load average", :value_axis => { :title => "Memory size in KB"},:include_guides_in_min_max => false})

  #CHOOSE HERE which
  # TODO ADD ALL TYPES
  #TODO ADD GUIDES - if num of cores from facter
  graphs = [ :load_1m, :load_5m, :load_15m ]

#TODO cpu and here - sort by timestamp
  chart[:graph_data] = DiskIo.where(:timestamp.gte => options[:start]).
                              where(:timestamp.lt => options[:end]).
		where(:host_id => options[:host_id]).
		where(:plugin_id => options[:plugin_id]).
		order(timestamp: :asc)

  chart
end

.graphsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/app/models/disk_io.rb', line 34

def self.graphs
  { 
    :load_15m => { 
      :hidden => false,
      :line_color => "#FF0000",
      :line_thickness => 3,
      :title => "Load 15 minutes average"},
     :load_5m => {
       :hidden => false,
       :line_color => "#FFFF00",
       :line_thickness => 2,
       :title => "Load 5 minutes average"},
     :load_1m => {
       :hidden => false,
       :line_color => "#FFaa00",
       :line_thickness => 1,
       :title => "Load 1 minute average"}
   }
end