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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mtr_monitor.rb +18 -3
- data/lib/mtr_monitor/version.rb +1 -1
- 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: c561c98cc044312a97c61aa2b9db5f7cf15a26a1
|
4
|
+
data.tar.gz: ed9268b1a5cf09a5b76ce641f600ce12e2bd3ede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3675b8322277a60641263280029a66013aff8e7e31cfdd5f81debcb575deb9305c3bc9293716aa11ba28efa8f55a29a08a66da68db165d67499e5a428c7995b
|
7
|
+
data.tar.gz: 772989cc12984c01892d095a859fc8b8529eca45853f7a3bb3686bb27a7f69abe25ea28c138989b772e005d0ae92db5867ad30d2255f7c0e6a2ce67b23155bc1
|
data/Gemfile.lock
CHANGED
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
|
-
|
42
|
-
|
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
|
|
data/lib/mtr_monitor/version.rb
CHANGED