mtr_monitor 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff6b4c4b726106fd0654fbc8ef65b25a9ba9a93e
4
- data.tar.gz: 1bd6f6c3f5719f6f47b954330e4ee09ead71890b
3
+ metadata.gz: 102a79b550de80dc926bc8b6b31da0819b9de0ae
4
+ data.tar.gz: 914f873fb0b95d3304438d2261668a5818e3453d
5
5
  SHA512:
6
- metadata.gz: d86b880cf3dc19fa7a9b50f1c2cceddb7cc876c61337d2ff4e435bcf73fe8ec8ba37398bffa9e720658f0a9698007c6cb23492c51323d20e4099e4f3b5f7ff81
7
- data.tar.gz: 5b97dad3d6c818c79027c901b7f67ef0a11a44dc72cf1ad03b4f222482640a1e7f839ab7148b322759a423bf777716b9fc3f24931fae6971857f5614e5fa5602
6
+ metadata.gz: b4756d01e114839c3c5692e3a00975232d6bd957dadc9c3daea3e09d3518b1021166de4933adcdba77c4320798d27256bc091bbd1a0fbc36eb190116bd28ff06
7
+ data.tar.gz: ce53b6446295565b49a3210419baa7975b1a680adcaaa41825ee91cdd2f2a6dd3a46d863ffc0b26d6aff5ddc666d687be878071d32b4b4b3ed1d56cce581683c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mtr_monitor (1.3.0)
4
+ mtr_monitor (1.4.0)
5
5
  logdna
6
6
  rt-watchman (~> 0.10.0)
7
7
 
data/Makefile CHANGED
@@ -28,7 +28,7 @@ deploy-us-east-1:
28
28
  SERVER="ec2.mtr-monitor.us-east-1.semaphoreci.com" \
29
29
  HOSTNAME="mtr-monitor.us-east-1.semaphoreci.com" \
30
30
  MTR_OPTIONS="-w -c 50 -f 12" \
31
- MTR_TARGETS="136.243.108.222,138.201.31.31,138.201.32.17" \
31
+ MTR_TARGETS="136.243.131.198,138.201.31.31,144.76.223.42,148.251.87.12,176.9.62.126,78.46.21.203,88.99.58.112,94.130.34.185" \
32
32
  bundle exec rake deploy
33
33
 
34
34
  deploy-us-west-1:
@@ -38,7 +38,7 @@ deploy-us-west-1:
38
38
  SERVER="ec2.mtr-monitor.us-west-1.semaphoreci.com" \
39
39
  HOSTNAME="mtr-monitor.us-west-1.semaphoreci.com" \
40
40
  MTR_OPTIONS="-w -c 50 -f 12" \
41
- MTR_TARGETS="136.243.108.222,138.201.31.31,138.201.32.17" \
41
+ MTR_TARGETS="136.243.131.198,138.201.31.31,144.76.223.42,148.251.87.12,176.9.62.126,78.46.21.203,88.99.58.112,94.130.34.185" \
42
42
  bundle exec rake deploy
43
43
 
44
44
  deploy-us-west-2:
@@ -48,5 +48,5 @@ deploy-us-west-2:
48
48
  SERVER="ec2.mtr-monitor.us-west-2.semaphoreci.com" \
49
49
  HOSTNAME="mtr-monitor.us-west-2.semaphoreci.com" \
50
50
  MTR_OPTIONS="-w -c 50 -f 12" \
51
- MTR_TARGETS="136.243.108.222,138.201.31.31,138.201.32.17" \
51
+ MTR_TARGETS="136.243.131.198,138.201.31.31,144.76.223.42,148.251.87.12,176.9.62.126,78.46.21.203,88.99.58.112,94.130.34.185" \
52
52
  bundle exec rake deploy
data/Rakefile CHANGED
@@ -25,7 +25,9 @@ task :deploy do
25
25
 
26
26
  run "scp -o StrictHostKeyChecking=no .env ubuntu@#{server}:/home/ubuntu/"
