mtr_monitor 0.10.3 → 0.11.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/exe/mtr_report +3 -0
- data/lib/mtr_monitor.rb +5 -1
- data/lib/mtr_monitor/cleaner.rb +28 -0
- data/lib/mtr_monitor/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f243ceb197f20b9d5de15bf051212a8c5a77e435
|
4
|
+
data.tar.gz: 14228fd786c832de71a24e11ef3a21cf5b040665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12a84d0a0a2366827312408036b06588f336416041b9431c71faaaa81b7170ebad449873654caacc1024678460fddd775c2f8df5c9eb9e79ce0bbda1fffd821c
|
7
|
+
data.tar.gz: 8307dc83389ae67865afb23ecbe6af31ee66e77d95098258e47e24cd70bff854be44e5df29ba0e6c06a08c99c020ea5935fb8893f1b3477f0a0e298df8e90177
|
data/Gemfile.lock
CHANGED
data/exe/mtr_report
CHANGED
data/lib/mtr_monitor.rb
CHANGED
@@ -4,12 +4,16 @@ require "logger"
|
|
4
4
|
require "mtr_monitor/version"
|
5
5
|
require "mtr_monitor/hop"
|
6
6
|
require "mtr_monitor/metrics"
|
7
|
+
require "mtr_monitor/cleaner"
|
7
8
|
|
8
9
|
module MtrMonitor
|
9
10
|
#
|
10
11
|
# Runs a mtr trace toward a domain and saves the report
|
11
12
|
# to /var/log/mtr/<domain>_timestamp.log , uploads to s3 and reports metrics to statsd.
|
12
13
|
#
|
14
|
+
|
15
|
+
REPORTS_PATH = "/var/log/mtr"
|
16
|
+
|
13
17
|
class Report
|
14
18
|
attr_reader :log_path
|
15
19
|
attr_reader :logger
|
@@ -26,7 +30,7 @@ module MtrMonitor
|
|
26
30
|
@logger = logger || Logger.new(STDOUT)
|
27
31
|
|
28
32
|
@log_name = "#{@name}/#{Time.now.strftime("%Y-%m-%d")}/#{@host_ip_address}/#{Time.now.strftime("%H-%M")}.log"
|
29
|
-
@log_path = "
|
33
|
+
@log_path = "#{MtrMonitor::REPORTS_PATH}/#{@log_name.gsub("/", "-")}"
|
30
34
|
@s3_path = "s3://#{@s3_bucket}/#{@log_name}"
|
31
35
|
end
|
32
36
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module MtrMonitor
|
2
|
+
module Cleaner
|
3
|
+
|
4
|
+
MAX_AGE = 2 * 7 * 24 * 60 * 60 # two weeks
|
5
|
+
|
6
|
+
def self.execute(logger)
|
7
|
+
logger.info("[CLEANER] Deleting reports created more than 2 weeks ago")
|
8
|
+
|
9
|
+
old_reports.each do |filename|
|
10
|
+
logger.info("Deleting #{filename}")
|
11
|
+
`sudo rm -f #{filename}`
|
12
|
+
end
|
13
|
+
|
14
|
+
logger.info("[CLEANER] Done.")
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.old_reports
|
18
|
+
all_reports.select do |filename|
|
19
|
+
File.mtime(filename) < (Time.now - MAX_AGE)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.all_reports
|
24
|
+
Dir.glob("#{MtrMonitor::REPORTS_PATH}/*")
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/lib/mtr_monitor/version.rb
CHANGED
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.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RenderedText DevOps Team
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- docker-compose.yml
|
89
89
|
- exe/mtr_report
|
90
90
|
- lib/mtr_monitor.rb
|
91
|
+
- lib/mtr_monitor/cleaner.rb
|
91
92
|
- lib/mtr_monitor/hop.rb
|
92
93
|
- lib/mtr_monitor/metrics.rb
|
93
94
|
- lib/mtr_monitor/version.rb
|