lib/cloudstack-nagios/commands/nagios_config.rb in cloudstack-nagios-0.2.0 vs lib/cloudstack-nagios/commands/nagios_config.rb in cloudstack-nagios-0.3.0

- old
+ new

@@ -1,13 +1,23 @@ class NagiosConfig < CloudstackNagios::Base - desc "nagios_config hosts", "generate nagios hosts configuration for virtual routers" + desc "hosts", "generate nagios hosts configuration for virtual routers" + option :template, + desc: "path of ERB template to use", + default: File.join(File.dirname(__FILE__), '..', 'templates', 'cloudstack_routers_hosts.cfg.erb'), + aliases: '-t' def hosts - puts load_template("cloudstack_routers_hosts.cfg.erb").result(routers: routers) + host_template = load_template(options[:template]) + puts host_template.result(routers: cs_routers) end - desc "nagios_config services", "generate nagios services configuration for virtual routers" + desc "services", "generate nagios services configuration for virtual routers" + option :template, + desc: "path of ERB template to use", + default: File.join(File.dirname(__FILE__), '..', 'templates', 'cloudstack_routers_services.cfg.erb'), + aliases: '-t' def services - puts load_template("cloudstack_routers_services.cfg.erb").result(routers: routers) + service_template = load_template(options[:template]) + puts service_template.result(routers: cs_routers) end end