27
27
  run "scp -o StrictHostKeyChecking=no docker-compose.yml ubuntu@#{server}:/home/ubuntu/"
28
- run "ssh -o StrictHostKeychecking=no ubuntu@#{server} 'docker-compose down --rmi all && docker-compose up -d'"
28
+ run "ssh -o StrictHostKeychecking=no ubuntu@#{server} 'docker-compose down'"
29
+ run "ssh -o StrictHostKeychecking=no ubuntu@#{server} 'docker system prune --all --force'"
30
+ run "ssh -o StrictHostKeychecking=no ubuntu@#{server} 'docker-compose up -d'"
29
31
  run "rm .env"
30
32
  end
31
33
 
data/docker-compose.yml CHANGED
@@ -17,8 +17,14 @@ services:
17
17
  - MTR_OPTIONS
18
18
  - NAME
19
19
  - DIG_IP_ADDRESS
20
+ logging:
21
+ options:
22
+ max-size: 200m
20
23
 
21
24
  nginx:
22
25
  image: renderedtext/mtr-nginx
23
26
  ports:
24
27
  - 80:80
28
+ logging:
29
+ options:
30
+ max-size: 200m
@@ -3,14 +3,14 @@ module MtrMonitor
3
3
 
4
4
  def self.submit(log_path, hostname, name, logger)
5
5
  hostname = hostname.gsub(".", "-")
6
+ tags = [hostname, name]
6
7
 
7
- logger.info "Submitting pulse: network.mtr.pulse, tags: #{[hostname, name]}, prefix: #{Watchman.prefix} port: #{Watchman.port}"
8
+ logger.info "Submitting pulse: network.mtr.pulse, tags: #{tags}, prefix: #{Watchman.prefix} port: #{Watchman.port}"
8
9
 
9
- Watchman.submit("network.mtr.pulse", 1, :gauge, :tags => [hostname, name])
10
+ Watchman.submit("network.mtr.pulse", 1, :gauge, :tags => tags)
10
11
 
11
12
  hops(log_path).each do |hop|
12
13
  hop_name = hop.name.gsub(".", "-").gsub("?", "q")
13
- tags = [hostname, name, hop_name]
14
14
 
15
15
  Watchman.submit("network.mtr.loss", hop.loss, :gauge, :tags => tags)
16
16
  Watchman.submit("network.mtr.snt", hop.snt, :gauge, :tags => tags)
@@ -8,9 +8,8 @@ module MtrMonitor
8
8
  def initialize(route_name, logdna_ingestion_key, local_log_path, host_ip_address, s3_url, logger)
9
9
  config = {
10
10
  :ip => host_ip_address,
11
- :app => "MTR monitor",
12
- :meta => { :route => route_name, :s3 => s3_url },
13
- :level => "DEBUG"
11
+ :app => "mtr-monitor",
12
+ :level => "INFO"
14
13
  }
15
14
 
16
15
  @mtr_log = File.read(local_log_path)
@@ -19,7 +18,7 @@ module MtrMonitor
19
18
  end
20
19
 
21
20
  def submit
22
- @logdna.log(tier1_provider)
21
+ @logdna.log("Route: #{route_name}, Tier1: #{tier1_provider}, s3: #{s3_url}")
23
22
  @logger.info("Network provider: #{tier1_provider} -- Emitted to LogDNA")
24
23
  end
25
24
 
@@ -1,3 +1,3 @@
1
1
  module MtrMonitor
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtr_monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.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-29 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logdna
@@ -84,7 +84,6 @@ description:
84
84
  email:
85
85
  - devops@renderedtext.com
86
86
  executables:
87
- - mtr-incident-trace
88
87
  - mtr_report
89
88
  extensions: []
90
89
  extra_rdoc_files: []
@@ -103,7 +102,6 @@ files:
103
102
  - bin/setup
104
103
  - docker-compose.yml
