lib/cloudstack-nagios/helper.rb in cloudstack-nagios-0.7.8 vs lib/cloudstack-nagios/helper.rb in cloudstack-nagios-0.8.0
- old
+ new
@@ -6,17 +6,23 @@
if File.file?(template_path)
templ = Erubis::Eruby.new(File.read template_path)
templ.filename = template_path
return templ
else
- say "Error: template not found #{template_path}"
+ say "Error: Template \"#{template_path}\" not found.", :red
exit 1
end
end
def cs_routers
routers = client.list_routers(status: 'Running')
routers += client.list_routers(projectid: -1, status: 'Running')
+ end
+
+ def storage_pools
+ storage_pools = client.list_storage_pools.select do |pool|
+ pool['state'].downcase == 'up'
+ end
end
def exit_with_failure(exception)
say 'ERROR: command execution failed!', :red
say "Message: ", :magenta