nat-monitor 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/nat-monitor.rb +16 -20
- data/lib/nat-monitor/version.rb +1 -1
- data/spec/lib/nat-monitor_spec.rb +1 -1
- 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: 3974f14b7e72be030eeb18f106c75cb253108ca9
|
4
|
+
data.tar.gz: 78bce4f038843212f57028f8dc7f2650191ac030
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18a2e90c2f7a0dfcfae9ce8a807feacd31531bb908e52a18224d8c851118654d7910ba6938e9d81974483d0daae8bce7747bad63a4789ad918f4a19e79978e9
|
7
|
+
data.tar.gz: beccbe7e6d3ae70c45e2d79dfb47ebab6774ad0fa03e8370f249facdd2fcd7d86e9ed78be38a3abb4b6b6678734f2835fbba061ff1ab0e3eb3e27a8dc854c2f4
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/nat-monitor.svg)](http://badge.fury.io/rb/nat-monitor)
|
2
|
+
|
1
3
|
# nat-monitor
|
2
4
|
|
3
5
|
Monitors a quorum of NAT servers for an outage and reassigns the specified EC2 route table to point to a working server.
|
@@ -69,7 +71,7 @@ The NAT Monitor has the ability to report out, via a simple URL request, its sta
|
|
69
71
|
Requisite configuration needed:
|
70
72
|
|
71
73
|
```yaml
|
72
|
-
|
74
|
+
monitor_urls:
|
73
75
|
begin: your.url/run
|
74
76
|
success: your.url/complete
|
75
77
|
fail: your.url/fail
|
data/lib/nat-monitor.rb
CHANGED
@@ -21,24 +21,22 @@ module EtTools
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def validate!
|
24
|
-
exit_code =
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
24
|
+
exit_code =
|
25
|
+
case
|
26
|
+
when !@conf['route_table_id']
|
27
|
+
msg = 'route_table_id not specified'
|
28
|
+
1
|
29
|
+
when !route_exists?(@conf['route_table_id'])
|
30
|
+
msg = "Route #{@conf['route_table_id']} not found"
|
31
|
+
2
|
32
|
+
when @conf['nodes'].count < 3
|
33
|
+
msg = '3 or more nodes are required to create a quorum'
|
34
|
+
3
|
35
|
+
end
|
37
36
|
|
38
37
|
return unless exit_code
|
39
38
|
|
40
39
|
notify_monitor 'fail', msg
|
41
|
-
output msg
|
42
40
|
exit exit_code
|
43
41
|
end
|
44
42
|
|
@@ -58,7 +56,6 @@ module EtTools
|
|
58
56
|
rescue => e
|
59
57
|
msg = "Caught #{e.class} exception: #{e.message}"
|
60
58
|
notify_monitor 'fail', msg
|
61
|
-
output msg
|
62
59
|
output e.backtrace
|
63
60
|
end
|
64
61
|
sleep @conf['heartbeat_interval']
|
@@ -160,10 +157,13 @@ module EtTools
|
|
160
157
|
end
|
161
158
|
|
162
159
|
def notify_monitor(status, msg = nil)
|
160
|
+
output msg
|
163
161
|
return unless @conf['monitor_enabled']
|
164
|
-
url =
|
162
|
+
url = @conf['monitor_urls'][status]
|
165
163
|
url += "?msg=#{msg}" if status == 'fail' && !msg.nil?
|
166
164
|
|
165
|
+
output 'Notifying external heartbeat monitor'
|
166
|
+
|
167
167
|
Net::HTTP.get(URI url)
|
168
168
|
end
|
169
169
|
|
@@ -179,9 +179,5 @@ module EtTools
|
|
179
179
|
s.send(level, message)
|
180
180
|
end
|
181
181
|
end
|
182
|
-
|
183
|
-
def monitor_url(status)
|
184
|
-
@conf['monitor'][status]
|
185
|
-
end
|
186
182
|
end
|
187
183
|
end
|
data/lib/nat-monitor/version.rb
CHANGED
@@ -13,7 +13,7 @@ describe EtTools::NatMonitor do
|
|
13
13
|
@yaml_conf = { 'route_table_id' => @route_table_id,
|
14
14
|
'aws_access_key_id' => 'AWS_ACCESS_KEY_ID',
|
15
15
|
'aws_secret_access_key' => 'AWS_SECRET_ACCESS_KEY',
|
16
|
-
'
|
16
|
+
'monitor_urls' => {
|
17
17
|
'begin' => 'run',
|
18
18
|
'success' => 'complete',
|
19
19
|
'fail' => 'fail'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nat-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
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-09-
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|