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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e376e7f077f64a6a0c9e05a96addeb5c63ab9f07
4
- data.tar.gz: 549eb2cf8eddce2fe69633c938e53a32acceb20e
3
+ metadata.gz: b658584ec46448a59b1265e61aee7e532787ee01
4
+ data.tar.gz: df10849ca2f250111c8ded791c26aaa19b854e2b
5
5
  SHA512:
6
- metadata.gz: 6f4afff11e69c8f2d0e75b3c1c217ac204801e70f492a615a1d55cf8e42a95f57ac2bc3a5317cca6f27aac425d74c5a9447dec317c36d98d259c77e7ab533615
7
- data.tar.gz: af5d27f41b486a80705f4d6b2c9c46183423ec584343d44121015013e0c262f68162ed7ea9e93c5c36aa156dade91e4621c7ed7c4bf15f2d3730d3eaee391b57
6
+ metadata.gz: 5b6d0440cc6af5f5b0d3516c1aaa0a03b9ec1dc13310920d476b4a3c894c3e25afda5ea4bface44d9cdc84c6c93453a8c911dedcd2f04617c2295baaf943e1d5
7
+ data.tar.gz: 4e54001be590174ef5c58aa297aec837f0e233ea81eab64c942e7ac40df593f2e06b1ad31c3f1106865cdba13ff657c54f80a4f0ef703774052cb26297102d9f
@@ -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
@@ -9,11 +9,12 @@ class Alarm
9
9
 
10
10
  def send opts
11
11
  short, long = opts[:short], opts[:long]
12
- @from = CFG.email.from
13
- @to = [CFG.email.to].flatten
14
- prefix = CFG.email.prefix? ? CFG.email.prefix : ''
15
- @subject = prefix + short
16
- @body = long
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ring-sqa'
3
- s.version = '0.1.11'
3
+ s.version = '0.1.12'
4
4
  s.licenses = %w( Apache-2.0 )
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = [ 'Saku Ytti', 'Job Snijders' ]
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.11
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-04-22 00:00:00.000000000 Z
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.2.2
146
+ rubygems_version: 2.0.14
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: NLNOG Ring SQA