Class: Bsdnet::CurrentEntries

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

Class Method Summary collapse

Class Method Details

.chart_data(options = {}) ⇒ Object



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

def self.chart_data(options = {})
  charts = []
  options[:interface] = 'vlan254'
  charts << self.entries_chart(options)
  return charts
end

.entries_chart(options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/app/models/bsdnet/current_entries.rb', line 17

def self.entries_chart(options)
  chart = self.chart_structure({:title => "Network current entries", :value_axis => { :title => "Network entries []"}})
  values = Bsdnet::CurrentEntries.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[:graph_data] = values
  chart
end

.graphsObject



28
29
30
31
32
# File 'lib/app/models/bsdnet/current_entries.rb', line 28

def self.graphs
  {
    :current_entries => { :line_color => '#FF3300' },
  }
end