Module: Bosh::Monitor

Defined in:
lib/bosh/monitor/plugins/resurrector.rb,
lib/bosh/monitor.rb,
lib/bosh/monitor/agent.rb,
lib/bosh/monitor/config.rb,
lib/bosh/monitor/errors.rb,
lib/bosh/monitor/metric.rb,
lib/bosh/monitor/runner.rb,
lib/bosh/monitor/version.rb,
lib/bosh/monitor/director.rb,
lib/bosh/monitor/events/base.rb,
lib/bosh/monitor/yaml_helper.rb,
lib/bosh/monitor/events/alert.rb,
lib/bosh/monitor/plugins/base.rb,
lib/bosh/monitor/plugins/nats.rb,
lib/bosh/monitor/plugins/tsdb.rb,
lib/bosh/monitor/agent_manager.rb,
lib/bosh/monitor/auth_provider.rb,
lib/bosh/monitor/plugins/dummy.rb,
lib/bosh/monitor/plugins/email.rb,
lib/bosh/monitor/api_controller.rb,
lib/bosh/monitor/plugins/logger.rb,
lib/bosh/monitor/event_processor.rb,
lib/bosh/monitor/plugins/datadog.rb,
lib/bosh/monitor/director_monitor.rb,
lib/bosh/monitor/events/heartbeat.rb,
lib/bosh/monitor/plugins/graphite.rb,
lib/bosh/monitor/plugins/pagerduty.rb,
lib/bosh/monitor/plugins/cloud_watch.rb,
lib/bosh/monitor/protocols/tcp_connection.rb,
lib/bosh/monitor/protocols/tsdb_connection.rb,
lib/bosh/monitor/protocols/graphite_connection.rb,
lib/bosh/monitor/plugins/consul_event_forwarder.rb,
lib/bosh/monitor/plugins/syslog_event_forwarder.rb

Overview

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

Defined Under Namespace

Modules: Events, Plugins, YamlHelper Classes: Agent, AgentManager, ApiController, AuthProvider, ConfigError, ConnectionError, Director, DirectorError, DirectorMonitor, Error, EventProcessingError, EventProcessor, FatalError, GraphiteConnection, InvalidEvent, Metric, PluginError, Runner, TcpConnection, TsdbConnection, UAAToken

Constant Summary collapse

VERSION =
'1.3262.24.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.agent_managerObject

Returns the value of attribute agent_manager.



11
12
13
# File 'lib/bosh/monitor/config.rb', line 11

def agent_manager
  @agent_manager
end

.directorObject

Returns the value of attribute director.



6
7
8
# File 'lib/bosh/monitor/config.rb', line 6

def director
  @director
end

.em_threadpool_sizeObject

Returns the value of attribute em_threadpool_size.



9
10
11
# File 'lib/bosh/monitor/config.rb', line 9

def em_threadpool_size
  @em_threadpool_size
end

.event_mbusObject

Returns the value of attribute event_mbus.



10
11
12
# File 'lib/bosh/monitor/config.rb', line 10

def event_mbus
  @event_mbus
end

.event_processorObject

Returns the value of attribute event_processor.



12
13
14
# File 'lib/bosh/monitor/config.rb', line 12

def event_processor
  @event_processor
end

.http_portObject

Returns the value of attribute http_port.



14
15
16
# File 'lib/bosh/monitor/config.rb', line 14

def http_port
  @http_port
end

.intervalsObject

Returns the value of attribute intervals.



7
8
9
# File 'lib/bosh/monitor/config.rb', line 7

def intervals
  @intervals
end

.loggerObject

Returns the value of attribute logger.



5
6
7
# File 'lib/bosh/monitor/config.rb', line 5

def logger
  @logger
end

.mbusObject

Returns the value of attribute mbus.



8
9
10
# File 'lib/bosh/monitor/config.rb', line 8

def mbus
  @mbus
end

.natsObject

Returns the value of attribute nats.



17
18
19
# File 'lib/bosh/monitor/config.rb', line 17

def nats
  @nats
end

.pluginsObject

Returns the value of attribute plugins.



15
16
17
# File 'lib/bosh/monitor/config.rb', line 15

def plugins
  @plugins
end

Class Method Details

.config=(config) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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) ⇒ Object



58
59
60
61
62
# 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