mtr_monitor 0.9.9 → 0.9.10

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: 91b53ce8ac5bb956e5ea9e42f90cd9a446d22be7
4
- data.tar.gz: 53166733f7d76fe2be5ce76fca2b480c64dc7697
3
+ metadata.gz: 05f23785a12ac88db1f02e9aac37c3c519665547
4
+ data.tar.gz: b9ecb4f35b22f1a5b353424829bce195626522bb
5
5
  SHA512:
6
- metadata.gz: bf94120283fa6d17e06996c8004497e671b42f49ba389b4735cde5aa1da1e1f5d738c84e4e7b0447ede38065b0e463fa9eb4cf2f4ee135412818fb9cd5cbcfd8
7
- data.tar.gz: cd653d78dc67a762e6cf955874a7c7bc41f3091347d03ec1f7846cf9d62f1edfba70caea9b1474fbd20460ca1479e86b480f72e0f9c51ebc58a1ded2c1408c7d
6
+ metadata.gz: d969268d86e33207233f21c4d5206a366b7c52687a0ce7d05f2254a1b7b9f449435aa0da30cd3042d07466e4dd2822438a41a66310b0ae804d258ff8497ba25d
7
+ data.tar.gz: f879bde810ca205ae6c6d2e83935251a1e61872605f1369d2e3122a5c29ae3238447622214cbad53a6deb4d059cc28143075b5838141d0804650144dd2570d4c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mtr_monitor (0.9.9)
4
+ mtr_monitor (0.9.10)
5
5
  rt-watchman (~> 0.10.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module MtrMonitor
2
- VERSION = "0.9.9"
2
+ VERSION = "0.9.10"
3
3
  end
data/lib/mtr_monitor.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "mtr_monitor/version"
2
2
  require "watchman"
3
+ require "logger"
3
4
 
4
5
  module MtrMonitor
5
6
  #
@@ -8,6 +9,7 @@ module MtrMonitor
8
9
  #
9
10
  class Report
10
11
  attr_reader :log_path
12
+ attr_reader :logger
11
13
 
12
14
  def initialize(name, domain, s3_bucket, mtr_options, aws_access_key_id, aws_secret_access_key)
13
15
  @name = name
@@ -18,6 +20,7 @@ module MtrMonitor
18
20
  @mtr_options = mtr_options
19
21
  @host_ip_address = `curl http://ifconfig.co`.strip.gsub(".", "-")
20
22
  @hostname = `hostname`.strip.gsub(".", "-")
23
+ @logger = Logger.new(STDOUT)
21
24
 
22
25
  @log_name = "#{@name}/#{Time.now.strftime("%Y-%m-%d")}/#{@host_ip_address}/#{Time.now.strftime("%H-%M")}.log"
23
26
  @log_path = "/var/log/mtr/#{@log_name.gsub("/", "-")}"
@@ -25,8 +28,8 @@ module MtrMonitor
25
28
  end
26
29
 
27
30
  def generate
28
- puts "Local Path : #{@log_path}"
29
- puts "S3 Path : #{@s3_path}"
31
+ logger.info "Local Path: #{@log_path}"
32
+ logger.info "S3 Path: #{@s3_path}"
30
33
 
31
34
  run "sudo mkdir -p /var/log/mtr"
32
35
  run "sudo mtr --report #{@mtr_options} #{@domain} > #{@log_path}"
@@ -34,6 +37,7 @@ module MtrMonitor
34
37
  end
35
38
 
36
39
  def submit_metrics
40
+ logger.info "Submitting pulse: network.mtr.pulse, tags: #{[@hostname, @name]}, prefix: #{Watchman.prefix} port: #{Watchman.port}"
37
41
  Watchman.submit("network.mtr.pulse", 1, :gauge, :tags => [@hostname, @name])
38
42
 
39
43
  hops.each do |hop|
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.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - RenderedText DevOps Team