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.



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

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

Instance Method Details

#node_idObject



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

def node_id
    @compute_resource = ComputeResource.find_by(type: 'ForemanFogProxmox::Proxmox')
    @compute_resource.node_id if @compute_resource
end

#statisticsObject



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

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