bosh-monitor 1.2781.0 → 1.2785.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/bosh/monitor/api_controller.rb +18 -3
- data/lib/bosh/monitor/plugins/datadog.rb +22 -10
- data/lib/bosh/monitor/version.rb +1 -1
- metadata +4 -4
@@ -1,6 +1,16 @@
|
|
1
1
|
module Bosh::Monitor
|
2
|
-
|
3
2
|
class ApiController < Sinatra::Base
|
3
|
+
PULSE_TIMEOUT = 180
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@heartbeat = Time.now
|
7
|
+
|
8
|
+
EM.add_periodic_timer(1) do
|
9
|
+
EM.defer { @heartbeat = Time.now }
|
10
|
+
end
|
11
|
+
|
12
|
+
super
|
13
|
+
end
|
4
14
|
|
5
15
|
configure do
|
6
16
|
set(:show_exceptions, false)
|
@@ -28,8 +38,13 @@ module Bosh::Monitor
|
|
28
38
|
end
|
29
39
|
|
30
40
|
get "/healthz" do
|
31
|
-
|
41
|
+
body "Last pulse was #{Time.now - @heartbeat} seconds ago"
|
42
|
+
|
43
|
+
if Time.now - @heartbeat > PULSE_TIMEOUT
|
44
|
+
status(500)
|
45
|
+
else
|
46
|
+
status(200)
|
47
|
+
end
|
32
48
|
end
|
33
49
|
end
|
34
|
-
|
35
50
|
end
|
@@ -46,8 +46,14 @@ module Bosh::Monitor
|
|
46
46
|
]
|
47
47
|
|
48
48
|
heartbeat.metrics.each do |metric|
|
49
|
-
|
50
|
-
|
49
|
+
begin
|
50
|
+
point = [Time.at(metric.timestamp), metric.value]
|
51
|
+
dog_client.emit_points("bosh.healthmonitor.#{metric.name}", [point], tags: tags)
|
52
|
+
rescue Timeout::Error => e
|
53
|
+
logger.warn('Could not emit points to Datadog, request timed out.')
|
54
|
+
rescue => e
|
55
|
+
logger.info("Could not emit points to Datadog: #{e.inspect}")
|
56
|
+
end
|
51
57
|
end
|
52
58
|
end
|
53
59
|
|
@@ -59,15 +65,21 @@ module Bosh::Monitor
|
|
59
65
|
|
60
66
|
|
61
67
|
# DataDog only supports "low" and "normal" priority
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
68
|
+
begin
|
69
|
+
priority = normal_priority?(alert.severity) ? "normal" : "low"
|
70
|
+
dog_client.emit_event(
|
71
|
+
Dogapi::Event.new(msg,
|
72
|
+
msg_title: title,
|
73
|
+
date_happened: timestamp,
|
74
|
+
tags: ["source:#{source}"],
|
75
|
+
priority: priority
|
76
|
+
)
|
69
77
|
)
|
70
|
-
|
78
|
+
rescue Timeout::Error => e
|
79
|
+
logger.warn('Could not emit event to Datadog, request timed out.')
|
80
|
+
rescue => e
|
81
|
+
logger.warn("Could not emit event to Datadog: #{e.inspect}")
|
82
|
+
end
|
71
83
|
end
|
72
84
|
|
73
85
|
def normal_priority?(severity)
|
data/lib/bosh/monitor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2785.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
12
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
@@ -157,7 +157,7 @@ dependencies:
|
|
157
157
|
version: 1.6.0
|
158
158
|
description: ! 'BOSH Health Monitor
|
159
159
|
|
160
|
-
|
160
|
+
30caeb'
|
161
161
|
email: support@cloudfoundry.com
|
162
162
|
executables:
|
163
163
|
- bosh-monitor-console
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
segments:
|
225
225
|
- 0
|
226
|
-
hash:
|
226
|
+
hash: -3205421599059187072
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
229
|
rubygems_version: 1.8.23
|