Class: OracleSessions

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

Class Method Summary collapse

Class Method Details

.chart_data(options = {}) ⇒ Object



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

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

.graphsObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/app/models/oracle_sessions.rb', line 25

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

.sessions_chart(options) ⇒ Object



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

def self.sessions_chart(options)
  chart = self.chart_structure({:title => "Oracle sessions", :value_axis => { :title => "Sessions count"}})
  chart[:graph_data] = OracleSessions.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