Class: Cloudscale::Plugins::Plugin
- Inherits:
-
Object
- Object
- Cloudscale::Plugins::Plugin
show all
- Defined in:
- lib/cloudscale/plugins/plugin.rb
Direct Known Subclasses
MongoDbStatus, MongoReplicaStatus, MongoServerStatus, PostgresServerStatus, SigarCpuPerc, SigarDiskIops, SigarDiskSpace, SigarNetByteInformation, SigarNetPacketInformation, SigarRamUsage, SigarSwapUsage
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Plugin
Returns a new instance of Plugin.
26
27
28
|
# File 'lib/cloudscale/plugins/plugin.rb', line 26
def initialize()
@rest_client = RestClientWrapper.instance
end
|
Instance Attribute Details
#log ⇒ Object
Returns the value of attribute log.
18
19
20
|
# File 'lib/cloudscale/plugins/plugin.rb', line 18
def log
@log
end
|
#plugins ⇒ Object
Returns the value of attribute plugins.
18
19
20
|
# File 'lib/cloudscale/plugins/plugin.rb', line 18
def plugins
@plugins
end
|
#rest_client ⇒ Object
Returns the value of attribute rest_client.
18
19
20
|
# File 'lib/cloudscale/plugins/plugin.rb', line 18
def rest_client
@rest_client
end
|
Class Method Details
.inherited(klass) ⇒ Object
75
76
77
|
# File 'lib/cloudscale/plugins/plugin.rb', line 75
def self.inherited(klass)
@plugins << klass
end
|
.plugins ⇒ Object
71
72
73
|
# File 'lib/cloudscale/plugins/plugin.rb', line 71
def self.plugins
@plugins
end
|
.remove(agentInstanceId) ⇒ Object
38
39
40
41
42
|
# File 'lib/cloudscale/plugins/plugin.rb', line 38
def self.remove(agentInstanceId)
reset(agentInstanceId)
Constants::AgentInstance.remove()
end
|
.remove_agenInstance(agentInstanceId) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/cloudscale/plugins/plugin.rb', line 59
def self.remove_agenInstance(agentInstanceId)
rest_client = RestClientWrapper.instance
puts "Removing AgentInstance completely:\n\n"
agent_instance = rest_client.searchOne('agentInstances',
'findByAgentInstanceId', { :id => agentInstanceId })
rest_client.delete('agentInstances', RestClientWrapper.load_entity_id(agent_instance))
puts " Deleting AgentInstance was successful \n\n"
end
|
.reset(agentInstanceId) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/cloudscale/plugins/plugin.rb', line 30
def self.reset(agentInstanceId)
resetRestEndpoint('coredatas', agentInstanceId, 'Coredata')
resetRestEndpoint('tables', agentInstanceId, 'Table')
resetRestEndpoint('charts', agentInstanceId, 'Chart')
remove_agenInstance(agentInstanceId)
end
|
.resetRestEndpoint(entityRel, agentInstanceId, entityName) ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/cloudscale/plugins/plugin.rb', line 44
def self.resetRestEndpoint(entityRel, agentInstanceId, entityName)
rest_client = RestClientWrapper.instance
entities = rest_client.searchAny(entityRel,"findByAgentInstanceId",
{ :agentInstanceId => agentInstanceId })
puts "Found #{entityName} elements for Agent (#{agentInstanceId}): #{entities["content"].length.to_s}"
puts " Starting to delete all elements..."
entities["content"].each do | entity |
rest_client.delete(entityRel, RestClientWrapper.load_entity_id(entity))
end
puts " Deleting all elements was successful \n\n"
end
|