instrumental_tools 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: deeb3bca1cfaecc407a6fed2dd89a65a28d56ab1
4
- data.tar.gz: 323ef81462e8919bfc9ffee0868b434da5e209ff
3
+ metadata.gz: fd1d51988ac3f5044e0f0726cf8055e5dcf74efc
4
+ data.tar.gz: ed9cd0f582c90e647a1ee7db81f77c664b16324a
5
5
  SHA512:
6
- metadata.gz: 238ed6bb1d4c9190538c2ba1ff4610860f3ea4a14708e1f681ee4354f6c26037f8704e9dfa8ac7efe04f83d5d9719b0064898b3e99e8220d44bed56f5e1f9cfd
7
- data.tar.gz: 7a12fe9e202bb4f8cdae0dc4bbe0099d36c6c292a66fbc06785c17909d4e990b065b8c6db048a253b2c6a469f9c321f4581340288c250d3ef9540fb44a4231bd
6
+ metadata.gz: 95598f492b489e2ff0869ca2e272e77dc9e147b7f1c714d7b4b456bc3fe8631f5fa9055d9146927e9c3a81b61251b4f8fa84a19a4b03fbe0b66e23a67aea4839
7
+ data.tar.gz: 0b089d515266b136934ab6bf1cbf29bc40cefb4d58db6a3576d32d1724fae1cbf8b9cf9ca277f57cb14bf1e033c08ced1d0d2da1895916440fea639287de7b0f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### 0.5.7 [January 31st, 2014]
2
+ * tmpfs tracking actually works now!
3
+
1
4
  ### 0.5.6 [January 31st, 2014]
2
5
  * Add tmpfs to disk stats
3
6
 
@@ -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 -ka`.split("\n").grep(%r{^(/dev/|tmpfs)}).each do |line|
139
+ `df -k`.split("\n").grep(%r{^/dev/}).each do |line|
138
140
  device, total, used, available, capacity, mount = line.split(/\s+/)
139
- if device == "tmpfs"
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 -Pk`.split("\n").grep(%r{^/dev/}).each do |line|
251
+ `df -Pka`.split("\n").each do |line|
254
252
  device, total, used, available, capacity, mount = line.split(/\s+/)
255
- names = [File.basename(device)]
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
@@ -1,5 +1,5 @@
1
1
  module Instrumental
2
2
  module Tools
3
- VERSION = '0.5.6'
3
+ VERSION = '0.5.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instrumental_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elijah Miller