Class: ForemanFogProxmox::NodeDashboard::Data

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_fog_proxmox/node_dashboard/data.rb

Instance Method Summary collapse

Constructor Details

#initialize(filter = '') ⇒ Data

Returns a new instance of Data.



23
24
25
# File 'app/services/foreman_fog_proxmox/node_dashboard/data.rb', line 23

def initialize(filter = '')
  @filter = filter
end

Instance Method Details

#nodeObject



27
28
29
30
# File 'app/services/foreman_fog_proxmox/node_dashboard/data.rb', line 27

def node
  @compute_resource = ComputeResource.where(type: 'ForemanFogProxmox::Proxmox').first
  @compute_resource.nodes.first
end

#node_idObject



32
33
34
# File 'app/services/foreman_fog_proxmox/node_dashboard/data.rb', line 32

def node_id
  node&.identity
end

#statisticsObject



36
37
38
# File 'app/services/foreman_fog_proxmox/node_dashboard/data.rb', line 36

def statistics
  node.statistics('rrddata', timeframe: 'hour', cf: 'AVERAGE') if node_id
end