mtr_monitor 1.0.5 → 1.1.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 +4 -4
- data/Gemfile.lock +1 -1
- data/Makefile +6 -6
- data/Rakefile +1 -1
- data/exe/mtr_report +26 -18
- data/lib/mtr_monitor/version.rb +1 -1
- data/lib/mtr_monitor.rb +10 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b51473f33cd5da42ade150a1ea3ba04222c88a14
|
4
|
+
data.tar.gz: 17f7d4ca9a0b2f36efac83283f045697e2c21cb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aec9b3fb211aaa0026767efa6cc83f5a170d444eb14a7355740301af7cb0cc670da99327aa802dcb65689f9d6fabca85186560a8cee076400b14609f0970b0d
|
7
|
+
data.tar.gz: 11d49f05aafb190b81c5c2e8532ccc9982c8a7c922186d8978b0bc13e851276302bcca5cb3fc01688db1da484c2ac56465709df5924cc6788b89b48d44dc450c
|
data/Gemfile.lock
CHANGED
data/Makefile
CHANGED
@@ -27,8 +27,8 @@ deploy-us-east-1:
|
|
27
27
|
NAME="us-east-1-to-hetzner" \
|
28
28
|
SERVER="ec2.mtr-monitor.us-east-1.semaphoreci.com" \
|
29
29
|
HOSTNAME="mtr-monitor.us-east-1.semaphoreci.com" \
|
30
|
-
MTR_OPTIONS="-w -
|
31
|
-
|
30
|
+
MTR_OPTIONS="-w -c 50 -f 12" \
|
31
|
+
MTR_TARGETS="136.243.108.222,138.201.31.31,138.201.32.17" \
|
32
32
|
bundle exec rake deploy
|
33
33
|
|
34
34
|
deploy-us-west-1:
|
@@ -37,8 +37,8 @@ deploy-us-west-1:
|
|
37
37
|
NAME="us-west-1-to-hetzner" \
|
38
38
|
SERVER="ec2.mtr-monitor.us-west-1.semaphoreci.com" \
|
39
39
|
HOSTNAME="mtr-monitor.us-west-1.semaphoreci.com" \
|
40
|
-
MTR_OPTIONS="-w -
|
41
|
-
|
40
|
+
MTR_OPTIONS="-w -c 50 -f 12" \
|
41
|
+
MTR_TARGETS="136.243.108.222,138.201.31.31,138.201.32.17" \
|
42
42
|
bundle exec rake deploy
|
43
43
|
|
44
44
|
deploy-us-west-2:
|
@@ -47,6 +47,6 @@ deploy-us-west-2:
|
|
47
47
|
NAME="us-west-2-to-hetzner" \
|
48
48
|
SERVER="ec2.mtr-monitor.us-west-2.semaphoreci.com" \
|
49
49
|
HOSTNAME="mtr-monitor.us-west-2.semaphoreci.com" \
|
50
|
-
MTR_OPTIONS="-w -
|
51
|
-
|
50
|
+
MTR_OPTIONS="-w -c 50 -f 12" \
|
51
|
+
MTR_TARGETS="136.243.108.222,138.201.31.31,138.201.32.17" \
|
52
52
|
bundle exec rake deploy
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ task :deploy do
|
|
11
11
|
|
12
12
|
File.open(".env", "w") do |f|
|
13
13
|
f.write("LOGDNA_INGESTION_KEY=#{ENV.fetch("LOGDNA_INGESTION_KEY")}\n")
|
14
|
-
f.write("
|
14
|
+
f.write("MTR_TARGETS=#{ENV.fetch("MTR_TARGET_DOMAIN")}\n")
|
15
15
|
f.write("WATCHMAN_HOST=#{ENV.fetch("WATCHMAN_HOST")}\n")
|
16
16
|
f.write("SLEEP_TIME=#{ENV.fetch("SLEEP_TIME")}\n")
|
17
17
|
f.write("AWS_SECRET_ACCESS_KEY=#{ENV.fetch("AWS_SECRET_ACCESS_KEY")}\n")
|
data/exe/mtr_report
CHANGED
@@ -6,10 +6,12 @@ $stdout.sync = true
|
|
6
6
|
require "mtr_monitor"
|
7
7
|
require "logger"
|
8
8
|
|
9
|
-
|
9
|
+
Watchman.host = ENV.fetch("WATCHMAN_HOST")
|
10
|
+
Watchman.port = ENV.fetch("WATCHMAN_PORT", 8125).to_i
|
11
|
+
Watchman.prefix = "mtr-monitor.prod"
|
10
12
|
|
11
13
|
name = ENV.fetch("NAME")
|
12
|
-
|
14
|
+
mtr_targets = ENV.fetch("MTR_TARGETS")
|
13
15
|
s3_bucket = ENV.fetch("S3_BUCKET")
|
14
16
|
aws_access_key_id = ENV.fetch("AWS_ACCESS_KEY_ID")
|
15
17
|
aws_secret_access_key = ENV.fetch("AWS_SECRET_ACCESS_KEY")
|
@@ -17,24 +19,30 @@ mtr_options = ENV.fetch("MTR_OPTIONS", "")
|
|
17
19
|
sleep_time = ENV.fetch("SLEEP_TIME", "5").to_i
|
18
20
|
dig_ip_address = ENV.fetch("DIG_IP_ADDRESS").downcase == "yes" ? true : false
|
19
21
|
logdna_ingestion_key = ENV.fetch("LOGDNA_INGESTION_KEY")
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
logger = Logger.new(STDOUT)
|
23
|
+
|
24
|
+
def generate_report(mtr_target)
|
25
|
+
options = {
|
26
|
+
:name => name,
|
27
|
+
:mtr_target => mtr_target,
|
28
|
+
:s3_bucket => s3_bucket,
|
29
|
+
:mtr_options => mtr_options,
|
30
|
+
:aws_access_key_id => aws_access_key_id,
|
31
|
+
:aws_secret_access_key => aws_secret_access_key,
|
32
|
+
:dig_ip_address => dig_ip_address,
|
33
|
+
:logdna_ingestion_key => logdna_ingestion_key,
|
34
|
+
:logger => logger
|
35
|
+
}
|
36
|
+
|
37
|
+
MtrMonitor::Report.new(options).generate
|
38
|
+
end
|
24
39
|
|
25
40
|
loop do
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
aws_secret_access_key,
|
32
|
-
dig_ip_address,
|
33
|
-
logdna_ingestion_key,
|
34
|
-
logger)
|
35
|
-
|
36
|
-
logger.info "Generating report"
|
37
|
-
report.generate
|
41
|
+
mtr_targets.split(",").each do |mtr_target|
|
42
|
+
logger.info "Generating report for #{mtr_target}"
|
43
|
+
|
44
|
+
generate_report(mtr_target)
|
45
|
+
end
|
38
46
|
|
39
47
|
logger.info "Running Cleaner"
|
40
48
|
MtrMonitor::Cleaner.execute(logger)
|
data/lib/mtr_monitor/version.rb
CHANGED
data/lib/mtr_monitor.rb
CHANGED
@@ -32,17 +32,18 @@ module MtrMonitor
|
|
32
32
|
attr_reader :logger
|
33
33
|
attr_reader :host_ip_address
|
34
34
|
|
35
|
-
def initialize(
|
36
|
-
@name = name
|
37
|
-
@domain =
|
38
|
-
@s3_bucket = s3_bucket
|
39
|
-
@aws_access_key_id = aws_access_key_id
|
40
|
-
@aws_secret_access_key = aws_secret_access_key
|
41
|
-
@mtr_options = mtr_options
|
35
|
+
def initialize(options)
|
36
|
+
@name = options.fetch(:name)
|
37
|
+
@domain = options.fetch(:mtr_target)
|
38
|
+
@s3_bucket = options.fetch(:s3_bucket)
|
39
|
+
@aws_access_key_id = options.fetch(:aws_access_key_id)
|
40
|
+
@aws_secret_access_key = options.fetch(:aws_secret_access_key)
|
41
|
+
@mtr_options = options.fetch(:mtr_options)
|
42
|
+
@dig_ip_address = options.fetch(:dig_ip_address)
|
43
|
+
@logger = options.fetch(:logger, Logger.new(STDOUT))
|
44
|
+
|
42
45
|
@host_ip_address = `dig +short myip.opendns.com @resolver1.opendns.com`.strip
|
43
46
|
@hostname = `hostname`.strip
|
44
|
-
@dig_ip_address = dig_ip_address
|
45
|
-
@logger = logger || Logger.new(STDOUT)
|
46
47
|
@created_at = Time.now.utc
|
47
48
|
end
|
48
49
|
|