Class: Bosh::Agent::Message::State
- Defined in:
- lib/bosh_agent/message/state.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = nil) ⇒ State
constructor
A new instance of State.
- #job_state ⇒ Object
- #state ⇒ Object
Methods inherited from Base
#base_dir, #handler_error, #logger, #logs_dir, #settings, #store_migration_target, #store_path
Constructor Details
Class Method Details
.process(args) ⇒ Object
7 8 9 |
# File 'lib/bosh_agent/message/state.rb', line 7 def self.process(args) self.new(args).state end |
Instance Method Details
#job_state ⇒ Object
42 43 44 |
# File 'lib/bosh_agent/message/state.rb', line 42 def job_state Bosh::Agent::Monit.service_group_state end |
#state ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bosh_agent/message/state.rb', line 17 def state response = Bosh::Agent::Config.state.to_hash logger.info("Agent state: #{response.inspect}") if settings response["agent_id"] = settings["agent_id"] response["vm"] = settings["vm"] end response["job_state"] = job_state response["bosh_protocol"] = Bosh::Agent::BOSH_PROTOCOL response["ntp"] = Bosh::Agent::NTP.offset if @full_format response["vitals"] = Bosh::Agent::Monit.get_vitals response["vitals"]["disk"] = Bosh::Agent::DiskUtil.get_usage end response rescue Bosh::Agent::StateError => e raise Bosh::Agent::MessageHandlerError, e end |