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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mtr_monitor/version.rb +1 -1
- data/lib/mtr_monitor.rb +6 -2
- 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: 05f23785a12ac88db1f02e9aac37c3c519665547
|
4
|
+
data.tar.gz: b9ecb4f35b22f1a5b353424829bce195626522bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d969268d86e33207233f21c4d5206a366b7c52687a0ce7d05f2254a1b7b9f449435aa0da30cd3042d07466e4dd2822438a41a66310b0ae804d258ff8497ba25d
|
7
|
+
data.tar.gz: f879bde810ca205ae6c6d2e83935251a1e61872605f1369d2e3122a5c29ae3238447622214cbad53a6deb4d059cc28143075b5838141d0804650144dd2570d4c
|
data/Gemfile.lock
CHANGED
data/lib/mtr_monitor/version.rb
CHANGED
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
|
-
|
29
|
-
|
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|
|