sp-nat-monitor 1.0.10 → 1.0.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac50da0d3d1fcaa7768fd4665b94a1f78a2413d0
4
- data.tar.gz: b5f0d6b02769e0c8e2cbb5892d9e1a5ecbb4f928
3
+ metadata.gz: 0df835b2bc4c2ca5ec9943c4a935b461618103c8
4
+ data.tar.gz: b60b3e25edf36ba292cdac5993ef381b6516df7d
5
5
  SHA512:
6
- metadata.gz: cbb616a1543159a38401900e7b0d06e29fd3a2b3ceac03e18fe69649f4c72e17c3cecb9363e06658dc28f6ffbc8e88b44b7fe2e191290861e7f6b43026dc8bd1
7
- data.tar.gz: 922d04bf964cc4bbfa065802254d7e56acb2542d5a1142106af939879841d7c683780e853c99120479df78b7447557d7a8e3afe2975cf30c36bccf62f73666ba
6
+ metadata.gz: 39a811205d9d7ae80cbf01078b04af053270b8c2b2f6ab1ef17caf263af50d245bf611e298ae55d5043469fed8ab7c10e8dd36b4607e2c71601cf498a89d4e63
7
+ data.tar.gz: 43993a0ce0ef97f9a6e910fa6cc532f27848b9a5eaf011bafca6f54c41256c285cae3b98c3bfcf1b6b096cfda3dcf22461623da9ee4acf952b1ab209970d72f1
@@ -1,5 +1,5 @@
1
1
  module EtTools
2
2
  class NatMonitor
3
- VERSION = '1.0.10'
3
+ VERSION = '1.0.11'
4
4
  end
5
5
  end
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.10
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-27 00:00:00.000000000 Z
11
+ date: 2015-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec