4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/mtr_monitor/metrics.rb', line 4
def self.submit(log_path, hostname, name, logger)
hostname = hostname.gsub(".", "-")
tags = [hostname, name]
logger.info "Submitting pulse: network.mtr.pulse, tags: #{tags}, prefix: #{Watchman.prefix} port: #{Watchman.port}"
Watchman.submit("network.mtr.pulse", 1, :gauge, :tags => tags)
hops(log_path).each do |hop|
hop_name = hop.name.gsub(".", "-").gsub("?", "q")
Watchman.submit("network.mtr.loss", hop.loss, :gauge, :tags => tags)
Watchman.submit("network.mtr.snt", hop.snt, :gauge, :tags => tags)
Watchman.submit("network.mtr.last", hop.last, :gauge, :tags => tags)
Watchman.submit("network.mtr.avg", hop.avg, :gauge, :tags => tags)
Watchman.submit("network.mtr.best", hop.best, :gauge, :tags => tags)
Watchman.submit("network.mtr.worst", hop.worst, :gauge, :tags => tags)
Watchman.submit("network.mtr.std_dev", hop.std_dev, :gauge, :tags => tags)
end
end
|