riemann-smith 0.2.1 → 0.3.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 +15 -16
- metadata +3 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 599a249192095c3c61053316cb92d3768a1d49df
|
4
|
+
data.tar.gz: 6daf55d263d32f3f222a6d397e9ab7155ed45e0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e7049aa2f7d3c41240ff7c482aaff2515ee4611d6666a813f0f9ab2ef56c2bd26af15eb4d5bbacf006fb220b3f68da723c6452b7dc34adf3915a966664d978a
|
7
|
+
data.tar.gz: 53bbeea669d614a7eede325e48fe923272f58c74ffb9c4427517b1c24847616d7b2324488bea931dafb035a0dc4b2e489cfbe682fa5e97a42bcdc71cbe8dd479
|
data/bin/riemann-smith
CHANGED
@@ -22,8 +22,6 @@ class Smith::Riemann
|
|
22
22
|
options[:agents].uniq!
|
23
23
|
end
|
24
24
|
|
25
|
-
@reply_queue = "riemann.#{Digest::SHA1.hexdigest(Time.now.to_s + $$.to_s)}"
|
26
|
-
|
27
25
|
Smith.compile_acls
|
28
26
|
end
|
29
27
|
|
@@ -41,11 +39,15 @@ class Smith::Riemann
|
|
41
39
|
return
|
42
40
|
end
|
43
41
|
|
44
|
-
|
42
|
+
# TODO remove this when smith randomises the reply queue name (probably > 0.7.2).
|
43
|
+
reply_queue = "riemann.#{Digest::SHA1.hexdigest(Time.now.to_s + $$.to_s)}"
|
44
|
+
|
45
|
+
queue.on_reply(:auto_ack => true, :reply_queue_name => reply_queue) do |reply_payload, r|
|
45
46
|
results = parse_response(reply_payload.response)
|
46
47
|
|
47
48
|
options[:agents].each do |agent|
|
48
|
-
if results.has_key?(agent)
|
49
|
+
if results.has_key?(agent) && results[agent].any? { |a| a[:state] == "running" && Sys::ProcTable.ps(a[:pid].to_i) }
|
50
|
+
$stderr.puts "#{agent}: ok"
|
49
51
|
report(
|
50
52
|
:host => options[:event_host],
|
51
53
|
:service => "#{options[:service_name]}.#{agent}",
|
@@ -53,6 +55,7 @@ class Smith::Riemann
|
|
53
55
|
:description => "Agent is running"
|
54
56
|
)
|
55
57
|
else
|
58
|
+
$stderr.puts "#{agent}: critical"
|
56
59
|
report(
|
57
60
|
:host => options[:event_host],
|
58
61
|
:service => "#{options[:service_name]}.#{agent}",
|
@@ -87,18 +90,14 @@ class Smith::Riemann
|
|
87
90
|
|
88
91
|
# Returns a Nested hash representing the running agents.
|
89
92
|
def parse_response(response)
|
90
|
-
split_response = response.split(/\n/)
|
91
|
-
((/^total/.match(split_response.first)) ? split_response[1..-1] : []).
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
res[:date] = fields[3]
|
99
|
-
res[:description] = fields.last
|
100
|
-
end
|
101
|
-
end
|
93
|
+
split_response = response.split(/\n/).map(&:strip)
|
94
|
+
((/^total/.match(split_response.first)) ? split_response[1..-1] : []).each_with_object(Hash.new { |h,k| h[k] = []}) do |entry, h|
|
95
|
+
fields = entry.split(/\s +/)
|
96
|
+
h[fields.last] << {
|
97
|
+
:state => fields[0],
|
98
|
+
:uuid => fields[1],
|
99
|
+
:pid => fields[2]
|
100
|
+
}
|
102
101
|
end
|
103
102
|
end
|
104
103
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-smith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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:
|
11
|
+
date: 2015-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: git-version-bump
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.10'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.10'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: riemann-tools
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,20 +94,6 @@ dependencies:
|
|
108
94
|
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: github-release
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
97
|
description:
|
126
98
|
email: rgh@digivizer.com
|
127
99
|
executables:
|
@@ -154,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
126
|
version: '0'
|
155
127
|
requirements: []
|
156
128
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.4.5
|
158
130
|
signing_key:
|
159
131
|
specification_version: 4
|
160
132
|
summary: Monitor smith agents, reporting to Riemann
|