<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1 +1,3 @@
+.loadpath
+.project
 .DS_Store</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,52 +1,53 @@
 class MemoryUsage &lt; ScoutAgent::Plugin
   TEST_USAGE = &quot;#{File.basename($0)} max_swap_used MAX_SWAP_USED max_swap_ration MAX_SWAP_RATIO&quot;
   
-  UNITS = { &quot;b&quot; =&gt; 1, 
+  UNITS = { &quot;b&quot; =&gt; 1,
             &quot;k&quot; =&gt; 1024,
             &quot;m&quot; =&gt; 1024 * 1024,
             &quot;g&quot; =&gt; 1024 * 1024 * 1024 }
             
   def build_report
     top_output = `top -#{RUBY_PLATFORM.include?('darwin') ? 'l' : 'n'} 1`
-    mem        = top_output[/^(?:Phys)?Mem:.+/i] or raise &quot;Missing mem&quot;
-    swap       = top_output[/^Swap:.+/i]
-
-    report_memory(mem,  &quot;mem&quot;)
+    mem = top_output[/^(?:Phys)?Mem:.+/i] or raise &quot;Missing mem&quot;
+    swap = top_output[/^Swap:.+/i]
+    @reports = {}
+    report_memory(mem, &quot;mem&quot;)
     report_percent(&quot;mem&quot;)
-    if swap           
+    if swap
       report_memory(swap, &quot;swap&quot;)
       report_percent(&quot;swap&quot;)
-      if swap_used = reports.last[:swap_used]
-        ratio  = ( swap_used.to_f / reports.last[:mem_used] ).round        
-        
-        report(:swap_ratio =&gt; ratio)
-
+      if swap_used = @reports[:swap_used]
+        @reports[:swap_ratio] = ratio = ( swap_used.to_f /
+                                          @reports[:mem_used] ).round
         max = @options[&quot;max_swap_used&quot;].to_i*UNITS[&quot;m&quot;]
         if max &gt; 0 and swap_used &gt; max
-          alert &quot;Maximum Swap Exceeded (#{swap_used})&quot;, ''
+          alert &quot;Maximum Swap Exceeded (#{swap_used})&quot;,''
         end
         max = @options[&quot;max_swap_ratio&quot;].to_i
         if max &gt; 0 and ratio &gt; max
-          alert &quot;Maximum Swap Ratio Exceeded (#{ratio})&quot;, ''
+          alert &quot;Maximum Swap Ratio Exceeded (#{ratio})&quot;,''
         end
       end
     end
-    @report
+    report(@reports)
   rescue =&gt; e
-    error &quot;Couldn't use `top` as expected.&quot;, &quot;#{e.message}\n#{e.backtrace}&quot; #$!.message
+    error &quot;Couldn't use `top` as expected.&quot;, &quot;#{e.message} ----- #{e.backtrace}&quot; #$!.message
   end
   
   private
   
   def report_memory(data, type)
     data.scan(/(\d+|\d+\.\d+)([bkmg])\s+(\w+)/i) do |amount, unit, label|
-      report( &quot;#{type}_#{label.downcase}&quot;.to_sym =&gt; (amount.to_f * UNITS[unit.downcase]).round )
+      @reports[&quot;#{type}_#{label.downcase}&quot;.to_sym] =
+        (amount.to_f * UNITS[unit.downcase]).round
     end
   end
   
   def report_percent(type)
-    used = (reports.last[&quot;#{type}_used&quot;.to_sym]) or return
-    free = (reports.last[&quot;#{type}_free&quot;.to_sym]) or return
-    report( &quot;#{type}_used_percent&quot;.to_sym =&gt; (used.to_f / (used + free)  * 100).round )
+    used = @reports[&quot;#{type}_used&quot;.to_sym] or return
+    free = @reports[&quot;#{type}_free&quot;.to_sym] or return
+    @reports[&quot;#{type}_used_percent&quot;.to_sym] =
+      (used.to_f / (used + free) * 100).round
   end
 end
+ 
\ No newline at end of file</diff>
      <filename>memory_usage/memory_usage.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d3742ec4cd16267825514ff79a77ab88fb41d74f</id>
    </parent>
  </parents>
  <author>
    <name>Andre Lewis</name>
    <email>andre@highgroove.com</email>
  </author>
  <url>http://github.com/highgroove/scout-plugins/commit/f8a0099eb938261163f524319c5c5a8767aecfca</url>
  <id>f8a0099eb938261163f524319c5c5a8767aecfca</id>
  <committed-date>2009-03-04T15:13:04-08:00</committed-date>
  <authored-date>2009-03-04T15:13:04-08:00</authored-date>
  <message>memory usage change ... but still not working with new agent</message>
  <tree>cb75a5816f2b9f53dde991bbc75ed124f557ec4f</tree>
  <committer>
    <name>Andre Lewis</name>
    <email>andre@highgroove.com</email>
  </committer>
</commit>
