Sha256: f77b6ea5adc0311139acea171b780bca213d10d08c5c52c04b3ed0d9810c877f

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

class NagiosConfig < CloudstackNagios::Base

  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
  	host_template = load_template(options[:template])
    puts host_template.result(
      routers: cs_routers,
      date: date_string
    )
  end

  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
    bin_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'bin'))
    config_file = options[:config]
  	service_template = load_template(options[:template])
    puts service_template.result(
      routers: cs_routers,
      bin_path: bin_path,
      config_file: config_file,
      date: date_string
    )
  end

  no_commands do
    def date_string
      Time.new.strftime("%d.%m.%Y - %H:%M:%S")
    end
  end

 end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cloudstack-nagios-0.5.1 lib/cloudstack-nagios/commands/nagios_config.rb
cloudstack-nagios-0.4.2 lib/cloudstack-nagios/commands/nagios_config.rb
cloudstack-nagios-0.4.1 lib/cloudstack-nagios/commands/nagios_config.rb
cloudstack-nagios-0.4.0 lib/cloudstack-nagios/commands/nagios_config.rb
cloudstack-nagios-0.3.3 lib/cloudstack-nagios/commands/nagios_config.rb
cloudstack-nagios-0.3.2 lib/cloudstack-nagios/commands/nagios_config.rb