sp-nat-monitor 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nat-monitor/version.rb +1 -1
- data/lib/nat-monitor.rb +16 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0df835b2bc4c2ca5ec9943c4a935b461618103c8
|
4
|
+
data.tar.gz: b60b3e25edf36ba292cdac5993ef381b6516df7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39a811205d9d7ae80cbf01078b04af053270b8c2b2f6ab1ef17caf263af50d245bf611e298ae55d5043469fed8ab7c10e8dd36b4607e2c71601cf498a89d4e63
|
7
|
+
data.tar.gz: 43993a0ce0ef97f9a6e910fa6cc532f27848b9a5eaf011bafca6f54c41256c285cae3b98c3bfcf1b6b096cfda3dcf22461623da9ee4acf952b1ab209970d72f1
|
data/lib/nat-monitor/version.rb
CHANGED
data/lib/nat-monitor.rb
CHANGED
@@ -5,6 +5,7 @@ module EtTools
|
|
5
5
|
require 'fog'
|
6
6
|
require 'yaml'
|
7
7
|
require 'syslog'
|
8
|
+
require 'dogapi'
|
8
9
|
|
9
10
|
def initialize(conf_file = nil)
|
10
11
|
@conf = defaults.merge load_conf(conf_file)
|
@@ -53,12 +54,14 @@ module EtTools
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def heartbeat
|
57
|
+
un = unreachable_nodes
|
58
|
+
healthy_nodes = @conf['nodes'].keys.count - un.count
|
56
59
|
if am_i_master?
|
57
60
|
output "Looks like I'm the master"
|
61
|
+
|
62
|
+
dd_metric(healthy_nodes)
|
58
63
|
return
|
59
64
|
end
|
60
|
-
un = unreachable_nodes
|
61
|
-
#return if un.empty?
|
62
65
|
if un.count == other_nodes.keys.count # return if I'm unreachable...
|
63
66
|
output "No nodes are reachable. Seems I'm the unreachable one."
|
64
67
|
return
|
@@ -67,6 +70,7 @@ module EtTools
|
|
67
70
|
unless un.include?(cm) # ...unless master is unreachable
|
68
71
|
output "Unreachable nodes: #{un.inspect}"
|
69
72
|
output "Current master (#{cm}) is still reachable"
|
73
|
+
dd_metric(healthy_nodes)
|
70
74
|
return
|
71
75
|
end
|
72
76
|
steal_route
|
@@ -156,5 +160,15 @@ module EtTools
|
|
156
160
|
s.send(level, message)
|
157
161
|
end
|
158
162
|
end
|
163
|
+
|
164
|
+
def dd_metric(metric)
|
165
|
+
dog = Dogapi::Client.new(@conf['dd_key'])
|
166
|
+
dog.emit_point(
|
167
|
+
"ec2.nat.heartbeat",
|
168
|
+
metric,
|
169
|
+
:host => @conf['host'],
|
170
|
+
:tags => @conf['tags']
|
171
|
+
)
|
172
|
+
end
|
159
173
|
end
|
160
174
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sp-nat-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Herot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|