105
104
  - docs/provision-new-ec2-machine.md
106
- - exe/mtr-incident-trace
107
105
  - exe/mtr_report
108
106
  - http_endpoint/Dockerfile
109
107
  - http_endpoint/nginx.conf
@@ -1,168 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "json"
4
-
5
- def request_aws_credentials
6
- puts "Enter AWS_ACCESS_KEY_ID: "
7
- $aws_access_key_id = gets.chomp
8
-
9
- puts "Enter AWS_SECRET_ACCESS_KEY: "
10
- $aws_secret_access_key = gets.chomp
11
- end
12
-
13
- def aws
14
- if $aws_access_key_id && $aws_secret_access_key
15
- "AWS_ACCESS_KEY_ID=#{$aws_access_key_id} AWS_SECRET_ACCESS_KEY=#{$aws_secret_access_key} aws"
16
- else
17
- "aws"
18
- end
19
- end
20
-
21
- if File.exists?(File.expand_path "~/.aws/credentials")
22
- puts "✅ Using AWS auth credentials in '~/.aws/credentials'"
23
- else
24
- request_aws_credentials
25
- end
26
-
27
- identity = `#{aws} sts get-caller-identity`
28
- if $?.exitstatus == 0
29
- puts "✅ Authenticated to AWS with Identity:"
30
- puts identity
31
- else
32
- STDERR.puts "Error: AWS authentication failed"
33
- abort
34
- end
35
-
36
- if system("#{aws} s3api head-bucket --bucket hetzner-continuous-mtr")
37
- puts "✅ Verified hetzner-continuous-mtr bucket"
38
- else
39
- STDERR.puts "Error: Can't find hetzner-continuous-mtr bucket"
40
- abort
41
- end
42
-
43
- today = Time.now.strftime("%Y-%m-%d")
44
-
45
- # Germany to US
46
-
47
- # hetzner-to-dockerhub
48
- puts "Fetching latest hetzner-to-dockerhub logs for #{today}..."
49
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix hetzner-to-dockerhub/#{today}/136-243-108-222 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
50
- hetzner_to_dockerhub = JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
51
- puts "✅ Done"
52
-
53
- # hetzner-to-github
54
- puts "Fetching latest hetzner-to-github logs for #{today}..."
55
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix hetzner-to-github/#{today}/136-243-108-222 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
56
- hetzner_to_github = JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
57
- puts "✅ Done"
58
-
59
- # hetzner-to-stripe
60
- puts "Fetching latest hetzner-to-stripe logs for #{today}..."
61
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix hetzner-to-stripe/#{today}/136-243-108-222 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
62
- hetzner_to_stripe= JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
63
- puts "✅ Done"
64
-
65
- # hetzner-to-semaphoreci
66
- puts "Fetching latest hetzner-to-semaphoreci logs for #{today}..."
67
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix hetzner-to-semaphoreci/#{today}/136-243-108-222 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
68
- hetzner_to_semaphoreci= JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
69
- puts "✅ Done"
70
-
71
- # hetzner-to-us-east-1
72
- puts "Fetching latest hetzner-to-us-east-1 logs for #{today}..."
73
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix hetzner-to-us-east-1/#{today}/136-243-108-222 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
74
- hetzner_to_us_east_1 = JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
75
- puts "✅ Done"
76
-
77
- # hetzner-to-us-west-1
78
- puts "Fetching latest hetzner-to-us-west-1 logs for #{today}..."
79
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix hetzner-to-us-west-1/#{today}/136-243-108-222 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
80
- hetzner_to_us_west_1= JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
81
- puts "✅ Done"
82
-
83
- # hetzner-to-us-west-2
84
- puts "Fetching latest hetzner-to-us-west-2 logs for #{today}..."
85
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix hetzner-to-us-west-2/#{today}/136-243-108-222 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
86
- hetzner_to_us_west_2 = JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
87
- puts "✅ Done"
88
-
89
- # US to Germany
90
-
91
- # us-east-1-to-hetzner
92
- puts "Fetching latest us-east-1-to-hetzner logs for #{today}..."
93
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix us-east-1-to-hetzner/#{today}/54-164-114-223 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
94
- us_east_1_to_hetzner = JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
95
- puts "✅ Done"
96
-
97
- # us-west-1-to-hetzner
98
- puts "Fetching latest us-west-1-to-hetzner logs for #{today}..."
99
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix us-west-1-to-hetzner/#{today}/13-57-249-134 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
100
- us_west_1_to_hetzner = JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
101
- puts "✅ Done"
102
-
103
- # us-west-2-to-hetzner
104
- puts "Fetching latest us-west-2-to-hetzner logs for #{today}..."
105
- result = `#{aws} s3api list-objects --bucket hetzner-continuous-mtr --prefix us-west-2-to-hetzner/#{today}/54-201-153-190 --query 'Contents[].{Key: Key, LastModified: LastModified}'`
106
- us_west_2_to_hetzner = JSON.parse(result).last(10).map { |log| "https://s3.eu-central-1.amazonaws.com/hetzner-continuous-mtr/#{log["Key"]}" }
107
- puts "✅ Done"
108
-
109
- # Create report
110
-
111
- puts "Creating incident_mtr_report.txt..."
112
- File.open("incident_mtr_report.txt", "w") do |f|
113
- f.write("1. AWS US East 1 (Virginia)\n")
114
- f.write("---------------------\n")
115
- f.write("1.1. us-east-1 to Hetzner\n")
116
- f.write(us_east_1_to_hetzner.join("\n"))
117
- f.write("\n")
118
- f.write("\n")
119
- f.write("1.2. Hetzner to us-east-1\n")
120
- f.write(hetzner_to_us_east_1.join("\n"))
121
- f.write("\n")
122
- f.write("\n")
123
- f.write("2. AWS US West 1 (California)\n")
124
- f.write("---------------------\n")
125
- f.write("2.1. us-west-1 to Hetzner\n")
126
- f.write(us_west_1_to_hetzner.join("\n"))
127
- f.write("\n")
128
- f.write("\n")
129
- f.write("2.2. Hetzner to us-west-1\n")
130
- f.write(hetzner_to_us_west_1.join("\n"))
131
- f.write("\n")
132
- f.write("\n")
133
- f.write("3. AWS US West 2 (Oregon)\n")
134
- f.write("---------------------\n")
135
- f.write("3.1. us-west-2 to Hetzner\n")
136
- f.write(us_west_2_to_hetzner.join("\n"))
137
- f.write("\n")
138
- f.write("\n")
139
- f.write("3.2. Hetzner to us-west-2\n")
140
- f.write(hetzner_to_us_west_2.join("\n"))
141
- f.write("\n")
142
- f.write("\n")
143
- f.write("4. Github\n")
144
- f.write("---------------------\n")
145
- f.write("4.1. Hetzner to Github\n")
146
- f.write(hetzner_to_github.join("\n"))
147
- f.write("\n")
148
- f.write("\n")
149
- f.write("5. Semaphoreci\n")
150
- f.write("---------------------\n")
151
- f.write("5.1. Hetzner to Semaphoreci\n")
152
- f.write(hetzner_to_semaphoreci.join("\n"))
153
- f.write("\n")
154
- f.write("\n")
155
- f.write("6. Dockerhub\n")
156
- f.write("---------------------\n")
157
- f.write("6.1. Hetzner to Dockerhub\n")
158
- f.write(hetzner_to_dockerhub.join("\n"))
159
- f.write("\n")
160
- f.write("\n")
161
- f.write("7. Stripe\n")
162
- f.write("---------------------\n")
163
- f.write("7.1. Hetzner to Stripe\n")
164
- f.write(hetzner_to_stripe.join("\n"))
165
- f.write("\n")
166
- f.write("\n")
167
- end
168
- puts "✅ Done"