ring-sqa 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ring/sqa/alarm.rb +2 -0
- data/lib/ring/sqa/alarm/collector.rb +45 -0
- data/lib/ring/sqa/alarm/email.rb +7 -5
- data/ring-sqa.gemspec +1 -1
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b658584ec46448a59b1265e61aee7e532787ee01
|
4
|
+
data.tar.gz: df10849ca2f250111c8ded791c26aaa19b854e2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b6d0440cc6af5f5b0d3516c1aaa0a03b9ec1dc13310920d476b4a3c894c3e25afda5ea4bface44d9cdc84c6c93453a8c911dedcd2f04617c2295baaf943e1d5
|
7
|
+
data.tar.gz: 4e54001be590174ef5c58aa297aec837f0e233ea81eab64c942e7ac40df593f2e06b1ad31c3f1106865cdba13ff657c54f80a4f0ef703774052cb26297102d9f
|
data/lib/ring/sqa/alarm.rb
CHANGED
@@ -3,6 +3,7 @@ require_relative 'alarm/udp2irc'
|
|
3
3
|
require_relative 'alarm/exec'
|
4
4
|
require_relative 'alarm/cfg'
|
5
5
|
require_relative 'alarm/message'
|
6
|
+
require_relative 'alarm/collector'
|
6
7
|
require_relative 'mtr'
|
7
8
|
require_relative 'paste'
|
8
9
|
|
@@ -37,6 +38,7 @@ class SQA
|
|
37
38
|
@methods << Email.new if CFG.email.to?
|
38
39
|
@methods << UDP2IRC.new if Array === CFG.irc or CFG.irc.password?
|
39
40
|
@methods << Exec.new if CFG.exec.command?
|
41
|
+
@methods << Collector.new
|
40
42
|
@hostname = Ring::SQA::CFG.host.name
|
41
43
|
@afi = Ring::SQA::CFG.afi
|
42
44
|
@alarm = false
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'timeout'
|
3
|
+
|
4
|
+
module Ring
|
5
|
+
class SQA
|
6
|
+
class Alarm
|
7
|
+
|
8
|
+
class Collector
|
9
|
+
URL = 'http://sqa-collector.infra.ring.nlnog.net/'
|
10
|
+
TIMEOUT = 10
|
11
|
+
def send opts
|
12
|
+
json = JSON.pretty_generate( {
|
13
|
+
:alarm_buffer => opts[:alarm_buffer].exceeding_nodes,
|
14
|
+
:nodes => opts[:nodes].all,
|
15
|
+
:short => opts[:short],
|
16
|
+
:long => opts[:long],
|
17
|
+
:status => opts[:status],
|
18
|
+
:afi => opts[:afi],
|
19
|
+
})
|
20
|
+
post json
|
21
|
+
rescue => error
|
22
|
+
Log.error "Post raised '#{error.class}' with message '#{error.message}'"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def post json
|
28
|
+
Thread.new do
|
29
|
+
begin
|
30
|
+
Timeout::timeout(TIMEOUT) do
|
31
|
+
uri = URI.parse URL
|
32
|
+
http = Net::HTTP.new uri.host, uri.port
|
33
|
+
http.use_ssl = true if uri.scheme == 'https'
|
34
|
+
http.post uri.path, json
|
35
|
+
end
|
36
|
+
rescue Timeout::Error
|
37
|
+
Log.error "Post timed out"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/ring/sqa/alarm/email.rb
CHANGED
@@ -9,11 +9,12 @@ class Alarm
|
|
9
9
|
|
10
10
|
def send opts
|
11
11
|
short, long = opts[:short], opts[:long]
|
12
|
-
@from
|
13
|
-
@to
|
14
|
-
prefix
|
15
|
-
@subject
|
16
|
-
@
|
12
|
+
@from = CFG.email.from
|
13
|
+
@to = [CFG.email.to].flatten
|
14
|
+
prefix = CFG.email.prefix? ? CFG.email.prefix : ''
|
15
|
+
@subject = prefix + short
|
16
|
+
@reply_to = CFG.email.reply_to? ? CFG.email.reply_to : @from
|
17
|
+
@body = long
|
17
18
|
send_email compose_email
|
18
19
|
rescue => error
|
19
20
|
Log.error "Email raised '#{error.class}' with message '#{error.message}'"
|
@@ -25,6 +26,7 @@ class Alarm
|
|
25
26
|
mail = []
|
26
27
|
mail << 'From: ' + @from
|
27
28
|
mail << 'To: ' + @to.join(', ')
|
29
|
+
mail << 'Reply-To: ' + @reply_to
|
28
30
|
mail << 'Subject: ' + @subject
|
29
31
|
mail << 'List-Id: ' + 'ring-sqa <sqa.ring.nlnog.net>'
|
30
32
|
mail << 'X-Mailer: ' + 'ring-sqa'
|
data/ring-sqa.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ring-sqa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saku Ytti
|
@@ -9,82 +9,82 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: slop
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3.5'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '3.5'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rb-inotify
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0.9'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0.9'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: sequel
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '4.12'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '4.12'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: sqlite3
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '1.3'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.3'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: asetus
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0.1'
|
77
|
-
- -
|
77
|
+
- - '>='
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: 0.1.2
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- -
|
84
|
+
- - ~>
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0.1'
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.1.2
|
90
90
|
description: gets list of nodes and pings from each to each storing results
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/ring/sqa.rb
|
104
104
|
- lib/ring/sqa/alarm.rb
|
105
105
|
- lib/ring/sqa/alarm/cfg.rb
|
106
|
+
- lib/ring/sqa/alarm/collector.rb
|
106
107
|
- lib/ring/sqa/alarm/email.rb
|
107
108
|
- lib/ring/sqa/alarm/exec.rb
|
108
109
|
- lib/ring/sqa/alarm/message.rb
|
@@ -132,17 +133,17 @@ require_paths:
|
|
132
133
|
- lib
|
133
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
135
|
requirements:
|
135
|
-
- -
|
136
|
+
- - '>='
|
136
137
|
- !ruby/object:Gem::Version
|
137
138
|
version: 1.9.3
|
138
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
140
|
requirements:
|
140
|
-
- -
|
141
|
+
- - '>='
|
141
142
|
- !ruby/object:Gem::Version
|
142
143
|
version: '0'
|
143
144
|
requirements: []
|
144
145
|
rubyforge_project: ring-sqa
|
145
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.0.14
|
146
147
|
signing_key:
|
147
148
|
specification_version: 4
|
148
149
|
summary: NLNOG Ring SQA
|