mtr_monitor 0.11.0 → 0.12.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: f243ceb197f20b9d5de15bf051212a8c5a77e435
4
- data.tar.gz: 14228fd786c832de71a24e11ef3a21cf5b040665
3
+ metadata.gz: c561c98cc044312a97c61aa2b9db5f7cf15a26a1
4
+ data.tar.gz: ed9268b1a5cf09a5b76ce641f600ce12e2bd3ede
5
5
  SHA512:
6
- metadata.gz: 12a84d0a0a2366827312408036b06588f336416041b9431c71faaaa81b7170ebad449873654caacc1024678460fddd775c2f8df5c9eb9e79ce0bbda1fffd821c
7
- data.tar.gz: 8307dc83389ae67865afb23ecbe6af31ee66e77d95098258e47e24cd70bff854be44e5df29ba0e6c06a08c99c020ea5935fb8893f1b3477f0a0e298df8e90177
6
+ metadata.gz: a3675b8322277a60641263280029a66013aff8e7e31cfdd5f81debcb575deb9305c3bc9293716aa11ba28efa8f55a29a08a66da68db165d67499e5a428c7995b
7
+ data.tar.gz: 772989cc12984c01892d095a859fc8b8529eca45853f7a3bb3686bb27a7f69abe25ea28c138989b772e005d0ae92db5867ad30d2255f7c0e6a2ce67b23155bc1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mtr_monitor (0.11.0)
4
+ mtr_monitor (0.12.0)
5
5
  rt-watchman (~> 0.10.0)
6
6
 
7
7
  GEM
data/lib/mtr_monitor.rb CHANGED
@@ -16,7 +16,9 @@ module MtrMonitor
16
16
 
17
17
  class Report
18
18
  attr_reader :log_path
19
+ attr_reader :s3_path
19
20
  attr_reader :logger
21
+ attr_reader :host_ip_address
20
22
 
21
23
  def initialize(name, domain, s3_bucket, mtr_options, aws_access_key_id, aws_secret_access_key, logger = nil)
22
24
  @name = name
@@ -38,13 +40,26 @@ module MtrMonitor
38
40
  logger.info "Local Path: #{@log_path}"
39
41
  logger.info "S3 Path: #{@s3_path}"
40
42
 
41
- run "sudo mkdir -p /var/log/mtr"
42
- run "sudo mtr --report #{@mtr_options} #{@domain} > #{@log_path}"
43
- run "AWS_ACCESS_KEY_ID='#{@aws_access_key_id}' AWS_SECRET_ACCESS_KEY='#{@aws_secret_access_key}' aws s3 cp #{@log_path} #{@s3_path}"
43
+ generate_local_report
44
+ upload_to_s3
44
45
 
45
46
  MtrMonitor::Metrics.submit(@log_path, @hostname, @name, @logger)
46
47
  end
47
48
 
49
+ def generate_local_report
50
+ run %Q(sudo mkdir -p /var/log/mtr)
51
+ run %Q(sudo sh -c 'echo "Name: #{@name}" >> #{@log_path}')
52
+ run %Q(sudo sh -c 'echo "Domain: #{@domain}" >> #{@log_path}')
53
+ run %Q(sudo sh -c 'echo "Source IP: #{@host_ip_address}" >> #{@log_path}')
54
+ run %Q(sudo sh -c 'echo "Target IP: #{@target_ip}" >> #{@log_path}')
55
+ run %Q(sudo sh -c 'echo "---------------------------------------" >> #{@log_path}')
56
+ run %Q(sudo sh -c 'mtr --report #{@mtr_options} #{@domain} >> #{@log_path}')
57
+ end
58
+
59
+ def upload_to_s3
60
+ run %Q(AWS_ACCESS_KEY_ID='#{@aws_access_key_id}' AWS_SECRET_ACCESS_KEY='#{@aws_secret_access_key}' aws s3 cp #{@log_path} #{@s3_path})
61
+ end
62
+
48
63
  def run(cmd)
49
64
  logger.info "Running: #{cmd}"
50
65
 
@@ -1,3 +1,3 @@
1
1
  module MtrMonitor
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.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.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RenderedText DevOps Team