instrumental_tools 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/bin/instrument_server +13 -8
- data/lib/instrumental_tools/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: fd1d51988ac3f5044e0f0726cf8055e5dcf74efc
|
4
|
+
data.tar.gz: ed9cd0f582c90e647a1ee7db81f77c664b16324a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95598f492b489e2ff0869ca2e272e77dc9e147b7f1c714d7b4b456bc3fe8631f5fa9055d9146927e9c3a81b61251b4f8fa84a19a4b03fbe0b66e23a67aea4839
|
7
|
+
data.tar.gz: 0b089d515266b136934ab6bf1cbf29bc40cefb4d58db6a3576d32d1724fae1cbf8b9cf9ca277f57cb14bf1e033c08ced1d0d2da1895916440fea639287de7b0f
|
data/CHANGELOG.md
CHANGED
data/bin/instrument_server
CHANGED
@@ -13,6 +13,8 @@ require 'pidly'
|
|
13
13
|
require 'tmpdir'
|
14
14
|
require 'optparse'
|
15
15
|
require 'socket'
|
16
|
+
$: << File.join(File.dirname(__FILE__), "..", "lib")
|
17
|
+
require 'instrumental_tools/version'
|
16
18
|
|
17
19
|
class SystemInspector
|
18
20
|
TYPES = [:gauges, :incrementors]
|
@@ -134,13 +136,9 @@ class SystemInspector
|
|
134
136
|
|
135
137
|
def self.df
|
136
138
|
output = {}
|
137
|
-
`df -
|
139
|
+
`df -k`.split("\n").grep(%r{^/dev/}).each do |line|
|
138
140
|
device, total, used, available, capacity, mount = line.split(/\s+/)
|
139
|
-
|
140
|
-
names = ["tmpfs_#{mount.gsub(/[^[:alnum:]]/, "_")}".gsub(/_+/, "_")]
|
141
|
-
else
|
142
|
-
names = [File.basename(device)]
|
143
|
-
end
|
141
|
+
names = [File.basename(device)]
|
144
142
|
names << 'root' if mount == '/'
|
145
143
|
names.each do |name|
|
146
144
|
output["disk.#{name}.total_mb"] = total.to_f / 1024
|
@@ -250,9 +248,15 @@ class SystemInspector
|
|
250
248
|
|
251
249
|
def self.disk_storage
|
252
250
|
output = {}
|
253
|
-
`df -
|
251
|
+
`df -Pka`.split("\n").each do |line|
|
254
252
|
device, total, used, available, capacity, mount = line.split(/\s+/)
|
255
|
-
|
253
|
+
if device == "tmpfs"
|
254
|
+
names = ["tmpfs_#{mount.gsub(/[^[:alnum:]]/, "_")}".gsub(/_+/, "_")]
|
255
|
+
elsif device =~ %r{/dev/}
|
256
|
+
names = [File.basename(device)]
|
257
|
+
else
|
258
|
+
next
|
259
|
+
end
|
256
260
|
names << 'root' if mount == '/'
|
257
261
|
names.each do |name|
|
258
262
|
output["disk.#{name}.total_mb"] = total.to_f / 1024
|
@@ -353,6 +357,7 @@ class ServerController < Pidly::Control
|
|
353
357
|
|
354
358
|
def self.run(options)
|
355
359
|
agent = Instrumental::Agent.new(options[:api_key], :collector => [options[:collector], options[:port]].compact.join(':'))
|
360
|
+
puts "insrument_server version #{Instrumental::Tools::VERSION} started at #{Time.now.utc}"
|
356
361
|
puts "Collecting stats under the hostname: #{options[:hostname]}"
|
357
362
|
loop do
|
358
363
|
t = Time.now.to_i
|