My question to the puppet mailing list would be.
How would you use memory size fact in puppet while keeping in mind
that we could be talking MB or GB?
I need to make decisions based on the amount of memory available.
The whole scaling unit of measurement is kind of annoying though. /
proc/meminfo normally reports as kb doesnt it?
$ cat memorysize_mb.rb
require 'facter'
Facter.add("memorysize_mb") 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
setcode do
ram
end
end
I'd rather look into fixing the problem than doing code monkeypatching
in everyday environments and require folks to write facts to get this
data.
Let's look at making things like this available today in facter.
Patch material?
I generally think facts shouldn't include units anyway, yet we don't
want to break existing things that depend on them.
--Michael
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I think it is actually an option. In order to trend facts
efficiently (regardless of the app), we need numeric facts.
Send us a patch for a numeric fact in facter (and for any other facts
that have units), though I think we probably /do/ have to keep the
existing ones around.
--Michael