mtr_monitor 0.9.10 → 0.9.11
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/exe/mtr_report +9 -5
- data/lib/mtr_monitor/version.rb +1 -1
- data/lib/mtr_monitor.rb +2 -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: 6061e45a1dd3d03aca90053d4f0040a6fefda1b2
|
4
|
+
data.tar.gz: 14339f8f4af27939c63e56b6fd7cf4645f76eef7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ee4c6cf4523e281bd39c420435596ad68aaa97cfb7be3dfd0ffbfac0bcc0b82689fb35f8c42fd5b2b9d94ed85a27a2b7f203c04e2422621913eb2121029452
|
7
|
+
data.tar.gz: a541bebf6c5802d3c98519d73055140b854094f5365f06efb5232cc4576ba5ac47292ab0e451dd3606886576a0109b2dcaa83067f8d8fec214252831a24be055
|
data/Gemfile.lock
CHANGED
data/exe/mtr_report
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
$stdout.sync = true
|
5
5
|
|
6
6
|
require "mtr_monitor"
|
7
|
+
require "logger"
|
8
|
+
|
9
|
+
logger = Logger.new(STDOUT)
|
7
10
|
|
8
11
|
name = ENV.fetch("NAME")
|
9
12
|
domain = ENV.fetch("DOMAIN")
|
@@ -23,14 +26,15 @@ loop do
|
|
23
26
|
s3_bucket,
|
24
27
|
mtr_options,
|
25
28
|
aws_access_key_id,
|
26
|
-
aws_secret_access_key
|
29
|
+
aws_secret_access_key,
|
30
|
+
logger)
|
27
31
|
|
28
|
-
|
32
|
+
logger.info "Generating report"
|
29
33
|
report.generate
|
30
34
|
|
31
|
-
|
32
|
-
|
35
|
+
logger.info "Submiting metrics"
|
36
|
+
report.submit_metrics
|
33
37
|
|
34
|
-
|
38
|
+
logger.info "Sleeping for #{sleep_time} minutes"
|
35
39
|
sleep(sleep_time * 60)
|
36
40
|
end
|
data/lib/mtr_monitor/version.rb
CHANGED
data/lib/mtr_monitor.rb
CHANGED
@@ -11,7 +11,7 @@ module MtrMonitor
|
|
11
11
|
attr_reader :log_path
|
12
12
|
attr_reader :logger
|
13
13
|
|
14
|
-
def initialize(name, domain, s3_bucket, mtr_options, aws_access_key_id, aws_secret_access_key)
|
14
|
+
def initialize(name, domain, s3_bucket, mtr_options, aws_access_key_id, aws_secret_access_key, logger = nil)
|
15
15
|
@name = name
|
16
16
|
@domain = domain
|
17
17
|
@s3_bucket = s3_bucket
|
@@ -20,7 +20,7 @@ module MtrMonitor
|
|
20
20
|
@mtr_options = mtr_options
|
21
21
|
@host_ip_address = `curl http://ifconfig.co`.strip.gsub(".", "-")
|
22
22
|
@hostname = `hostname`.strip.gsub(".", "-")
|
23
|
-
@logger = Logger.new(STDOUT)
|
23
|
+
@logger = logger || Logger.new(STDOUT)
|
24
24
|
|
25
25
|
@log_name = "#{@name}/#{Time.now.strftime("%Y-%m-%d")}/#{@host_ip_address}/#{Time.now.strftime("%H-%M")}.log"
|
26
26
|
@log_path = "/var/log/mtr/#{@log_name.gsub("/", "-")}"
|