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

#node_idObject



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

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

#statisticsObject



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

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