1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# # Output the amount of RAM in Megs on linux. Facter.add("ram") do confine :kernel => :Linux ram = 0 # Steal linux's meminfo File.open( "/proc/meminfo" , 'r' ) do |f| f.grep( /^MemTotal:/ ) {|mem| ram = mem.split( / +/ )[1].to_i / 1024 } end # http://projects.reductivelabs.com/issues/2455 weird. setcode do ram end end |

