riemann-smith 0.6.0 → 0.6.1
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/bin/riemann-smith +9 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73b18722a66fbd815116418e7f2d9fc0f53aefc0
|
4
|
+
data.tar.gz: dae5a014912e70e5598e482d16413076cd9b50e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba7674902ec5866d7c62717df4ec6fafdfd10ba4bcddf28647026cc820b268bc3fc042fafa425a2fac7bf58bf7a3177067ed9dfa9be85927a9ecc08cf554e9ef
|
7
|
+
data.tar.gz: 9872a6ce88a8a3e8ab1ccc57f5b6b26f0a71ee8eac05d1cea1bd1ae046ae717eb213748cdc05a62a297769beedcea781103d2aeda5cc29efdf7c794b3fb90408
|
data/bin/riemann-smith
CHANGED
@@ -18,7 +18,7 @@ class Smith::Riemann
|
|
18
18
|
include Smith::Commands::Common
|
19
19
|
include Smith::Logger
|
20
20
|
|
21
|
-
|
21
|
+
SERVICE_NAME = "Smith"
|
22
22
|
|
23
23
|
def initialize
|
24
24
|
@riemann = Riemann::Client.new(:host => options[:host], :port => options[:port])
|
@@ -26,13 +26,17 @@ class Smith::Riemann
|
|
26
26
|
|
27
27
|
def run
|
28
28
|
Smith::Messaging::Sender.new(Smith::QueueDefinitions::Agency_control.call) do |queue|
|
29
|
-
on_check
|
29
|
+
on_check do |check|
|
30
|
+
@riemann << check
|
31
|
+
end
|
30
32
|
|
31
33
|
EM.add_periodic_timer(options[:interval]) { run_check(queue) }
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
37
|
def run_check(queue)
|
38
|
+
@on_check.call(alert(:heartbeat, :running, "riemann-smith heatbeat", :ttl => options[:interval] * 2))
|
39
|
+
|
36
40
|
queue.on_timeout(options[:timeout]) do |message_id|
|
37
41
|
@on_check.call(alert(:agency, :timeout, "Agency timeout."))
|
38
42
|
end
|
@@ -87,8 +91,8 @@ class Smith::Riemann
|
|
87
91
|
end
|
88
92
|
|
89
93
|
# Construct an alert messages
|
90
|
-
def alert(service, state, description)
|
91
|
-
{:tags => options[:tags], :ttl => options[:ttl], :service => service(service), :state => state(state), :description => description}.tap { |a| logger.info { "#{a[:service]}: #{state(state)}" } }
|
94
|
+
def alert(service, state, description, extra={})
|
95
|
+
{:tags => options[:tags], :ttl => options[:ttl], :service => service(service), :state => state(state), :description => description}.merge(extra).tap { |a| logger.info { "#{a[:service]}: #{state(state)}" } }
|
92
96
|
end
|
93
97
|
|
94
98
|
# Return true if the given pid exists in the process table.
|
@@ -98,7 +102,7 @@ class Smith::Riemann
|
|
98
102
|
|
99
103
|
# Return the service name
|
100
104
|
def service(name)
|
101
|
-
"#{
|
105
|
+
"#{SERVICE_NAME} #{name}"
|
102
106
|
end
|
103
107
|
|
104
108
|
def state(state)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-smith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Heycock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smith
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '0.7'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.7.
|
22
|
+
version: 0.7.9
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '0.7'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.7.
|
32
|
+
version: 0.7.9
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: sys-proctable
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|