nat-monitor 3.0.6 → 4.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 +28 -6
- data/Rakefile +1 -0
- data/lib/nat-monitor.rb +15 -4
- data/lib/nat-monitor/version.rb +1 -1
- data/nat-monitor.gemspec +2 -0
- data/spec/lib/nat-monitor_spec.rb +1 -5
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f3019dd6a06c41744e25d25878d8fc1743c027b
|
4
|
+
data.tar.gz: 4a2a3844adb2dbb5cb2d4dcbee79540df5e4fa50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec75a2d9eb9e77f8ff85fec7a6496a9a8c48d3dfd843757e289d6b4d9840d4ee0801502b154649226136911c95c50b1a24958b23b4d162430959b36581839407
|
7
|
+
data.tar.gz: 9aee1e3836a53a2791567fe04e5b921c4afbe187e3290a9888c497e13c30e0958c39f2399ac2306f002eb99c5ce88d08b5e8baa24f1c3cc1dfcd41747bee7f33
|
data/README.md
CHANGED
@@ -66,15 +66,37 @@ Note that:
|
|
66
66
|
|
67
67
|
- If you don't specify the AWS credentials it will use the IAM role of the instance
|
68
68
|
|
69
|
-
The NAT Monitor has the ability to report out
|
69
|
+
The NAT Monitor has the ability to report out to [Cronitor.io](http://cronitor.io) its status. This comes courtesy of the [`cronitor`](https://github.com/evertrue/cronitor) gem.
|
70
70
|
|
71
|
-
|
71
|
+
You will need to set `monitor_enabled: true` and then supply either a Cronitor API token & monitor options:
|
72
72
|
|
73
73
|
```yaml
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
monitor_enabled: true
|
75
|
+
monitor_token: abcd
|
76
|
+
monitor_opts:
|
77
|
+
name: My Fancy Monitor
|
78
|
+
notifications:
|
79
|
+
emails:
|
80
|
+
- test@example.com
|
81
|
+
slack:
|
82
|
+
- https://url-to-slack.webhook
|
83
|
+
pagerduty:
|
84
|
+
- pagerduty-service-api-token
|
85
|
+
phones:
|
86
|
+
- +12345678900
|
87
|
+
webhooks:
|
88
|
+
- 'http://example.com'
|
89
|
+
rules:
|
90
|
+
- rule_type: 'not_run_in',
|
91
|
+
duration: 5,
|
92
|
+
time_unit: 'seconds'
|
93
|
+
```
|
94
|
+
|
95
|
+
or the code for an existing Cronitor monitor:
|
96
|
+
|
97
|
+
```yaml
|
98
|
+
monitor_enabled: true
|
99
|
+
monitor_code: abcd
|
78
100
|
```
|
79
101
|
|
80
102
|
## Contributing
|
data/Rakefile
CHANGED
data/lib/nat-monitor.rb
CHANGED
@@ -156,15 +156,26 @@ module EtTools
|
|
156
156
|
current_master == node_id
|
157
157
|
end
|
158
158
|
|
159
|
+
def monitor
|
160
|
+
return unless @conf['monitor_enabled']
|
161
|
+
|
162
|
+
if @conf['monitor_token']
|
163
|
+
@monitor ||= Cronitor.new(
|
164
|
+
token: @conf['monitor_token'],
|
165
|
+
opts: @conf['monitor_opts']
|
166
|
+
)
|
167
|
+
else
|
168
|
+
@monitor ||= Cronitor.new code: @conf['monitor_code']
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
159
172
|
def notify_monitor(status, msg = nil)
|
160
173
|
output msg unless msg.nil?
|
161
174
|
return unless @conf['monitor_enabled']
|
162
|
-
url = @conf['monitor_urls'][status]
|
163
|
-
url += "?msg=#{URI.escape(msg)}" if status == 'fail' && !msg.nil?
|
164
175
|
|
165
|
-
output 'Notifying
|
176
|
+
output 'Notifying Cronitor'
|
166
177
|
|
167
|
-
|
178
|
+
monitor.ping status, msg
|
168
179
|
end
|
169
180
|
|
170
181
|
private
|
data/lib/nat-monitor/version.rb
CHANGED
data/nat-monitor.gemspec
CHANGED
@@ -23,7 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'byebug'
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'bump', '~> 0.1'
|
26
27
|
|
27
28
|
spec.add_runtime_dependency 'net-ping'
|
28
29
|
spec.add_runtime_dependency 'fog', '~> 1.23', '>= 1.30'
|
30
|
+
spec.add_runtime_dependency 'cronitor', '~> 1.1'
|
29
31
|
end
|
@@ -13,11 +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
|
-
'
|
17
|
-
'run' => 'run',
|
18
|
-
'complete' => 'complete',
|
19
|
-
'fail' => 'fail'
|
20
|
-
},
|
16
|
+
'monitor_code' => 'abcd',
|
21
17
|
'nodes' => (
|
22
18
|
{ @my_instance_id => '1.1.1.1' }
|
23
19
|
).merge(@other_nodes) }
|
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: 4.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-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bump
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.1'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: net-ping
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +128,20 @@ dependencies:
|
|
114
128
|
- - ">="
|
115
129
|
- !ruby/object:Gem::Version
|
116
130
|
version: '1.30'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: cronitor
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '1.1'
|
138
|
+
type: :runtime
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '1.1'
|
117
145
|
description: A service for providing an HA NAT in EC2
|
118
146
|
email:
|
119
147
|
- eric.github@herot.com
|