[Pkg-puppet-devel] [facter] 47/352: (#20994) fix incorrect memoryfree fact on AIX (was set to 0) tested on AIX 5.3, 6.1, and 7.1
Stig Sandbeck Mathisen
ssm at debian.org
Sun Apr 6 22:21:30 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit 1e7e36935618b059183a58f9338e0d60936aa0f9
Author: Aran Cox <aran.cox at act.org>
Date: Fri May 31 11:12:48 2013 -0500
(#20994) fix incorrect memoryfree fact on AIX (was set to 0)
tested on AIX 5.3, 6.1, and 7.1
---
lib/facter/util/memory.rb | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/facter/util/memory.rb b/lib/facter/util/memory.rb
index 94b47a8..58dca42 100644
--- a/lib/facter/util/memory.rb
+++ b/lib/facter/util/memory.rb
@@ -67,6 +67,14 @@ module Facter::Memory
freemem = ( memfree + memspecfree ) * pagesize
end
+ # on AIX use svmon to get the free memory:
+ # it's the third value on the line starting with memory
+ # svmon can be run by non root users
+ def self.svmon_aix_find_free_memory()
+ Facter::Util::Resolution.exec("/usr/bin/svmon -O unit=KB") =~ /^memory\s+\d+\s+\d+\s+(\d+)\s+/
+ $1
+ end
+
def self.mem_free(kernel = Facter.value(:kernel))
output = mem_free_info(kernel)
scale_mem_free_value output, kernel
@@ -80,12 +88,14 @@ module Facter::Memory
vmstat_find_free_memory(["-H"])
when /Darwin/i
vmstat_darwin_find_free_memory()
+ when /AIX/i
+ svmon_aix_find_free_memory()
end
end
def self.scale_mem_free_value (value, kernel)
case kernel
- when /OpenBSD/i, /FreeBSD/i, /SunOS/i, /Dragonfly/i
+ when /OpenBSD/i, /FreeBSD/i, /SunOS/i, /Dragonfly/i, /AIX/i
value.to_f / 1024.0
when /Darwin/i
value.to_f / 1024.0 / 1024.0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git
More information about the Pkg-puppet-devel
mailing list