bin/riemann-health in riemann-tools-0.2.2 vs bin/riemann-health in riemann-tools-0.2.3

- old
+ new

@@ -112,11 +112,11 @@ used = (u2+n2+s2) - (u1+n1+s1) total = used + i2-i1 fraction = used.to_f / total - report_pct :cpu, fraction, "user+nice+sytem\n\n#{`ps -eo pcpu,pid,comm | sort -nrb -k1 | head -10`.chomp}" + report_pct :cpu, fraction, "user+nice+system\n\n#{`ps -eo pcpu,pid,comm | sort -nrb -k1 | head -10`.chomp}" end @old_cpu = [u2, n2, s2, i2] end @@ -194,9 +194,17 @@ active = mdat[3].to_i * (1024 ** "BKMGT".index(mdat[4])) inactive = mdat[5].to_i * (1024 ** "BKMGT".index(mdat[6])) used = mdat[7].to_i * (1024 ** "BKMGT".index(mdat[8])) free = mdat[9].to_i * (1024 ** "BKMGT".index(mdat[10])) @topdata[:memory] = (wired + active + used).to_f / (wired + active + used + inactive + free) + # This is for OSX Mavericks which + # uses a different format for top + # Example: PhysMem: 4662M used (1328M wired), 2782M unused. + elsif mdat = ln.match(/PhysMem: ([0-9]+)([BKMGT]) used \(([0-9]+)([BKMGT]) wired\), ([0-9]+)([BKMGT]) unused/i) + used = mdat[1].to_i * (1024 ** "BKMGT".index(mdat[2])) + wired = mdat[3].to_i * (1024 ** "BKMGT".index(mdat[4])) + unused = mdat[5].to_i * (1024 ** "BKMGT".index(mdat[6])) + @topdata[:memory] = (used).to_f / (used + unused) end end end def darwin_cpu