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/plugins/varz.rb,
lib/bosh/monitor/agent_manager.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/protocols/tsdb.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/pagerduty.rb,
lib/bosh/monitor/plugins/cloud_watch.rb

Overview

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

Defined Under Namespace

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

Constant Summary collapse

VERSION =
'1.2063.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.agent_managerObject

Returns the value of attribute agent_manager.



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

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

.event_mbusObject

Returns the value of attribute event_mbus.



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

def event_mbus
  @event_mbus
end

.event_processorObject

Returns the value of attribute event_processor.



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

def event_processor
  @event_processor
end

.http_passwordObject

Returns the value of attribute http_password.



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

def http_password
  @http_password
end

.http_portObject

Returns the value of attribute http_port.



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

def http_port
  @http_port
end

.http_userObject

Returns the value of attribute http_user.



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

def http_user
  @http_user
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.



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

def plugins
  @plugins
end

.varzObject

Returns the value of attribute varz.



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

def varz
  @varz
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
57
58
# 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"])
  @mbus = OpenStruct.new(config["mbus"])

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

  @varz = {}

  # 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"]
    @http_user = config["http"]["user"]
    @http_password = config["http"]["password"]
  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

.set_varz(key, value) ⇒ Object



60
61
62
63
# File 'lib/bosh/monitor/config.rb', line 60

def set_varz(key, value)
  @varz ||= {}
  @varz[key] = value
end

.validate_config(config) ⇒ Object



65
66
67
68
69
# File 'lib/bosh/monitor/config.rb', line 65

def validate_config(config)
  unless config.is_a?(Hash)
    raise ConfigError, "Invalid config format, Hash expected, #{config.class} given"
  end
end