summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjtimberman <joshua@opscode.com>2013-05-09 16:00:22 -0600
committerjtimberman <joshua@opscode.com>2013-05-09 16:00:22 -0600
commit2e919950569c15a41296bf6653fa941eb9bac977 (patch)
treefc782ea6fe698aacde307d5cdcc445c115c03056
parenta82462867180e7b3f20dc9bdbbd3ac5d7a7b41ec (diff)
downloadohai-jtimberman/aix-wip.tar.gz
[WIP] - converting sigar -> AIX commandsjtimberman/aix-wip
-rw-r--r--lib/ohai/plugins/aix/cpu.rb35
-rw-r--r--lib/ohai/plugins/aix/hostname.rb4
-rw-r--r--lib/ohai/plugins/aix/kernel.rb27
-rw-r--r--lib/ohai/plugins/aix/memory.rb11
-rw-r--r--lib/ohai/plugins/aix/platform.rb12
5 files changed, 79 insertions, 10 deletions
diff --git a/lib/ohai/plugins/aix/cpu.rb b/lib/ohai/plugins/aix/cpu.rb
index 32b2dc91..475968d0 100644
--- a/lib/ohai/plugins/aix/cpu.rb
+++ b/lib/ohai/plugins/aix/cpu.rb
@@ -1,6 +1,6 @@
#
-# Author:: Doug MacEachern <dougm@vmware.com>
-# Copyright:: Copyright (c) 2010 VMware, Inc.
+# Author:: Joshua Timberman <joshua@opscode.com>
+# Copyright:: Copyright (c) 2013, Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,4 +16,33 @@
# limitations under the License.
#
-require_plugin "sigar::cpu"
+provides "cpu"
+
+cpu = Mash.new
+
+# IBM is the only maker of CPUs for AIX systems.
+cpu[:vendor_id] = "IBM"
+# At least one CPU will be available, but we'll wait to increment this later.
+cpu[:available] = 0
+cpu[:total] = 0
+
+cpudevs = from("lsdev -Cc processor").lines
+cpudevs.each do |c|
+ cpu[:total] += 1
+ name, status, location = c.split
+ cpu[name] = Mash.new
+ cpu[name][:status] = status
+ cpu[name][:location] = location
+ if status =~ /Available/
+ cpu[:available] += 1
+ lsattr = from("lsattr -El #{name}").lines
+ lsattr.each do |attribute|
+ attrib, value = attribute.split
+ cpu[name][attrib] = value
+ end
+ end
+end
+
+# Every AIX system has proc0.
+cpu[:model] = cpu[:proc0][:type]
+cpu[:mhz] = cpu[:proc0][:frequency].to_i / 1024
diff --git a/lib/ohai/plugins/aix/hostname.rb b/lib/ohai/plugins/aix/hostname.rb
index 805b4734..4cf25ba8 100644
--- a/lib/ohai/plugins/aix/hostname.rb
+++ b/lib/ohai/plugins/aix/hostname.rb
@@ -16,4 +16,6 @@
# limitations under the License.
#
-require_plugin "sigar::hostname"
+provides "hostname"
+
+hostname from("hostname")
diff --git a/lib/ohai/plugins/aix/kernel.rb b/lib/ohai/plugins/aix/kernel.rb
new file mode 100644
index 00000000..e76e6e35
--- /dev/null
+++ b/lib/ohai/plugins/aix/kernel.rb
@@ -0,0 +1,27 @@
+#
+# Author:: Joshua Timberman <joshua@opscode.com>
+# Copyright:: Copyright (c) 2013 Opscode, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+provides "kernel"
+
+kernel Mash.new
+
+kernel[:name] = from("uname -s").downcase
+kernel[:release] = from("uname -r")
+kernel[:version] = from("uname -v")
+kernel[:machine] = from("uname -p")
+kernel[:modules] = Mash.new
diff --git a/lib/ohai/plugins/aix/memory.rb b/lib/ohai/plugins/aix/memory.rb
index dd3532fb..88f1c5b8 100644
--- a/lib/ohai/plugins/aix/memory.rb
+++ b/lib/ohai/plugins/aix/memory.rb
@@ -1,6 +1,6 @@
#
-# Author:: Doug MacEachern <dougm@vmware.com>
-# Copyright:: Copyright (c) 2010 VMware, Inc.
+# Author:: Joshua Timberman <joshua@opscode.com>
+# Copyright:: Copyright (c) 2013, Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,4 +16,9 @@
# limitations under the License.
#
-require_plugin "sigar::memory"
+provides "memory"
+
+memory = Mash.new
+
+meminfo = from("svmon -G -O unit=MB,summary=longreal | grep '[0-9]'")
+memory[:total], u, memory[:free] = meminfo.split
diff --git a/lib/ohai/plugins/aix/platform.rb b/lib/ohai/plugins/aix/platform.rb
index bea329d6..5f29c2fd 100644
--- a/lib/ohai/plugins/aix/platform.rb
+++ b/lib/ohai/plugins/aix/platform.rb
@@ -1,6 +1,6 @@
#
-# Author:: Doug MacEachern <dougm@vmware.com>
-# Copyright:: Copyright (c) 2010 VMware, Inc.
+# Author:: Joshua Timberman <joshua@opscode.com>
+# Copyright:: Copyright (c) 2013, Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,4 +16,10 @@
# limitations under the License.
#
-require_plugin "sigar::platform"
+require_plugin "#{os}::kernel"
+
+provides "platform", "platform_version", "platform_family"
+
+platform kernel[:name]
+platform_version [kernel[:version], kernel[:release]].join(".")
+platform_family platform