ring-sqa 0.0.16 → 0.0.18

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: 9b60d7ea751aee3be9cc2e8652f2390f5810fea4
4
- data.tar.gz: f7188e826e663e93334f04e2f50fd54a72b1f952
3
+ metadata.gz: daa3666fef098532d9a3d8758e1f106ce9d0e63e
4
+ data.tar.gz: 60959c28ce98980b6045b9708a2e9e348c4504f8
5
5
  SHA512:
6
- metadata.gz: 26215e5192073568b95ac81ea5561f5a3036d4070c671d22ae7956c898ae4601c6f52e8e4803164d055b1848fca58f08b096eef6e1cae8c251e1824e26bc208d
7
- data.tar.gz: 58bbe6c022f8c82a8723ce98220607f217108cc277706f08631432714361bde0c9599d0324bab93ff398a470e7e69b684429c6f6b61b294052a6a006b87d1d65
6
+ metadata.gz: 8d81bd070959777b765c7654e8912f624cc2293f9ebde5edee4305a6b03545e49d59e3366dd7d2153dcefac13886415bd29fd5a0e9486fca04c1436e3816bb2d
7
+ data.tar.gz: 9d9b16dbfe7f85ed3420e0f9af3a095590fc1191bd178ccb6d785e35ee6ef03fdcd46c969689e99c32599f02b56198e9319566d14ec1d78e369d5c5df7217b59
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ begin
3
3
  require 'bundler'
4
4
  # Bundler.setup
5
5
  rescue LoadError
6
- warn 'bunler missing'
6
+ warn 'bundler missing'
7
7
  end
8
8
 
9
9
  gemspec = eval(File.read(Dir['*.gemspec'].first))
@@ -4,7 +4,8 @@ class Alarm
4
4
 
5
5
  class UDP2IRC
6
6
  def send message, channel=CFG.irc.channel
7
- msg = [@password, channel, message[:short]].join ' '
7
+ url = Paste.add message[:long]
8
+ msg = [@password, channel, message[:short], url].join ' '
8
9
  msg += "\0" while msg.size % 16 > 0
9
10
  UDPSocket.new.send msg, 0, @host, @port.to_i
10
11
  end
@@ -2,6 +2,7 @@ require_relative 'alarm/email'
2
2
  require_relative 'alarm/udp2irc'
3
3
  require_relative 'alarm/cfg'
4
4
  require_relative 'mtr'
5
+ require_relative 'paste'
5
6
  require_relative 'nodes_json'
6
7
 
7
8
  module Ring
@@ -44,7 +45,7 @@ class SQA
44
45
  nodes = NodesJSON.new
45
46
 
46
47
  nodes_list = ''
47
- exceeding_nodes.each do |node|
48
+ exceeding_nodes.sort!.each do |node|
48
49
  json = nodes.get node
49
50
  nodes_list << "- %-30s %14s AS%5s %2s\n" % [json['hostname'], node, json['asn'], json['countrycode']]
50
51
  end
@@ -60,24 +61,37 @@ class SQA
60
61
  buffer_list = ''
61
62
  time = alarm_buffer.array.size-1
62
63
  alarm_buffer.array.each do |ary|
63
- buffer_list << "%2s min ago %3s measurements failed\n" % [time, ary.size/2]
64
+ buffer_list << "%2s min ago %3s measurements failed" % [time, ary.size/2]
65
+ type = time.to_i < 3 ? " (raised alarm)\n" : " (baseline)\n"
66
+ buffer_list << type
64
67
  time -= 1
65
68
  end
66
69
 
67
70
  msg[:long] = <<EOF
68
- This is an automated alert from the distributed partial outage monitoring system "RING SQA".
71
+ This is an automated alert from the distributed partial outage
72
+ monitoring system "RING SQA".
69
73
 
70
- At #{Time.now.utc} the following measurements were analysed as indicating that there is a high probability your NLNOG RING node cannot reach the entire internet. Possible causes could be an outage in your upstream's or peer's network.
74
+ At #{Time.now.utc} the following measurements were analysed
75
+ as indicating that there is a high probability your NLNOG RING node
76
+ cannot reach the entire internet. Possible causes could be an outage
77
+ in your upstream's or peer's network.
71
78
 
72
- The following nodes previously were reachable, but became unreachable over the course of the last 3 minutes:
79
+ The following nodes previously were reachable, but became unreachable
80
+ over the course of the last 3 minutes:
73
81
 
74
82
  #{nodes_list}
75
83
 
76
- As a debug starting point 3 traceroutes were launched right after detecting the event, they might assist in pinpointing what broke:
84
+ As a debug starting point 3 traceroutes were launched right after
85
+ detecting the event, they might assist in pinpointing what broke:
77
86
 
78
87
  #{mtr_list}
79
88
 
80
- An alarm is raised under the following conditions: every 30 seconds your node pings all other nodes. The amount of nodes that cannot be reached is stored in a circular buffer, with each element representing a minute of measurements. In the event that the last three minutes are #{Ring::SQA::CFG.analyzer.tolerance} above the median of the previous 27 measurement slots, a partial outage is assumed. The ring buffer's output is as following:
89
+ An alarm is raised under the following conditions: every 30 seconds
90
+ your node pings all other nodes. The amount of nodes that cannot be
91
+ reached is stored in a circular buffer, with each element representing
92
+ a minute of measurements. In the event that the last three minutes are
93
+ #{Ring::SQA::CFG.analyzer.tolerance} above the median of the previous 27 measurement slots, a partial
94
+ outage is assumed. The ring buffer's output is as following:
81
95
 
82
96
  #{buffer_list}
83
97
 
