module Bosh::Monitor

Consul Bosh Monitor Plugin Forwards alert and heartbeat messages as events to a consul agent

This health monitor plugin should be used in conjunction with another plugin that alerts when a VM is unresponsive, as this plugin will try to automatically fix the problem by recreating the VM

Constants

VERSION

Attributes

agent_manager[RW]
director[RW]
em_threadpool_size[RW]
event_mbus[RW]
event_processor[RW]
http_port[RW]
intervals[RW]
logger[RW]
mbus[RW]
nats[RW]
plugins[RW]

Public Class Methods

config=(config) click to toggle source
# File lib/bosh/monitor/config.rb, line 19
def config=(config)
  validate_config(config)

  @logger = Logging.logger(config["logfile"] || STDOUT)
  @intervals = OpenStruct.new(config["intervals"])
  @director = Director.new(config["director"], @logger)
  @mbus = OpenStruct.new(config["mbus"])

  @em_threadpool_size = config["em_threadpool_size"]

  @event_processor = EventProcessor.new
  @agent_manager = AgentManager.new(event_processor)

  # Interval defaults
  @intervals.prune_events ||= 30
  @intervals.poll_director ||= 60
  @intervals.poll_grace_period ||= 30
  @intervals.log_stats ||= 60
  @intervals.analyze_agents ||= 60
  @intervals.agent_timeout ||= 60
  @intervals.rogue_agent_alert ||= 120

  if config["http"].is_a?(Hash)
    @http_port = config["http"]["port"]
  end

  if config["event_mbus"]
    @event_mbus = OpenStruct.new(config["event_mbus"])
  end

  if config["loglevel"].is_a?(String)
    @logger.level = config["loglevel"].to_sym
  end

  if config["plugins"].is_a?(Enumerable)
    @plugins = config["plugins"]
  end
end
validate_config(config) click to toggle source
# File lib/bosh/monitor/config.rb, line 58
def validate_config(config)
  unless config.is_a?(Hash)
    raise ConfigError, "Invalid config format, Hash expected, #{config.class} given"
  end
end