Class: Naginata::CLI::Fetch

Inherits:
RemoteAbstract show all
Defined in:
lib/naginata/cli/fetch.rb

Instance Method Summary collapse

Methods inherited from RemoteAbstract

#configure_backend, #execute, #initialize, #load_configuration, #set_log_level, #set_nagios_filter

Constructor Details

This class inherits a constructor from Naginata::CLI::RemoteAbstract

Instance Method Details

#load_remote_objectsObject



25
26
# File 'lib/naginata/cli/fetch.rb', line 25

def load_remote_objects
end

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/naginata/cli/fetch.rb', line 9

def run
  Naginata::Runner.run do |backend, nagios_server, services|
    status_file = (nagios_server.fetch(:status_file) || ::Naginata::Configuration.env.fetch(:nagios_server_options)[:status_file])
    if !@options[:dry_run]
      str = backend.capture(:cat, status_file)
      st = ::Naginata::Status.build(str, nagios_server.hostname)
      st.save
    else
      st = ::Naginata::Status.new
      st.hostname = nagios_server.hostname
    end
    puts "Saved into #{st.path}" if @options[:verbose]
  end

end