Created
February 20, 2015 06:47
-
-
Save stanaka/064a3b24ba98974f8600 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
$now = Time.now | |
$cmd = "/Users/stanaka/git/github.com/stanaka/mackerel-osx/smc" | |
def smc(item) | |
ret = `#{$cmd} read #{item}` | |
ret = ret.split(/\t/) | |
if ret[1] | |
ret[1].to_i | |
else | |
ret = ret[0].split(/ +/) | |
ret[1].match(/fpe2(\d+)/)[1] | |
end | |
end | |
def output(key, value) | |
puts "#{key}\t#{value}\t#{$now.to_i}" | |
end | |
output("smc.fan.actualspeed", smc("F0Ac")) | |
output("smc.fan.minimumpeed", smc("F0Mn")) | |
output("smc.fan.maximumspeed", smc("F0Mx")) | |
output("smc.temp.EnclosureBottom0", smc("TB0T")) | |
output("smc.temp.EnclosureBottom1", smc("TB1T")) | |
output("smc.temp.EnclosureBottom2", smc("TB2T")) | |
output("smc.temp.CpuDiodeTemp", smc("TC0D")) | |
output("smc.temp.CpuPinTemp", smc("TC0P")) | |
output("smc.temp.MemoryControllerTemp", smc("Tm0P")) | |
output("smc.tem | |
# https://help.ubuntu.com/community/MacBookPro5-1_5-2/Maverick | |
# http://eriktrips.com/tag/lm-sensors/ | |
# 1: TB0T - Battery TS_MAX Temp | |
# 2: TB1T - Battery TS1 Temp | |
# 3: TB2T - Battery TS2 Temp | |
# 4: TC0D - CPU 0 Die Temp | |
# 5: TC0E - ? | |
# 6: TC0P - CPU 0 Proximity Temp | |
# 7: TC1E - ? | |
# 8: TCZ3 - ? | |
# 9: TCZ4 - ? | |
# 10: TCZ5 - ? | |
# 11: TG0E - ? | |
# 12: TG1E - ? | |
# 13: TG2E - ? | |
# 14: TGZ3 - ? | |
# 15: TGZ4 - ? | |
# 16: TGZ5 - ? | |
# 17: TH0F - ? | |
# 18: TH0O - ? | |
# 19: TH0o - ? | |
# 20: TM0P - ? | |
# 21: TN0D - MCP Die | |
# 22: TN0P - MCP Proximity | |
# 23: TN1D - ? | |
# 24: Th1H - ? | |
# 25: Tp0P - ? | |
# 26: Ts0P - Palm Rest Temp | |
# 27: Ts0S - ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment