mtr_monitor 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -1
- data/exe/mtr_report +9 -7
- data/lib/mtr_monitor.rb +13 -1
- data/lib/mtr_monitor/version.rb +1 -1
- data/mtr_monitor.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a5b73e216e4f4642e16dc0b769917d06066b64d
|
4
|
+
data.tar.gz: 98e96a4cadc9e78772508f523bd697a743f39adb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e559a6faf9421c5b179475f3624bc18bbd9fab54035ff29dbd8b773085e5334ba1bf3126eab0c0cb0562b78f30eb5ce3233c5d68892a83c8ea6bbcc74532680
|
7
|
+
data.tar.gz: 525113b7d28fae27e0036f7d68ca13c6cabd702c0232453c8362ed5ea25d8d099797e866c55da05015d7dc109fd99f1949acfed4d6550bf542b315f29d317b35
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mtr_monitor (0.
|
4
|
+
mtr_monitor (0.17.0)
|
5
|
+
logdna
|
5
6
|
rt-watchman (~> 0.10.0)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
11
|
+
concurrent-ruby (1.0.5)
|
10
12
|
diff-lcs (1.2.5)
|
13
|
+
json (2.1.0)
|
14
|
+
logdna (1.1.1)
|
15
|
+
concurrent-ruby (~> 1.0)
|
16
|
+
json (~> 2.0)
|
17
|
+
require_all (~> 1.4)
|
11
18
|
rake (10.3.2)
|
19
|
+
require_all (1.5.0)
|
12
20
|
rspec (3.4.0)
|
13
21
|
rspec-core (~> 3.4.0)
|
14
22
|
rspec-expectations (~> 3.4.0)
|
data/exe/mtr_report
CHANGED
@@ -16,6 +16,7 @@ aws_secret_access_key = ENV.fetch("AWS_SECRET_ACCESS_KEY")
|
|
16
16
|
mtr_options = ENV.fetch("MTR_OPTIONS", "")
|
17
17
|
sleep_time = ENV.fetch("SLEEP_TIME", "5").to_i
|
18
18
|
dig_ip_address = ENV.fetch("DIG_IP_ADDRESS").downcase == "yes" ? true : false
|
19
|
+
logdna_ingestion_key = ENV.fetch("LOGDNA_INGESTION_KEY")
|
19
20
|
|
20
21
|
Watchman.host = ENV.fetch("WATCHMAN_HOST")
|
21
22
|
Watchman.port = ENV.fetch("WATCHMAN_PORT", 8125).to_i
|
@@ -23,13 +24,14 @@ Watchman.prefix = "mtr-monitor.prod"
|
|
23
24
|
|
24
25
|
loop do
|
25
26
|
report = MtrMonitor::Report.new(name,
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
domain,
|
28
|
+
s3_bucket,
|
29
|
+
mtr_options,
|
30
|
+
aws_access_key_id,
|
31
|
+
aws_secret_access_key,
|
32
|
+
dig_ip_address,
|
33
|
+
logdna_ingestion_key,
|
34
|
+
logger)
|
33
35
|
|
34
36
|
logger.info "Generating report"
|
35
37
|
report.generate
|
data/lib/mtr_monitor.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "watchman"
|
2
2
|
require "logger"
|
3
|
+
require "logdna"
|
3
4
|
|
4
5
|
require "mtr_monitor/version"
|
5
6
|
require "mtr_monitor/hop"
|
@@ -30,7 +31,7 @@ module MtrMonitor
|
|
30
31
|
attr_reader :logger
|
31
32
|
attr_reader :host_ip_address
|
32
33
|
|
33
|
-
def initialize(name, domain, s3_bucket, mtr_options, aws_access_key_id, aws_secret_access_key, dig_ip_address, logger = nil)
|
34
|
+
def initialize(name, domain, s3_bucket, mtr_options, aws_access_key_id, aws_secret_access_key, dig_ip_address, logdna_ingestion_key, logger = nil)
|
34
35
|
@name = name
|
35
36
|
@domain = domain
|
36
37
|
@s3_bucket = s3_bucket
|
@@ -41,6 +42,11 @@ module MtrMonitor
|
|
41
42
|
@hostname = `hostname`.strip
|
42
43
|
@dig_ip_address = dig_ip_address
|
43
44
|
@logger = logger || Logger.new(STDOUT)
|
45
|
+
@logdna = Logdna::Ruby.new(logdna_ingestion_key,
|
46
|
+
:ip => @host_ip_address,
|
47
|
+
:app => "MTR monitor",
|
48
|
+
:meta => { :route => @name },
|
49
|
+
:level => "DEBUG")
|
44
50
|
|
45
51
|
path = "#{@name}/#{Time.now.strftime("%Y-%m-%d")}/#{@host_ip_address.gsub(".", "-")}/#{Time.now.utc.strftime("%H-%M")}.log"
|
46
52
|
|
@@ -54,10 +60,16 @@ module MtrMonitor
|
|
54
60
|
|
55
61
|
generate_local_report
|
56
62
|
upload_to_s3
|
63
|
+
emit_provider_to_logdna
|
57
64
|
|
58
65
|
MtrMonitor::Metrics.submit(@log_path, @hostname, @name, @logger)
|
59
66
|
end
|
60
67
|
|
68
|
+
def emit_provider_to_logdna
|
69
|
+
@logdna.log("Network provider: Telia") if File.read(@log_path).include?("telia.net")
|
70
|
+
@logdna.log("Network provider: GTT") if File.read(@log_path).include?("gtt.net")
|
71
|
+
end
|
72
|
+
|
61
73
|
def generate_local_report
|
62
74
|
destination = @dig_ip_address ? dig : @domain
|
63
75
|
|
data/lib/mtr_monitor/version.rb
CHANGED
data/mtr_monitor.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
+
spec.add_dependency "logdna"
|
22
23
|
spec.add_dependency "rt-watchman", "~> 0.10.0"
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.16"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mtr_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RenderedText DevOps Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logdna
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rt-watchman
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|