Class: Bosh::Monitor::Plugins::DataDog
- Inherits:
-
Base
- Object
- Base
- Bosh::Monitor::Plugins::DataDog
show all
- Defined in:
- lib/bosh/monitor/plugins/datadog.rb
Constant Summary
collapse
- NORMAL_PRIORITY =
[:alert, :critical, :error]
Instance Attribute Summary
Attributes inherited from Base
#event_kinds, #logger, #options
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#dog_client ⇒ Object
21
22
23
24
25
|
# File 'lib/bosh/monitor/plugins/datadog.rb', line 21
def dog_client
return @dog_client if @dog_client
client = Dogapi::Client.new(@api_key, @application_key)
@dog_client = @pagerduty_service_name ? PagingDatadogClient.new(@pagerduty_service_name, client) : client
end
|
#process(event) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/bosh/monitor/plugins/datadog.rb', line 27
def process(event)
case event
when Bosh::Monitor::Events::Heartbeat
EM.defer { process_heartbeat(event) }
when Bosh::Monitor::Events::Alert
EM.defer { process_alert(event) }
else
end
end
|
#run ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/bosh/monitor/plugins/datadog.rb', line 13
def run
@api_key = options["api_key"]
@application_key = options["application_key"]
@pagerduty_service_name = options["pagerduty_service_name"]
logger.info("DataDog plugin is running...")
end
|
#validate_options ⇒ Object
9
10
11
|
# File 'lib/bosh/monitor/plugins/datadog.rb', line 9
def validate_options
!!(options.kind_of?(Hash) && options["api_key"] && options["application_key"])
end
|