ohai 8.10.0 → 8.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Rakefile +13 -4
- data/bin/ohai +3 -4
- data/lib/ohai.rb +4 -4
- data/lib/ohai/application.rb +7 -6
- data/lib/ohai/common/dmi.rb +56 -56
- data/lib/ohai/config.rb +12 -8
- data/lib/ohai/dsl.rb +3 -3
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/dsl/plugin/versionvi.rb +0 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -0
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +7 -7
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/mash.rb +3 -2
- data/lib/ohai/mixin/command.rb +25 -23
- data/lib/ohai/mixin/dmi_decode.rb +10 -10
- data/lib/ohai/mixin/ec2_metadata.rb +40 -39
- data/lib/ohai/mixin/gce_metadata.rb +9 -9
- data/lib/ohai/mixin/network_constants.rb +1 -1
- data/lib/ohai/mixin/os.rb +3 -3
- data/lib/ohai/mixin/seconds_to_human.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +10 -10
- data/lib/ohai/mixin/string.rb +2 -2
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +2 -2
- data/lib/ohai/plugins/aix/filesystem.rb +2 -2
- data/lib/ohai/plugins/aix/memory.rb +2 -2
- data/lib/ohai/plugins/aix/network.rb +9 -10
- data/lib/ohai/plugins/aix/os.rb +2 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -3
- data/lib/ohai/plugins/aix/virtualization.rb +23 -23
- data/lib/ohai/plugins/azure.rb +32 -5
- data/lib/ohai/plugins/bsd/virtualization.rb +22 -22
- data/lib/ohai/plugins/c.rb +3 -3
- data/lib/ohai/plugins/chef.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +59 -60
- data/lib/ohai/plugins/cloud_v2.rb +37 -39
- data/lib/ohai/plugins/darwin/cpu.rb +1 -1
- data/lib/ohai/plugins/darwin/filesystem2.rb +5 -5
- data/lib/ohai/plugins/darwin/memory.rb +5 -6
- data/lib/ohai/plugins/darwin/network.rb +7 -7
- data/lib/ohai/plugins/darwin/system_profiler.rb +32 -33
- data/lib/ohai/plugins/darwin/virtualization.rb +9 -9
- data/lib/ohai/plugins/digital_ocean.rb +16 -16
- data/lib/ohai/plugins/dmi.rb +6 -6
- data/lib/ohai/plugins/dragonflybsd/cpu.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/memory.rb +0 -1
- data/lib/ohai/plugins/dragonflybsd/network.rb +4 -4
- data/lib/ohai/plugins/dragonflybsd/os.rb +1 -1
- data/lib/ohai/plugins/ec2.rb +39 -15
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +16 -12
- data/lib/ohai/plugins/freebsd/cpu.rb +2 -2
- data/lib/ohai/plugins/freebsd/memory.rb +0 -1
- data/lib/ohai/plugins/freebsd/network.rb +4 -4
- data/lib/ohai/plugins/freebsd/os.rb +1 -1
- data/lib/ohai/plugins/gce.rb +6 -6
- data/lib/ohai/plugins/hostname.rb +7 -7
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/ip_scopes.rb +9 -9
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/joyent.rb +7 -7
- data/lib/ohai/plugins/kernel.rb +8 -8
- data/lib/ohai/plugins/linode.rb +7 -4
- data/lib/ohai/plugins/linux/cpu.rb +5 -5
- data/lib/ohai/plugins/linux/filesystem.rb +16 -16
- data/lib/ohai/plugins/linux/filesystem2.rb +15 -15
- data/lib/ohai/plugins/linux/mdadm.rb +3 -3
- data/lib/ohai/plugins/linux/network.rb +85 -51
- data/lib/ohai/plugins/linux/platform.rb +24 -24
- data/lib/ohai/plugins/linux/virtualization.rb +8 -8
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/netbsd/cpu.rb +1 -1
- data/lib/ohai/plugins/netbsd/network.rb +2 -2
- data/lib/ohai/plugins/network.rb +11 -11
- data/lib/ohai/plugins/network_listeners.rb +30 -26
- data/lib/ohai/plugins/ohai.rb +3 -3
- data/lib/ohai/plugins/openbsd/cpu.rb +4 -4
- data/lib/ohai/plugins/openbsd/memory.rb +4 -4
- data/lib/ohai/plugins/openbsd/network.rb +3 -3
- data/lib/ohai/plugins/openstack.rb +12 -12
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +22 -22
- data/lib/ohai/plugins/passwd.rb +4 -4
- data/lib/ohai/plugins/powershell.rb +9 -9
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -13
- data/lib/ohai/plugins/root_group.rb +4 -4
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/sigar/cpu.rb +1 -1
- data/lib/ohai/plugins/sigar/filesystem.rb +1 -1
- data/lib/ohai/plugins/sigar/network.rb +13 -13
- data/lib/ohai/plugins/sigar/network_route.rb +34 -29
- data/lib/ohai/plugins/softlayer.rb +8 -7
- data/lib/ohai/plugins/solaris2/cpu.rb +19 -19
- data/lib/ohai/plugins/solaris2/dmi.rb +63 -63
- data/lib/ohai/plugins/solaris2/filesystem.rb +13 -13
- data/lib/ohai/plugins/solaris2/memory.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +5 -5
- data/lib/ohai/plugins/solaris2/virtualization.rb +18 -18
- data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -5
- data/lib/ohai/plugins/virtualbox.rb +2 -2
- data/lib/ohai/plugins/virtualization.rb +17 -17
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/cpu.rb +14 -14
- data/lib/ohai/plugins/windows/drivers.rb +8 -8
- data/lib/ohai/plugins/windows/filesystem.rb +4 -4
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +10 -10
- data/lib/ohai/plugins/windows/platform.rb +1 -2
- data/lib/ohai/plugins/windows/virtualization.rb +17 -17
- data/lib/ohai/provides_map.rb +7 -7
- data/lib/ohai/runner.rb +3 -3
- data/lib/ohai/system.rb +21 -20
- data/lib/ohai/util/file_helper.rb +1 -2
- data/lib/ohai/util/ip_helper.rb +4 -4
- data/lib/ohai/util/win32.rb +5 -5
- data/lib/ohai/util/win32/group_helper.rb +4 -5
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +7 -5
- data/spec/functional/application_spec.rb +23 -23
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +13 -13
- data/spec/functional/plugins/root_group_spec.rb +5 -5
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -9
- data/spec/support/integration_helper.rb +7 -7
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/unit/application_spec.rb +17 -17
- data/spec/unit/config_spec.rb +2 -2
- data/spec/unit/dsl/plugin_spec.rb +28 -28
- data/spec/unit/hints_spec.rb +3 -3
- data/spec/unit/loader_spec.rb +9 -9
- data/spec/unit/mixin/command_spec.rb +5 -5
- data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
- data/spec/unit/mixin/softlayer_metadata_spec.rb +19 -23
- data/spec/unit/plugin_config_spec.rb +5 -5
- data/spec/unit/plugins/abort_spec.rb +3 -3
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +25 -25
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -2
- data/spec/unit/plugins/aix/kernel_spec.rb +3 -3
- data/spec/unit/plugins/aix/memory_spec.rb +8 -8
- data/spec/unit/plugins/aix/network_spec.rb +38 -38
- data/spec/unit/plugins/aix/os_spec.rb +1 -2
- data/spec/unit/plugins/aix/platform_spec.rb +1 -1
- data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +11 -11
- data/spec/unit/plugins/azure_spec.rb +118 -20
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +4 -4
- data/spec/unit/plugins/c_spec.rb +12 -12
- data/spec/unit/plugins/chef_spec.rb +2 -2
- data/spec/unit/plugins/cloud_spec.rb +37 -37
- data/spec/unit/plugins/cloud_v2_spec.rb +64 -65
- data/spec/unit/plugins/darwin/cpu_spec.rb +1 -2
- data/spec/unit/plugins/darwin/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -4
- data/spec/unit/plugins/darwin/kernel_spec.rb +6 -10
- data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
- data/spec/unit/plugins/darwin/network_spec.rb +352 -353
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -2
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +3 -3
- data/spec/unit/plugins/darwin/virtualization_spec.rb +6 -6
- data/spec/unit/plugins/digital_ocean_spec.rb +38 -37
- data/spec/unit/plugins/dmi_spec.rb +3 -3
- data/spec/unit/plugins/ec2_spec.rb +97 -88
- data/spec/unit/plugins/elixir_spec.rb +1 -2
- data/spec/unit/plugins/erlang_spec.rb +2 -2
- data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
- data/spec/unit/plugins/fail_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/cpu_spec.rb +14 -14
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -3
- data/spec/unit/plugins/freebsd/os_spec.rb +4 -5
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/gce_spec.rb +9 -9
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -2
- data/spec/unit/plugins/hostname_spec.rb +1 -2
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/ip_scopes_spec.rb +38 -38
- data/spec/unit/plugins/java_spec.rb +52 -1
- data/spec/unit/plugins/joyent_spec.rb +9 -11
- data/spec/unit/plugins/kernel_spec.rb +11 -12
- data/spec/unit/plugins/linode_spec.rb +29 -29
- data/spec/unit/plugins/linux/block_device_spec.rb +21 -21
- data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
- data/spec/unit/plugins/linux/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/linux/filesystem_spec.rb +85 -86
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -3
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +1 -2
- data/spec/unit/plugins/linux/mdadm_spec.rb +4 -4
- data/spec/unit/plugins/linux/memory_spec.rb +29 -33
- data/spec/unit/plugins/linux/network_spec.rb +463 -245
- data/spec/unit/plugins/linux/platform_spec.rb +64 -65
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -2
- data/spec/unit/plugins/linux/virtualization_spec.rb +42 -42
- data/spec/unit/plugins/lua_spec.rb +1 -2
- data/spec/unit/plugins/mono_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +118 -118
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/openstack_spec.rb +35 -37
- data/spec/unit/plugins/os_spec.rb +7 -8
- data/spec/unit/plugins/packages_spec.rb +118 -118
- data/spec/unit/plugins/passwd_spec.rb +18 -18
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +4 -4
- data/spec/unit/plugins/platform_spec.rb +8 -9
- data/spec/unit/plugins/powershell_spec.rb +3 -3
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +66 -68
- data/spec/unit/plugins/root_group_spec.rb +26 -26
- data/spec/unit/plugins/ruby_spec.rb +14 -15
- data/spec/unit/plugins/rust_spec.rb +2 -2
- data/spec/unit/plugins/sigar/network_route_spec.rb +36 -36
- data/spec/unit/plugins/softlayer_spec.rb +10 -10
- data/spec/unit/plugins/solaris2/cpu_spec.rb +20 -21
- data/spec/unit/plugins/solaris2/dmi_spec.rb +5 -6
- data/spec/unit/plugins/solaris2/filesystem.rb +5 -5
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/memory_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/network_spec.rb +7 -8
- data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +3 -5
- data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +19 -19
- data/spec/unit/plugins/vmware_spec.rb +28 -28
- data/spec/unit/plugins/windows/cpu_spec.rb +46 -48
- data/spec/unit/plugins/windows/memory_spec.rb +5 -5
- data/spec/unit/plugins/windows/virtualization_spec.rb +163 -163
- data/spec/unit/provides_map_spec.rb +10 -10
- data/spec/unit/runner_spec.rb +10 -10
- data/spec/unit/system_spec.rb +19 -19
- data/spec/unit/util/file_helper_spec.rb +5 -6
- data/spec/unit/util/ip_helper_spec.rb +39 -39
- metadata +31 -4
@@ -22,9 +22,9 @@ Ohai.plugin(:Virtualization) do
|
|
22
22
|
provides "virtualization"
|
23
23
|
|
24
24
|
def collect_solaris_guestid
|
25
|
-
command =
|
25
|
+
command = "/usr/sbin/zoneadm list -p"
|
26
26
|
so = shell_out(command)
|
27
|
-
so.stdout.split(
|
27
|
+
so.stdout.split(":").first
|
28
28
|
end
|
29
29
|
|
30
30
|
collect_data(:solaris2) do
|
@@ -41,7 +41,7 @@ Ohai.plugin(:Virtualization) do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# http://www.dmo.ca/blog/detecting-virtualization-on-linux
|
44
|
-
smbios_path= Ohai.abs_path( "/usr/sbin/smbios" )
|
44
|
+
smbios_path = Ohai.abs_path( "/usr/sbin/smbios" )
|
45
45
|
if File.exists?(smbios_path)
|
46
46
|
so = shell_out(smbios_path)
|
47
47
|
case so.stdout
|
@@ -60,32 +60,32 @@ Ohai.plugin(:Virtualization) do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
if File.executable?(
|
63
|
+
if File.executable?("/usr/sbin/zoneadm")
|
64
64
|
zones = Mash.new
|
65
65
|
so = shell_out("zoneadm list -pc")
|
66
66
|
so.stdout.lines do |line|
|
67
67
|
info = line.chomp.split(/:/)
|
68
68
|
zones[info[1]] = {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
"id" => info[0],
|
70
|
+
"state" => info[2],
|
71
|
+
"root" => info[3],
|
72
|
+
"uuid" => info[4],
|
73
|
+
"brand" => info[5],
|
74
|
+
"ip" => info[6],
|
75
75
|
}
|
76
76
|
end
|
77
77
|
|
78
|
-
if
|
78
|
+
if zones.length == 1
|
79
79
|
first_zone = zones.keys[0]
|
80
|
-
unless( first_zone ==
|
81
|
-
virtualization[:system] =
|
82
|
-
virtualization[:role] =
|
83
|
-
virtualization[:guest_uuid] = zones[first_zone][
|
80
|
+
unless( first_zone == "global")
|
81
|
+
virtualization[:system] = "zone"
|
82
|
+
virtualization[:role] = "guest"
|
83
|
+
virtualization[:guest_uuid] = zones[first_zone]["uuid"]
|
84
84
|
virtualization[:guest_id] = collect_solaris_guestid
|
85
85
|
end
|
86
|
-
elsif
|
87
|
-
virtualization[:system] =
|
88
|
-
virtualization[:role] =
|
86
|
+
elsif zones.length > 1
|
87
|
+
virtualization[:system] = "zone"
|
88
|
+
virtualization[:role] = "host"
|
89
89
|
virtualization[:guests] = zones
|
90
90
|
end
|
91
91
|
end
|
@@ -39,7 +39,7 @@ Ohai.plugin(:Zpools) do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
# Grab individual health for devices in the zpools
|
42
|
-
|
42
|
+
pools.keys.each do |pool|
|
43
43
|
pools[pool][:devices] = Mash.new
|
44
44
|
# Run "zpool status" as non-root user (adm) so that
|
45
45
|
# the command won't try to open() each device which can
|
data/lib/ohai/plugins/uptime.rb
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
# limitations under the License.
|
25
25
|
#
|
26
26
|
|
27
|
-
require
|
27
|
+
require "ohai/mixin/seconds_to_human"
|
28
28
|
|
29
29
|
Ohai.plugin(:Uptime) do
|
30
30
|
provides "uptime", "uptime_seconds"
|
@@ -43,7 +43,7 @@ Ohai.plugin(:Uptime) do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
collect_data(:hpux, :default) do
|
46
|
-
require
|
46
|
+
require "sigar"
|
47
47
|
|
48
48
|
sigar = Sigar.new
|
49
49
|
uptime = sigar.uptime.uptime
|
@@ -94,11 +94,10 @@ Ohai.plugin(:Uptime) do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
collect_data(:windows) do
|
97
|
-
require
|
97
|
+
require "wmi-lite/wmi"
|
98
98
|
wmi = WmiLite::Wmi.new
|
99
|
-
uptime_seconds wmi.first_of(
|
99
|
+
uptime_seconds wmi.first_of("Win32_PerfFormattedData_PerfOS_System")["systemuptime"].to_i
|
100
100
|
uptime seconds_to_human(uptime_seconds)
|
101
101
|
end
|
102
102
|
|
103
103
|
end
|
104
|
-
|
@@ -17,10 +17,10 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
Ohai.plugin(:Virtualbox) do
|
20
|
-
provides
|
20
|
+
provides "virtualbox"
|
21
21
|
|
22
22
|
collect_data do
|
23
|
-
so = shell_out(
|
23
|
+
so = shell_out("VBoxControl guestproperty enumerate")
|
24
24
|
if so.exitstatus == 0
|
25
25
|
virtualbox Mash.new
|
26
26
|
virtualbox[:host] = Mash.new
|
@@ -24,31 +24,31 @@ Ohai.plugin(:VirtualizationInfo) do
|
|
24
24
|
collect_data do
|
25
25
|
unless virtualization.nil? || !(virtualization[:role].eql?("host"))
|
26
26
|
begin
|
27
|
-
require
|
28
|
-
require
|
27
|
+
require "libvirt"
|
28
|
+
require "hpricot"
|
29
29
|
|
30
|
-
emu = (virtualization[:system].eql?(
|
31
|
-
virtualization[:libvirt_version] = Libvirt
|
30
|
+
emu = (virtualization[:system].eql?("kvm") ? "qemu" : virtualization[:system])
|
31
|
+
virtualization[:libvirt_version] = Libvirt.version(emu)[0].to_s
|
32
32
|
|
33
|
-
virtconn = Libvirt
|
33
|
+
virtconn = Libvirt.open_read_only("#{emu}:///system")
|
34
34
|
|
35
35
|
virtualization[:uri] = virtconn.uri
|
36
36
|
virtualization[:capabilities] = Mash.new
|
37
|
-
virtualization[:capabilities][:xml_desc] = (virtconn.capabilities.split("\n").collect {|line| line.strip}).join
|
37
|
+
virtualization[:capabilities][:xml_desc] = (virtconn.capabilities.split("\n").collect { |line| line.strip }).join
|
38
38
|
#xdoc = Hpricot virtualization[:capabilities][:xml_desc]
|
39
39
|
|
40
40
|
virtualization[:nodeinfo] = Mash.new
|
41
41
|
ni = virtconn.node_get_info
|
42
|
-
|
42
|
+
%w{cores cpus memory mhz model nodes sockets threads}.each { |a| virtualization[:nodeinfo][a] = ni.send(a) }
|
43
43
|
|
44
44
|
virtualization[:domains] = Mash.new
|
45
45
|
virtconn.list_domains.each do |d|
|
46
46
|
dv = virtconn.lookup_domain_by_id d
|
47
47
|
virtualization[:domains][dv.name] = Mash.new
|
48
48
|
virtualization[:domains][dv.name][:id] = d
|
49
|
-
virtualization[:domains][dv.name][:xml_desc] = (dv.xml_desc.split("\n").collect {|line| line.strip}).join
|
50
|
-
|
51
|
-
|
49
|
+
virtualization[:domains][dv.name][:xml_desc] = (dv.xml_desc.split("\n").collect { |line| line.strip }).join
|
50
|
+
%w{os_type uuid}.each { |a| virtualization[:domains][dv.name][a] = dv.send(a) }
|
51
|
+
%w{cpu_time max_mem memory nr_virt_cpu state}.each { |a| virtualization[:domains][dv.name][a] = dv.info.send(a) }
|
52
52
|
#xdoc = Hpricot virtualization[:domains][dv.name][:xml_desc]
|
53
53
|
|
54
54
|
end
|
@@ -57,8 +57,8 @@ Ohai.plugin(:VirtualizationInfo) do
|
|
57
57
|
virtconn.list_networks.each do |n|
|
58
58
|
nv = virtconn.lookup_network_by_name n
|
59
59
|
virtualization[:networks][n] = Mash.new
|
60
|
-
virtualization[:networks][n][:xml_desc] = (nv.xml_desc.split("\n").collect {|line| line.strip}).join
|
61
|
-
|
60
|
+
virtualization[:networks][n][:xml_desc] = (nv.xml_desc.split("\n").collect { |line| line.strip }).join
|
61
|
+
%w{bridge_name uuid}.each { |a| virtualization[:networks][n][a] = nv.send(a) }
|
62
62
|
#xdoc = Hpricot virtualization[:networks][n][:xml_desc]
|
63
63
|
|
64
64
|
end
|
@@ -67,17 +67,17 @@ Ohai.plugin(:VirtualizationInfo) do
|
|
67
67
|
virtconn.list_storage_pools.each do |pool|
|
68
68
|
sp = virtconn.lookup_storage_pool_by_name pool
|
69
69
|
virtualization[:storage][pool] = Mash.new
|
70
|
-
virtualization[:storage][pool][:xml_desc] = (sp.xml_desc.split("\n").collect {|line| line.strip}).join
|
71
|
-
|
72
|
-
|
70
|
+
virtualization[:storage][pool][:xml_desc] = (sp.xml_desc.split("\n").collect { |line| line.strip }).join
|
71
|
+
%w{autostart uuid}.each { |a| virtualization[:storage][pool][a] = sp.send(a) }
|
72
|
+
%w{allocation available capacity state}.each { |a| virtualization[:storage][pool][a] = sp.info.send(a) }
|
73
73
|
#xdoc = Hpricot virtualization[:storage][pool][:xml_desc]
|
74
74
|
|
75
75
|
virtualization[:storage][pool][:volumes] = Mash.new
|
76
76
|
sp.list_volumes.each do |v|
|
77
77
|
virtualization[:storage][pool][:volumes][v] = Mash.new
|
78
78
|
sv = sp.lookup_volume_by_name v
|
79
|
-
|
80
|
-
|
79
|
+
%w{key name path}.each { |a| virtualization[:storage][pool][:volumes][v][a] = sv.send(a) }
|
80
|
+
%w{allocation capacity type}.each { |a| virtualization[:storage][pool][:volumes][v][a] = sv.info.send(a) }
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
data/lib/ohai/plugins/vmware.rb
CHANGED
@@ -49,7 +49,7 @@ Ohai.plugin(:VMware) do
|
|
49
49
|
# vmware-toolbox-cmd stat <param> commands
|
50
50
|
# Iterate through each parameter supported by the "vwware-toolbox-cmd stat" command, assign value
|
51
51
|
# to attribute "vmware[:<parameter>]"
|
52
|
-
|
52
|
+
%w{hosttime speed sessionid balloon swap memlimit memres cpures cpulimit}.each do |param|
|
53
53
|
vmware[param] = from_cmd("#{vmtools_path} stat #{param}")
|
54
54
|
if vmware[param] =~ /UpdateInfo failed/
|
55
55
|
vmware[param] = nil
|
@@ -58,7 +58,7 @@ Ohai.plugin(:VMware) do
|
|
58
58
|
# vmware-toolbox-cmd <param> status commands
|
59
59
|
# Iterate through each parameter supported by the "vwware-toolbox-cmd status" command, assign value
|
60
60
|
# to attribute "vmware[:<parameter>]"
|
61
|
-
|
61
|
+
%w{upgrade timesync}.each do |param|
|
62
62
|
vmware[param] = from_cmd("#{vmtools_path} #{param} status")
|
63
63
|
end
|
64
64
|
rescue
|
@@ -20,14 +20,14 @@ Ohai.plugin(:CPU) do
|
|
20
20
|
provides "cpu"
|
21
21
|
|
22
22
|
collect_data(:windows) do
|
23
|
-
require
|
23
|
+
require "wmi-lite/wmi"
|
24
24
|
|
25
25
|
cpu Mash.new
|
26
26
|
cores = 0
|
27
27
|
logical_processors = 0
|
28
28
|
|
29
29
|
wmi = WmiLite::Wmi.new
|
30
|
-
processors = wmi.instances_of(
|
30
|
+
processors = wmi.instances_of("Win32_Processor")
|
31
31
|
|
32
32
|
processors.each_with_index do |processor, index|
|
33
33
|
current_cpu = index.to_s
|
@@ -43,23 +43,23 @@ Ohai.plugin(:CPU) do
|
|
43
43
|
#
|
44
44
|
|
45
45
|
begin
|
46
|
-
cpu[current_cpu]["cores"] = processor[
|
47
|
-
cores += processor[
|
46
|
+
cpu[current_cpu]["cores"] = processor["numberofcores"]
|
47
|
+
cores += processor["numberofcores"]
|
48
48
|
rescue NoMethodError => e
|
49
49
|
Ohai::Log.info("Can not find numberofcores property on Win32_Processor. Consider applying this patch: http://support.microsoft.com/kb/932370")
|
50
50
|
cpu[current_cpu]["cores"] = nil
|
51
51
|
end
|
52
52
|
|
53
|
-
logical_processors += processor[
|
54
|
-
cpu[current_cpu]["vendor_id"] = processor[
|
55
|
-
cpu[current_cpu]["family"] = processor[
|
56
|
-
cpu[current_cpu]["model"] = processor[
|
57
|
-
cpu[current_cpu]["stepping"] = processor[
|
58
|
-
? processor[
|
59
|
-
: processor[
|
60
|
-
cpu[current_cpu]["physical_id"] = processor[
|
61
|
-
cpu[current_cpu]["model_name"] = processor[
|
62
|
-
cpu[current_cpu]["mhz"] = processor[
|
53
|
+
logical_processors += processor["numberoflogicalprocessors"]
|
54
|
+
cpu[current_cpu]["vendor_id"] = processor["manufacturer"]
|
55
|
+
cpu[current_cpu]["family"] = processor["family"].to_s
|
56
|
+
cpu[current_cpu]["model"] = processor["revision"].to_s
|
57
|
+
cpu[current_cpu]["stepping"] = processor["stepping"].nil? \
|
58
|
+
? processor["description"].match(/Stepping\s+(\d+)/)[1] \
|
59
|
+
: processor["stepping"]
|
60
|
+
cpu[current_cpu]["physical_id"] = processor["deviceid"]
|
61
|
+
cpu[current_cpu]["model_name"] = processor["description"]
|
62
|
+
cpu[current_cpu]["mhz"] = processor["maxclockspeed"].to_s
|
63
63
|
cpu[current_cpu]["cache_size"] = "#{processor['l2cachesize']} KB"
|
64
64
|
end
|
65
65
|
|
@@ -22,23 +22,23 @@ Ohai.plugin(:Drivers) do
|
|
22
22
|
collect_data(:windows) do
|
23
23
|
if configuration(:enabled)
|
24
24
|
|
25
|
-
require
|
25
|
+
require "wmi-lite/wmi"
|
26
26
|
|
27
27
|
kext = Mash.new
|
28
28
|
pnp_drivers = Mash.new
|
29
29
|
|
30
30
|
wmi = WmiLite::Wmi.new
|
31
31
|
|
32
|
-
drivers = wmi.instances_of(
|
32
|
+
drivers = wmi.instances_of("Win32_PnPSignedDriver")
|
33
33
|
drivers.each do |driver|
|
34
|
-
pnp_drivers[driver[
|
34
|
+
pnp_drivers[driver["deviceid"]] = Mash.new
|
35
35
|
driver.wmi_ole_object.properties_.each do |p|
|
36
|
-
pnp_drivers[driver[
|
36
|
+
pnp_drivers[driver["deviceid"]][p.name.wmi_underscore.to_sym] = driver[p.name.downcase]
|
37
37
|
end
|
38
|
-
if driver[
|
39
|
-
kext[driver[
|
40
|
-
kext[driver[
|
41
|
-
kext[driver[
|
38
|
+
if driver["devicename"]
|
39
|
+
kext[driver["devicename"]] = pnp_drivers[driver["deviceid"]]
|
40
|
+
kext[driver["devicename"]][:version] = pnp_drivers[driver["deviceid"]][:driver_version]
|
41
|
+
kext[driver["devicename"]][:date] = pnp_drivers[driver["deviceid"]][:driver_date] ? pnp_drivers[driver["deviceid"]][:driver_date].to_s[0..7] : nil
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -21,7 +21,7 @@ Ohai.plugin(:Filesystem) do
|
|
21
21
|
|
22
22
|
collect_data(:windows) do
|
23
23
|
|
24
|
-
require
|
24
|
+
require "wmi-lite/wmi"
|
25
25
|
|
26
26
|
fs = Mash.new
|
27
27
|
ld_info = Mash.new
|
@@ -30,10 +30,10 @@ Ohai.plugin(:Filesystem) do
|
|
30
30
|
|
31
31
|
# Grab filesystem data from WMI
|
32
32
|
# Note: we should really be parsing Win32_Volume and Win32_Mapped drive
|
33
|
-
disks = wmi.instances_of(
|
33
|
+
disks = wmi.instances_of("Win32_LogicalDisk")
|
34
34
|
|
35
35
|
disks.each do |disk|
|
36
|
-
filesystem = disk[
|
36
|
+
filesystem = disk["deviceid"]
|
37
37
|
fs[filesystem] = Mash.new
|
38
38
|
ld_info[filesystem] = Mash.new
|
39
39
|
disk.wmi_ole_object.properties_.each do |p|
|
@@ -42,7 +42,7 @@ Ohai.plugin(:Filesystem) do
|
|
42
42
|
fs[filesystem][:kb_size] = ld_info[filesystem][:size].to_i / 1000
|
43
43
|
fs[filesystem][:kb_available] = ld_info[filesystem][:free_space].to_i / 1000
|
44
44
|
fs[filesystem][:kb_used] = fs[filesystem][:kb_size].to_i - fs[filesystem][:kb_available].to_i
|
45
|
-
fs[filesystem][:percent_used]
|
45
|
+
fs[filesystem][:percent_used] = (fs[filesystem][:kb_size].to_i != 0 ? fs[filesystem][:kb_used].to_i * 100 / fs[filesystem][:kb_size].to_i : 0)
|
46
46
|
fs[filesystem][:mount] = ld_info[filesystem][:name]
|
47
47
|
fs[filesystem][:fs_type] = ld_info[filesystem][:file_system].downcase unless ld_info[filesystem][:file_system] == nil
|
48
48
|
fs[filesystem][:volume_name] = ld_info[filesystem][:volume_name]
|
@@ -27,7 +27,7 @@ Ohai.plugin(:Network) do
|
|
27
27
|
|
28
28
|
collect_data(:windows) do
|
29
29
|
|
30
|
-
require
|
30
|
+
require "wmi-lite/wmi"
|
31
31
|
|
32
32
|
iface = Mash.new
|
33
33
|
iface_config = Mash.new
|
@@ -40,11 +40,11 @@ Ohai.plugin(:Network) do
|
|
40
40
|
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa394217%28v=vs.85%29.aspx
|
41
41
|
wmi = WmiLite::Wmi.new
|
42
42
|
|
43
|
-
adapters = wmi.instances_of(
|
43
|
+
adapters = wmi.instances_of("Win32_NetworkAdapterConfiguration")
|
44
44
|
|
45
45
|
adapters.each do |adapter|
|
46
46
|
|
47
|
-
i = adapter[
|
47
|
+
i = adapter["index"]
|
48
48
|
iface_config[i] = Mash.new
|
49
49
|
adapter.wmi_ole_object.properties_.each do |p|
|
50
50
|
iface_config[i][p.name.wmi_underscore.to_sym] = adapter[p.name.downcase]
|
@@ -53,10 +53,10 @@ Ohai.plugin(:Network) do
|
|
53
53
|
|
54
54
|
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa394216(v=vs.85).aspx
|
55
55
|
|
56
|
-
adapters = wmi.instances_of(
|
56
|
+
adapters = wmi.instances_of("Win32_NetworkAdapter")
|
57
57
|
|
58
58
|
adapters.each do |adapter|
|
59
|
-
i = adapter[
|
59
|
+
i = adapter["index"]
|
60
60
|
iface_instance[i] = Mash.new
|
61
61
|
adapter.wmi_ole_object.properties_.each do |p|
|
62
62
|
iface_instance[i][p.name.wmi_underscore.to_sym] = adapter[p.name.downcase]
|
@@ -76,7 +76,7 @@ Ohai.plugin(:Network) do
|
|
76
76
|
ip = iface[cint][:configuration][:ip_address][i]
|
77
77
|
_ip = IPAddress("#{ip}/#{iface[cint][:configuration][:ip_subnet][i]}")
|
78
78
|
iface[cint][:addresses][ip] = Mash.new(
|
79
|
-
:prefixlen => _ip.prefix
|
79
|
+
:prefixlen => _ip.prefix,
|
80
80
|
)
|
81
81
|
if _ip.ipv6?
|
82
82
|
# inet6 address
|
@@ -84,7 +84,7 @@ Ohai.plugin(:Network) do
|
|
84
84
|
iface[cint][:addresses][ip][:scope] = "Link" if ip =~ /^fe80/i
|
85
85
|
else
|
86
86
|
# should be an inet4 address
|
87
|
-
iface[cint][:addresses][ip][:netmask] =
|
87
|
+
iface[cint][:addresses][ip][:netmask] = _ip.netmask.to_s
|
88
88
|
if iface[cint][:configuration][:ip_use_zero_broadcast]
|
89
89
|
iface[cint][:addresses][ip][:broadcast] = _ip.network.to_s
|
90
90
|
else
|
@@ -96,7 +96,7 @@ Ohai.plugin(:Network) do
|
|
96
96
|
# Apparently you can have more than one mac_address? Odd.
|
97
97
|
[iface[cint][:configuration][:mac_address]].flatten.each do |mac_addr|
|
98
98
|
iface[cint][:addresses][mac_addr] = {
|
99
|
-
"family"
|
99
|
+
"family" => "lladdr"
|
100
100
|
}
|
101
101
|
end
|
102
102
|
iface[cint][:mtu] = iface[cint][:configuration][:mtu]
|
@@ -110,7 +110,7 @@ Ohai.plugin(:Network) do
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
cint=nil
|
113
|
+
cint = nil
|
114
114
|
so = shell_out("arp -a")
|
115
115
|
if so.exitstatus == 0
|
116
116
|
so.stdout.lines do |line|
|
@@ -119,7 +119,7 @@ Ohai.plugin(:Network) do
|
|
119
119
|
end
|
120
120
|
next unless iface[cint]
|
121
121
|
if line =~ /^\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+([a-fA-F0-9\:-]+)/
|
122
|
-
iface[cint][:arp][$1] = $2.gsub("-",":").downcase
|
122
|
+
iface[cint][:arp][$1] = $2.gsub("-", ":").downcase
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -19,38 +19,38 @@
|
|
19
19
|
#
|
20
20
|
|
21
21
|
Ohai.plugin(:Virtualization) do
|
22
|
-
provides
|
22
|
+
provides "virtualization"
|
23
23
|
|
24
24
|
collect_data(:windows) do
|
25
|
-
require
|
25
|
+
require "wmi-lite/wmi"
|
26
26
|
|
27
27
|
virtualization Mash.new unless virtualization
|
28
28
|
virtualization[:systems] = Mash.new unless virtualization[:systems]
|
29
29
|
|
30
30
|
# Grab BIOS data from WMI to determine vendor information
|
31
31
|
wmi = WmiLite::Wmi.new
|
32
|
-
bios = wmi.instances_of(
|
32
|
+
bios = wmi.instances_of("Win32_BIOS")
|
33
33
|
|
34
|
-
case bios[0][
|
35
|
-
when
|
36
|
-
virtualization[:system] =
|
37
|
-
virtualization[:role] =
|
38
|
-
virtualization[:systems][:vbox] =
|
39
|
-
when
|
40
|
-
virtualization[:system] =
|
41
|
-
virtualization[:role] =
|
42
|
-
virtualization[:systems][:parallels] =
|
43
|
-
when
|
34
|
+
case bios[0]["manufacturer"]
|
35
|
+
when "innotek GmbH"
|
36
|
+
virtualization[:system] = "vbox"
|
37
|
+
virtualization[:role] = "guest"
|
38
|
+
virtualization[:systems][:vbox] = "guest"
|
39
|
+
when "Parallels Software International Inc."
|
40
|
+
virtualization[:system] = "parallels"
|
41
|
+
virtualization[:role] = "guest"
|
42
|
+
virtualization[:systems][:parallels] = "guest"
|
43
|
+
when "Bochs"
|
44
44
|
virtualization[:system] = "kvm"
|
45
45
|
virtualization[:role] = "guest"
|
46
46
|
virtualization[:systems][:kvm] = "guest"
|
47
47
|
end
|
48
48
|
|
49
49
|
# vmware fusion detection
|
50
|
-
if bios[0][
|
51
|
-
virtualization[:system] =
|
52
|
-
virtualization[:role] =
|
53
|
-
virtualization[:systems][:vmware] =
|
50
|
+
if bios[0]["serialnumber"] =~ /VMware/
|
51
|
+
virtualization[:system] = "vmware"
|
52
|
+
virtualization[:role] = "guest"
|
53
|
+
virtualization[:systems][:vmware] = "guest"
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|