data/lib/ring/sqa/cfg.rb CHANGED
@@ -17,6 +17,7 @@ module Ring
17
17
  Config.default.mtr.args = '-i0.5 -c5 -r -w -n'
18
18
  Config.default.mtr.timeout = 15
19
19
  Config.default.ram_database = false
20
+ Config.default.paste.url = 'https://ring.nlnog.net/paste/'
20
21
 
21
22
  begin
22
23
  Config.load
data/lib/ring/sqa/mtr.rb CHANGED
@@ -31,7 +31,7 @@ class SQA
31
31
  Open3.popen3(BIN, *args) do |stdin, stdout, stderr, wait_thr|
32
32
  out << stdout.read until stdout.eof?
33
33
  end
34
- out.each_line.to_a[1..-1].join rescue ''
34
+ 'mtr ' + args.join(' ') + "\n" + out.each_line.to_a[1..-1].join rescue ''
35
35
  end
36
36
  end
37
37
 
@@ -0,0 +1,30 @@
1
+ require 'net/http'
2
+
3
+ module Ring
4
+ class SQA
5
+
6
+ class Paste
7
+ def self.add string
8
+ Paste.new.add string
9
+ rescue
10
+ 'paste failed'
11
+ end
12
+
13
+ def add string, url=CFG.paste.url
14
+ paste string, url
15
+ end
16
+
17
+ private
18
+
19
+ def paste string, url
20
+ uri = URI.parse url
21
+ http = Net::HTTP.new(uri.host, uri.port)
22
+ http.use_ssl = true if uri.scheme == 'https'
23
+ rslt = http.post uri.path, URI.encode_www_form([['content',string], ['ttl','604800']])
24
+ uri.path = rslt.fetch('location')
25
+ uri.to_s
26
+ end
27
+ end
28
+
29
+ end
30
+ end
data/ring-sqa.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ring-sqa'
3
- s.version = '0.0.16'
3
+ s.version = '0.0.18'
4
4
  s.licenses = %w( Apache-2.0 )
5
5
  s.platform = Gem::Platform::RUBY
6
- s.authors = [ 'Saku Ytti' ]
6
+ s.authors = [ 'Saku Ytti', 'Job Snijders' ]
7
7
  s.email = %w( saku@ytti.fi )
8
8
  s.homepage = 'http://github.com/ytti/ring-sqa'
9
9
  s.summary = 'NLNOG Ring SQA'
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ring-sqa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
8
+ - Job Snijders
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
@@ -14,76 +15,76 @@ dependencies:
14
15
  name: slop
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - "~>"
18
+ - - ~>
18
19
  - !ruby/object:Gem::Version
19
20
  version: '3.5'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - "~>"
25
+ - - ~>
25
26
  - !ruby/object:Gem::Version
26
27
  version: '3.5'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rb-inotify
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - "~>"
32
+ - - ~>
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0.9'
34
35
  type: :runtime
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - "~>"
39
+ - - ~>
39
40
  - !ruby/object:Gem::Version
40
41
  version: '0.9'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: sequel
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - "~>"
46
+ - - ~>
46
47
  - !ruby/object:Gem::Version
47
48
  version: '4.12'
48
49
  type: :runtime
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
- - - "~>"
53
+ - - ~>
53
54
  - !ruby/object:Gem::Version
54
55
  version: '4.12'
55
56
  - !ruby/object:Gem::Dependency
56
57
  name: sqlite3
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - "~>"
60
+ - - ~>
60
61
  - !ruby/object:Gem::Version
61
62
  version: '1.3'
62
63
  type: :runtime
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - "~>"
67
+ - - ~>
67
68
  - !ruby/object:Gem::Version
68
69
  version: '1.3'
69
70
  - !ruby/object:Gem::Dependency
70
71
  name: asetus
71
72
  requirement: !ruby/object:Gem::Requirement
72
73
  requirements:
73
- - - "~>"
74
+ - - ~>
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0.1'
76
- - - ">="
77
+ - - '>='
77
78
  - !ruby/object:Gem::Version
78
79
  version: 0.1.2
79
80
  type: :runtime
80
81
  prerelease: false
81
82
  version_requirements: !ruby/object:Gem::Requirement
82
83
  requirements:
83
- - - "~>"
84
+ - - ~>
84
85
  - !ruby/object:Gem::Version
85
86
  version: '0.1'
86
- - - ">="
87
+ - - '>='
87
88
  - !ruby/object:Gem::Version
88
89
  version: 0.1.2
89
90
  description: gets list of nodes and pings from each to each storing results
@@ -113,6 +114,7 @@ files:
113
114
  - lib/ring/sqa/mtr.rb
114
115
  - lib/ring/sqa/nodes.rb
115
116
  - lib/ring/sqa/nodes_json.rb
117
+ - lib/ring/sqa/paste.rb
116
118
  - lib/ring/sqa/poller.rb
117
119
  - lib/ring/sqa/poller/receiver.rb
118
120
  - lib/ring/sqa/poller/responder.rb
@@ -128,17 +130,17 @@ require_paths:
128
130
  - lib
129
131
  required_ruby_version: !ruby/object:Gem::Requirement
130
132
  requirements:
131
- - - ">="
133
+ - - '>='
132
134
  - !ruby/object:Gem::Version
133
135
  version: 1.9.3
134
136
  required_rubygems_version: !ruby/object:Gem::Requirement
135
137
  requirements:
136
- - - ">="
138
+ - - '>='
137
139
  - !ruby/object:Gem::Version
138
140
  version: '0'
139
141
  requirements: []
140
142
  rubyforge_project: ring-sqa
141
- rubygems_version: 2.2.2
143
+ rubygems_version: 2.0.14
142
144
  signing_key:
143
145
  specification_version: 4
144
146
  summary: NLNOG Ring SQA