mtr_monitor 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Makefile +3 -3
- data/docker-compose.yml +1 -1
- data/lib/mtr_monitor/tier1_logger.rb +42 -0
- data/lib/mtr_monitor/version.rb +1 -1
- data/lib/mtr_monitor.rb +2 -50
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d1959c271eaaf0c608b691382a9312e0390c40
|
4
|
+
data.tar.gz: f42a91701e3bc65d6968cebf76fea2e0c648815d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbb9814cd4ce652c631444690cd30f633c0e7585449267cb3ea5abddcc6f69d26ffb81f334b56ab61c58ea117a8bf7822c39d65f6527a4dd22746482051759a8
|
7
|
+
data.tar.gz: 01bef7c769e2dfa144b2eb1682b5fef0301aecbf969006c2038bfc8cad80ed91d4a8683edb043f738fd4ee4898584a50614482a087219e9e221d1a65cb467e01
|
data/Gemfile.lock
CHANGED
data/Makefile
CHANGED
@@ -22,7 +22,7 @@ http-endpoint-push: http-endpoint-build
|
|
22
22
|
docker push renderedtext/mtr-nginx
|
23
23
|
|
24
24
|
deploy-us-east-1:
|
25
|
-
DIG_IP_ADDRESS=
|
25
|
+
DIG_IP_ADDRESS=no \
|
26
26
|
SLEEP_TIME=5 \
|
27
27
|
NAME="us-east-1-to-hetzner" \
|
28
28
|
SERVER="ec2.mtr-monitor.us-east-1.semaphoreci.com" \
|
@@ -32,7 +32,7 @@ deploy-us-east-1:
|
|
32
32
|
bundle exec rake deploy
|
33
33
|
|
34
34
|
deploy-us-west-1:
|
35
|
-
DIG_IP_ADDRESS=
|
35
|
+
DIG_IP_ADDRESS=no \
|
36
36
|
SLEEP_TIME=5 \
|
37
37
|
NAME="us-west-1-to-hetzner" \
|
38
38
|
SERVER="ec2.mtr-monitor.us-west-1.semaphoreci.com" \
|
@@ -42,7 +42,7 @@ deploy-us-west-1:
|
|
42
42
|
bundle exec rake deploy
|
43
43
|
|
44
44
|
deploy-us-west-2:
|
45
|
-
DIG_IP_ADDRESS=
|
45
|
+
DIG_IP_ADDRESS=no \
|
46
46
|
SLEEP_TIME=5 \
|
47
47
|
NAME="us-west-2-to-hetzner" \
|
48
48
|
SERVER="ec2.mtr-monitor.us-west-2.semaphoreci.com" \
|
data/docker-compose.yml
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
module MtrMonitor
|
2
|
+
class Tier1Logger
|
3
|
+
|
4
|
+
def self.submit(*args)
|
5
|
+
new(*args).submit
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(route_name, logdna_ingestion_key, host_ip_address, local_log_path, s3_url, logger)
|
9
|
+
config = {
|
10
|
+
:ip => host_ip_address,
|
11
|
+
:app => "MTR monitor",
|
12
|
+
:meta => { :route => route_name, :s3 => s3_url },
|
13
|
+
:level => "DEBUG"
|
14
|
+
}
|
15
|
+
|
16
|
+
@logdna = Logdna::Ruby.new(logdna_ingestion_key, config)
|
17
|
+
@mtr_log = File.read(local_log_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def submit
|
21
|
+
logdna.log(tier1_provider)
|
22
|
+
logger.info("Network provider: #{tier1_provider} -- Emitted to LogDNA")
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def tier1_provider
|
28
|
+
@tier1_provider ||= if @mtr_log.include?("telia.net")
|
29
|
+
"Telia"
|
30
|
+
elsif @mtr_log.include?("gtt.net")
|
31
|
+
"GTT"
|
32
|
+
elsif @mtr_log.include?("ntt.net")
|
33
|
+
"NTT"
|
34
|
+
elsif @mtr_log.include?("core-backbone.com")
|
35
|
+
"Core Backbone"
|
36
|
+
else
|
37
|
+
"Unknown network provider"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
data/lib/mtr_monitor/version.rb
CHANGED
data/lib/mtr_monitor.rb
CHANGED
@@ -5,6 +5,7 @@ require "logdna"
|
|
5
5
|
require "mtr_monitor/version"
|
6
6
|
require "mtr_monitor/hop"
|
7
7
|
require "mtr_monitor/metrics"
|
8
|
+
require "mtr_monitor/tier1_logger"
|
8
9
|
require "mtr_monitor/cleaner"
|
9
10
|
|
10
11
|
module MtrMonitor
|
@@ -43,14 +44,6 @@ module MtrMonitor
|
|
43
44
|
@dig_ip_address = dig_ip_address
|
44
45
|
@logger = logger || Logger.new(STDOUT)
|
45
46
|
@created_at = Time.now.utc
|
46
|
-
@logdna = Logdna::Ruby.new(logdna_ingestion_key,
|
47
|
-
:ip => @host_ip_address,
|
48
|
-
:app => "MTR monitor",
|
49
|
-
:meta => {
|
50
|
-
:route => @name,
|
51
|
-
:s3 => s3_url
|
52
|
-
},
|
53
|
-
:level => "DEBUG")
|
54
47
|
end
|
55
48
|
|
56
49
|
def s3_url
|
@@ -75,52 +68,11 @@ module MtrMonitor
|
|
75
68
|
|
76
69
|
generate_local_report
|
77
70
|
upload_to_s3
|
78
|
-
emit_provider_to_logdna
|
79
71
|
|
72
|
+
MtrMonitor::Tier1Logger.submit(@name, @logdna_ingestion_key, local_log_path, @host_ip_address, s3_uri, @logger)
|
80
73
|
MtrMonitor::Metrics.submit(local_log_path, @hostname, @name, @logger)
|
81
74
|
end
|
82
75
|
|
83
|
-
def emit_provider_to_logdna
|
84
|
-
mtr_log = File.read(local_log_path)
|
85
|
-
|
86
|
-
if mtr_log.include?("telia.net")
|
87
|
-
telia
|
88
|
-
elsif mtr_log.include?("gtt.net")
|
89
|
-
gtt
|
90
|
-
elsif mtr_log.include?("ntt.net")
|
91
|
-
ntt
|
92
|
-
elsif mtr_log.include?("core-backbone.com")
|
93
|
-
core_backbone
|
94
|
-
else
|
95
|
-
unknown
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def telia
|
100
|
-
@logdna.log("Telia")
|
101
|
-
@logger.info("Network provider: Telia -- Emitted to LogDNA")
|
102
|
-
end
|
103
|
-
|
104
|
-
def gtt
|
105
|
-
@logdna.log("GTT")
|
106
|
-
@logger.info("Network provider: GTT -- Emitted to LogDNA")
|
107
|
-
end
|
108
|
-
|
109
|
-
def ntt
|
110
|
-
@logdna.log("NTT")
|
111
|
-
@logger.info("Network provider: NTT -- Emitted to LogDNA")
|
112
|
-
end
|
113
|
-
|
114
|
-
def core_backbone
|
115
|
-
@logdna.log("Core Backbone")
|
116
|
-
@logger.info("Network provider: Core Backbone -- Emitted to LogDNA")
|
117
|
-
end
|
118
|
-
|
119
|
-
def unknown
|
120
|
-
@logdna.log("Unknown network provider ")
|
121
|
-
@logger.info("Network provider: Unknown -- Emitted to LogDNA")
|
122
|
-
end
|
123
|
-
|
124
76
|
def generate_local_report
|
125
77
|
run %Q(sudo mkdir -p /var/log/mtr)
|
126
78
|
run %Q(sudo sh -c 'echo "Version: #{MtrMonitor::VERSION}" >> #{local_log_path}')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mtr_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RenderedText DevOps Team
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/mtr_monitor/cleaner.rb
|
112
112
|
- lib/mtr_monitor/hop.rb
|
113
113
|
- lib/mtr_monitor/metrics.rb
|
114
|
+
- lib/mtr_monitor/tier1_logger.rb
|
114
115
|
- lib/mtr_monitor/version.rb
|
115
116
|
- mtr_monitor.gemspec
|
116
117
|
homepage: https://github.com/renderedtext/mtr-monitor
|