mtr_monitor 0.15.0 → 0.16.0

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: 5889cd469d83f1878c05a8e57d15244fe83934e5
4
- data.tar.gz: ac08bad663e33dc72e01051a12d03d97793cfe52
3
+ metadata.gz: 1e0a4d3f371a9d89ecdda17a93bc368d0999a0de
4
+ data.tar.gz: 04b02c94334b6a0ff36aea4f92c0c441a53f2a77
5
5
  SHA512:
6
- metadata.gz: d669684b06376032c347a4a819fec44e5a6e773620b0a09f04dce577bd6b8259e644b056da59faf1f46f6a9c55f3f56c7eb4b157fb83fd796c667d0b6c8b5835
7
- data.tar.gz: 0356c03875a93d455ae9b424c2ed63cce4f7fe83bfb9b75a01cb8a5b1d1adc703eaabc98fce90b9ee5389ba9a462647ff92fa2b411b2890fb4d1660135cdd864
6
+ metadata.gz: 5acc3eb578fc4d02ec5373e0a3c1714a2ec1378d08d18a851faba5640a6c45f9bc1caf5f78e71a5c2780071123c767b9e3f21723dea8361b34d533635e72aa37
7
+ data.tar.gz: 889d4fb307dea20645ebf8b8fa6c5d013e055b3c63cf8dd26a956dbe9f40afc9bee21edde9e7897572b17a8de16cce61f6bd93368ecd0dc358421fb59614c042
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ incident_mtr_report.txt
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mtr_monitor (0.15.0)
4
+ mtr_monitor (0.16.0)
5
5
  rt-watchman (~> 0.10.0)
6
6
 
7
7
  GEM
@@ -0,0 +1,168 @@
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"
@@ -1,3 +1,3 @@
1
1
  module MtrMonitor
2
- VERSION = "0.15.0"
2
+ VERSION = "0.16.0"
3
3
  end
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: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RenderedText DevOps Team
@@ -70,6 +70,7 @@ description:
70
70
  email:
71
71
  - devops@renderedtext.com
72
72
  executables:
73
+ - mtr-incident-trace
73
74
  - mtr_report
74
75
  extensions: []
75
76
  extra_rdoc_files: []
@@ -86,6 +87,7 @@ files:
86
87
  - bin/console
87
88
  - bin/setup
88
89
  - docker-compose.yml
90
+ - exe/mtr-incident-trace
89
91
  - exe/mtr_report
90
92
  - lib/mtr_monitor.rb
91
93
  - lib/mtr_monitor/cleaner.rb