deadman_check 0.1.5 → 0.1.6
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 +4 -4
- data/README.md +9 -6
- data/bin/deadman-check +12 -12
- data/deadman_check.gemspec +1 -1
- data/lib/deadman_check/version.rb +1 -1
- data/lib/deadman_check_global.rb +8 -0
- data/lib/deadman_check_keyset.rb +13 -7
- data/lib/deadman_check_switch.rb +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d643575c257f288cce1175773ad1fa98d5f52d4
|
4
|
+
data.tar.gz: cbae19c566d01e356d98d2e888994d97e4e831ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06a21149acca3601911646814a1e7bc6c9d4deed764b78971c66f478d1e7b54807283e0083ab2eb03ab075e7ac956c1da3ae0a4139bdd2da3023c2c65921a500
|
7
|
+
data.tar.gz: ad681fbab87b1dd342e0541aab287e5c1310f8281ec1c148e8bc7e2c697a61312f02bd890f2f9c281bbadb4d8975f6119bd42cb0c757b5090bdaf0a6d4e10deb
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# Deadman Check
|
2
2
|
|
3
|
-
[](https://travis-ci.org/sepulworld/
|
4
|
-
[](https://travis-ci.org/sepulworld/deadman-check)
|
4
|
+
[](http://badge.fury.io/rb/deadman_check)
|
5
5
|
|
6
6
|
A monitoring companion for Nomad periodic jobs that alerts if periodic jobs are
|
7
7
|
not processing as expected. The deadman-check has 2 modes, one to run with the
|
@@ -10,8 +10,8 @@ is intended to run as a separate process that will monitor the Redis key's EPOCH
|
|
10
10
|
time value and alert if that value fails to meet a time 'freshness' threshold that
|
11
11
|
is expected for that job.
|
12
12
|
|
13
|
-
*
|
14
|
-
*
|
13
|
+
* Requires a Consul instance
|
14
|
+
* Alerting requires a SLACK_API_TOKEN environment variable
|
15
15
|
|
16
16
|
## Example Usage
|
17
17
|
|
@@ -90,7 +90,7 @@ job "SilverBulletPeriodic" {
|
|
90
90
|
}
|
91
91
|
```
|
92
92
|
|
93
|
-
Now the key, deadman/SilverBulletPeriodicProcess,
|
93
|
+
Now the key, deadman/SilverBulletPeriodicProcess, at 10.0.0.1 will be updated with
|
94
94
|
the EPOCH time for each SilverBulletPeriodic job run. If the job hangs or fails to run
|
95
95
|
we will know via the EPOCH time entry going stale.
|
96
96
|
|
@@ -135,6 +135,9 @@ job "DeadmanMonitoring" {
|
|
135
135
|
|
136
136
|
Monitor a Redis key that contains an EPOCH time entry. Send a Slack message if EPOCH age hits given threshold
|
137
137
|
|
138
|
+
|
139
|
+
# Non-Nomad Use:
|
140
|
+
|
138
141
|
## Local system installation
|
139
142
|
|
140
143
|
execute:
|
data/bin/deadman-check
CHANGED
@@ -7,17 +7,17 @@ require 'daemons'
|
|
7
7
|
|
8
8
|
program :name, 'deadman-check'
|
9
9
|
program :version, DeadmanCheck::VERSION
|
10
|
-
program :description, %q{Monitor a
|
10
|
+
program :description, %q{Monitor a Consul key that contains an EPOCH time entry. Send email if EPOCH age hits given threshold}
|
11
11
|
|
12
12
|
command :switch_monitor do |c|
|
13
13
|
c.syntax = 'deadman-check switch_monitor [options]'
|
14
|
-
c.summary = 'Target a
|
14
|
+
c.summary = 'Target a Consul key to monitor'
|
15
15
|
c.description = ''
|
16
|
-
c.example %q{Target a
|
16
|
+
c.example %q{Target a Consul key deadman/myservice, and this key has an EPOCH value to check looking to alert on 500 second or greater freshness},
|
17
17
|
%q{deadman-check switch_monitor --host 127.0.0.1 --port 6379 --key deadman/myservice --freshness 500 --alert-to ops@mycomany.tld --alert-from ops-no-reply-email@mycomany.tld}
|
18
|
-
c.option '--host HOST', String, 'IP address or hostname of
|
19
|
-
c.option '--port PORT', String, 'port
|
20
|
-
c.option '--key KEY', String, '
|
18
|
+
c.option '--host HOST', String, 'IP address or hostname of Consul system'
|
19
|
+
c.option '--port PORT', String, 'port Consul is listening on'
|
20
|
+
c.option '--key KEY', String, 'Consul key to monitor'
|
21
21
|
c.option '--freshness SECONDS', String, %q{The value in seconds to alert on when the recorded
|
22
22
|
EPOCH value exceeds current EPOCH}
|
23
23
|
c.option '--alert-to SLACKROOM', String, 'Slackroom to alert to'
|
@@ -37,16 +37,16 @@ end
|
|
37
37
|
|
38
38
|
command :key_set do |c|
|
39
39
|
c.syntax = 'deadman-check key_set [options]'
|
40
|
-
c.summary = 'Update a given
|
40
|
+
c.summary = 'Update a given Consul key with current EPOCH'
|
41
41
|
c.description = ''
|
42
|
-
c.example %q{Update a
|
42
|
+
c.example %q{Update a Consul key deadman/myservice, with current EPOCH time},
|
43
43
|
%q{deadman-check key_set --host 127.0.0.1 --port 6379 --key deadman/myservice}
|
44
|
-
c.option '--host HOST', String, 'IP address or hostname of
|
45
|
-
c.option '--port PORT', String, 'port
|
46
|
-
c.option '--key KEY', String, '
|
44
|
+
c.option '--host HOST', String, 'IP address or hostname of Consul system'
|
45
|
+
c.option '--port PORT', String, 'port Consul is listening on'
|
46
|
+
c.option '--key KEY', String, 'Consul key to report EPOCH time to'
|
47
47
|
c.action do |args, options|
|
48
48
|
key_set = DeadmanCheck::KeySet.new(options.host, options.port,
|
49
49
|
options.key)
|
50
|
-
key_set.
|
50
|
+
key_set.run_consul_key_update
|
51
51
|
end
|
52
52
|
end
|
data/deadman_check.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "minitest", "~> 5.0"
|
36
36
|
|
37
37
|
spec.add_dependency 'commander', '~> 4.4', '>= 4.4.3'
|
38
|
-
spec.add_dependency '
|
38
|
+
spec.add_dependency 'diplomat', '~> 1.2', '>= 1.2.0'
|
39
39
|
spec.add_dependency 'slack-ruby-client', '~> 0.8.0'
|
40
40
|
spec.add_dependency 'daemons', '~> 1.2.4', '>=1.2.4'
|
41
41
|
end
|
data/lib/deadman_check_global.rb
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
require 'deadman_check/version'
|
2
|
+
require 'diplomat'
|
2
3
|
|
3
4
|
module DeadmanCheck
|
4
5
|
class DeadmanCheckGlobal
|
6
|
+
|
5
7
|
def get_epoch_time
|
6
8
|
epoch_time_now = Time.now.to_i
|
7
9
|
return epoch_time_now
|
8
10
|
end
|
11
|
+
|
12
|
+
def configure_diplomat(host, port)
|
13
|
+
Diplomat.configure do |config|
|
14
|
+
config.url = "http://#{host}:#{port}"
|
15
|
+
end
|
16
|
+
end
|
9
17
|
end
|
10
18
|
end
|
data/lib/deadman_check_keyset.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'deadman_check/version'
|
2
2
|
require 'deadman_check_global'
|
3
|
-
require '
|
3
|
+
require 'diplomat'
|
4
4
|
|
5
5
|
module DeadmanCheck
|
6
6
|
# KeySet Class
|
@@ -13,15 +13,21 @@ module DeadmanCheck
|
|
13
13
|
@key = key
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def _configure_diplomat(host, port)
|
17
|
+
Diplomat.configure do |config|
|
18
|
+
config.url = "http://#{host}:#{port}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def _update_consul_key(host, port, key)
|
23
|
+
DeadmanCheck::DeadmanCheckGlobal.new.configure_diplomat(host, port)
|
17
24
|
epoch_time_now = DeadmanCheck::DeadmanCheckGlobal.new.get_epoch_time
|
18
|
-
|
19
|
-
|
20
|
-
puts "Redis key #{key} updated EPOCH to #{epoch_time_now}"
|
25
|
+
Diplomat::Kv.put(key, "#{epoch_time_now}")
|
26
|
+
puts "Consul key #{key} updated EPOCH to #{epoch_time_now}"
|
21
27
|
end
|
22
28
|
|
23
|
-
def
|
24
|
-
|
29
|
+
def run_consul_key_update
|
30
|
+
_update_consul_key(@host, @port, @key)
|
25
31
|
end
|
26
32
|
end
|
27
33
|
end
|
data/lib/deadman_check_switch.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'deadman_check/version'
|
2
2
|
require 'deadman_check_global'
|
3
|
-
require '
|
3
|
+
require 'diplomat'
|
4
4
|
require 'slack-ruby-client'
|
5
5
|
|
6
6
|
module DeadmanCheck
|
@@ -27,8 +27,8 @@ module DeadmanCheck
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def _get_recorded_epoch(host, port, key)
|
30
|
-
|
31
|
-
recorded_epoch =
|
30
|
+
DeadmanCheck::DeadmanCheckGlobal.new.configure_diplomat(host, port)
|
31
|
+
recorded_epoch = Diplomat::Kv.get(key)
|
32
32
|
return recorded_epoch
|
33
33
|
end
|
34
34
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deadman_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zane
|
@@ -73,25 +73,25 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 4.4.3
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: diplomat
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '1.2'
|
82
82
|
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
84
|
+
version: 1.2.0
|
85
85
|
type: :runtime
|
86
86
|
prerelease: false
|
87
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: '
|
91
|
+
version: '1.2'
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
94
|
+
version: 1.2.0
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: slack-ruby-client
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|