Skip to content
Browse files

oops nested data structure instead of scalar...

  • Loading branch information...
1 parent ce5b6d5 commit b5b58a512a847f024d95bb24c04426473c48a482 @dhruvbansal dhruvbansal committed Aug 18, 2010
Showing with 11 additions and 8 deletions.
  1. +3 −2 graphiterb.gemspec
  2. +8 −6 lib/graphiterb/monitors/system.rb
View
5 graphiterb.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{graphiterb}
- s.version = "0.2.1"
+ s.version = "0.2.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Philip (flip) Kromer (@mrflip)"]
- s.date = %q{2010-08-17}
+ s.date = %q{2010-08-18}
s.description = %q{Uses http://github.com/mrflip/configliere and http://graphite.wikidot.com}
s.email = %q{info@infochimps.org}
s.extra_rdoc_files = [
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
"lib/graphiterb/monitors.rb",
"lib/graphiterb/monitors/directory_tree.rb",
"lib/graphiterb/monitors/disk_space.rb",
+ "lib/graphiterb/monitors/system.rb",
"lib/graphiterb/script.rb",
"lib/graphiterb/sender.rb",
"lib/graphiterb/utils.rb",
View
14 lib/graphiterb/monitors/system.rb
@@ -49,7 +49,6 @@ def swap lines
def get_metrics metrics, since
- puts '=' * 80
df.each do |handle, size, spaceused, spacefree, percentfree, location|
disk_name = handle.gsub(/^\//, '').split('/')
metrics << [scope(hostname, disk_name, 'available'), spacefree.to_i]
@@ -58,15 +57,18 @@ def get_metrics metrics, since
lines = top
metrics << [scope(hostname, 'cpu', 'avg_usage'), cpu(lines)]
- metrics << [scope(hostname, 'processes', 'count'), processes(lines)]
+
+ proc_total, proc_running = processes(lines)
+ metrics << [scope(hostname, 'processes', 'total'), proc_total ]
+ metrics << [scope(hostname, 'processes', 'running'), proc_running ]
mem_used, mem_free = memory(lines)
swap_used, swap_free = swap(lines)
- metrics << [scope(hostname, 'memory', 'used'), mem_used ]
- metrics << [scope(hostname, 'memory', 'free'), mem_free ]
- metrics << [scope(hostname, 'swap', 'used'), swap_used]
- metrics << [scope(hostname, 'swap', 'free'), swap_free]
+ metrics << [scope(hostname, 'memory', 'used'), mem_used ]
+ metrics << [scope(hostname, 'memory', 'free'), mem_free ]
+ metrics << [scope(hostname, 'swap', 'used'), swap_used ]
+ metrics << [scope(hostname, 'swap', 'free'), swap_free ]
end
end

0 comments on commit b5b58a5

Please sign in to comment.
Something went wrong with that request. Please try again.