Class: OracleTablespacesSizes

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

Class Method Summary collapse

Class Method Details

.all_tablespaces_charts(options) ⇒ Object



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

def self.all_tablespaces_charts(options)
  charts = []
  OracleTablespacesSizes.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).group_by{|u| u.name}.each_pair do |tablespace, values|
    charts << self.tablespace_chart(tablespace, values)
  end
  return charts
end

.chart_data(options = {}) ⇒ Object



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

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

.graphsObject



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

def self.graphs
  {
    :used => {
      :hidden => false,
      :line_color => "#FF0000",
      :line_thickness => 3,
	:balloon_text => "[[title]]: [[value]] ([[percents]]%)",
      :title => "Bytes used"
    },
    :free => {
      :hidden => false,
      :line_color => "#00FF00",
      :line_thickness => 3,
	:balloon_text => "[[title]]: [[value]] ([[percents]]%)",
      :title => "Bytes free"
    }
  }
end

.tablespace_chart(tablespace, values) ⇒ Object



27
28
29
30
31
# File 'lib/app/models/oracle_tablespaces_sizes.rb', line 27

def self.tablespace_chart(tablespace, values)
  chart = self.chart_structure({:title => "Tablespace #{tablespace} space usage", :value_axis => { :title => "Size in bytes"}})
  chart[:graph_data] = values
  return chart
end