Class: Disk
- Inherits:
-
Object
- Object
- Disk
- Includes:
- Graphs::AreaStackedChart, Mongoid::Attributes::Dynamic, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/app/models/disk.rb
Class Method Summary collapse
- .all_disks_charts(options) ⇒ Object
- .chart_data(options = {}) ⇒ Object
- .disk_chart(mount, values) ⇒ Object
- .graphs ⇒ Object
Class Method Details
.all_disks_charts(options) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/app/models/disk.rb', line 16 def self.all_disks_charts() charts = [] Disk.where(:timestamp.gte => [:start]). where(:timestamp.lt => [:end]). where(:host_id => [:host_id]). where(:plugin_id => [:plugin_id]). order_by(timestamp: :asc).group_by{|u| u.mount}.each_pair do |mount, values| charts << self.disk_chart(mount, values) end return charts end |
.chart_data(options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/app/models/disk.rb', line 10 def self.chart_data( = {}) charts = [] charts = self.all_disks_charts() return charts end |
.disk_chart(mount, values) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/app/models/disk.rb', line 28 def self.disk_chart(mount, values) chart = self.chart_structure({:title => "Disk space usage for #{mount}", :value_axis => { :title => "Disk usage in KB"}}) #TODO - get fields from above DRY chart[:graph_data] = values chart end |
.graphs ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/app/models/disk.rb', line 35 def self.graphs { :block_used => { :hidden => false, :line_color => "#FF0000", :line_thickness => 3, :title => "block used" }, :block_free => { :hidden => false, :line_color => "#00FF00", :line_thickness => 3, :title => "block free" } } end |