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
@@ -16,44 +16,49 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require
|
19
|
+
require "ohai/mixin/network_constants"
|
20
20
|
|
21
21
|
Ohai.plugin(:NetworkRoutes) do
|
22
|
-
|
22
|
+
begin
|
23
|
+
require "sigar"
|
23
24
|
|
24
|
-
|
25
|
-
depends "network/interfaces"
|
25
|
+
include Ohai::Mixin::NetworkConstants
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
provides "network/interfaces/adapters/route"
|
28
|
+
depends "network/interfaces"
|
29
|
+
|
30
|
+
def flags(flags)
|
31
|
+
f = ""
|
32
|
+
if (flags & Sigar::RTF_UP) != 0
|
33
|
+
f += "U"
|
34
|
+
end
|
35
|
+
if (flags & Sigar::RTF_GATEWAY) != 0
|
36
|
+
f += "G"
|
37
|
+
end
|
38
|
+
if (flags & Sigar::RTF_HOST) != 0
|
39
|
+
f += "H"
|
40
|
+
end
|
41
|
+
f
|
37
42
|
end
|
38
|
-
f
|
39
|
-
end
|
40
43
|
|
41
|
-
|
42
|
-
|
43
|
-
sigar = Sigar.new
|
44
|
+
collect_data(:default) do
|
45
|
+
sigar = Sigar.new
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
sigar.net_route_list.each do |route|
|
48
|
+
next unless network[:interfaces][route.ifname] # this should never happen
|
49
|
+
network[:interfaces][route.ifname][:route] = Mash.new unless network[:interfaces][route.ifname][:route]
|
50
|
+
route_data = {}
|
51
|
+
Ohai::Mixin::NetworkConstants::SIGAR_ROUTE_METHODS.each do |m|
|
52
|
+
if(m == :flags)
|
53
|
+
route_data[m] = flags(route.send(m))
|
54
|
+
else
|
55
|
+
route_data[m] = route.send(m)
|
56
|
+
end
|
54
57
|
end
|
58
|
+
network[:interfaces][route.ifname][:route][route.destination] = route_data
|
55
59
|
end
|
56
|
-
network[:interfaces][route.ifname][:route][route.destination] = route_data
|
57
60
|
end
|
61
|
+
rescue LoadError
|
62
|
+
Ohai::Log.debug("Could not load sigar gem. Skipping NetworkRoutes plugin")
|
58
63
|
end
|
59
64
|
end
|
@@ -18,12 +18,12 @@
|
|
18
18
|
# See the License for the specific language governing permissions and
|
19
19
|
# limitations under the License.
|
20
20
|
|
21
|
-
require
|
21
|
+
require "ohai/mixin/softlayer_metadata"
|
22
22
|
|
23
23
|
Ohai.plugin(:Softlayer) do
|
24
24
|
include ::Ohai::Mixin::SoftlayerMetadata
|
25
25
|
|
26
|
-
provides
|
26
|
+
provides "softlayer"
|
27
27
|
|
28
28
|
# Identifies the softlayer cloud
|
29
29
|
#
|
@@ -31,17 +31,18 @@ Ohai.plugin(:Softlayer) do
|
|
31
31
|
# true:: If the softlayer cloud can be identified
|
32
32
|
# false:: Otherwise
|
33
33
|
def looks_like_softlayer?
|
34
|
-
hint?(
|
34
|
+
hint?("softlayer")
|
35
35
|
end
|
36
36
|
|
37
37
|
collect_data do
|
38
38
|
# Adds softlayer Mash
|
39
39
|
if looks_like_softlayer?
|
40
|
-
|
40
|
+
Ohai::Log.debug("softlayer plugin: looks_like_softlayer? == true")
|
41
41
|
metadata = fetch_metadata
|
42
42
|
softlayer Mash.new
|
43
|
-
metadata.each { |k,v| softlayer[k] = v } if metadata
|
43
|
+
metadata.each { |k, v| softlayer[k] = v } if metadata
|
44
|
+
else
|
45
|
+
Ohai::Log.debug("softlayer plugin: looks_like_softlayer? == false")
|
44
46
|
end
|
45
|
-
|
46
47
|
end
|
47
|
-
end
|
48
|
+
end
|
@@ -16,13 +16,13 @@
|
|
16
16
|
|
17
17
|
Ohai.plugin(:CPU) do
|
18
18
|
provides "cpu"
|
19
|
-
|
19
|
+
|
20
20
|
collect_data(:solaris2) do
|
21
21
|
cpu Mash.new
|
22
22
|
# This does assume that /usr/bin/kstat is in the path
|
23
23
|
processor_info = shell_out("kstat -p cpu_info").stdout.lines
|
24
|
-
cpu["total"] = 0
|
25
|
-
cpu["sockets"] = 0
|
24
|
+
cpu["total"] = 0
|
25
|
+
cpu["sockets"] = 0
|
26
26
|
cpu["cores"] = 0
|
27
27
|
cpu["corethreads"] = 0
|
28
28
|
cpu["cpustates"] = Mash.new
|
@@ -31,35 +31,35 @@ Ohai.plugin(:CPU) do
|
|
31
31
|
cpucores = Array.new
|
32
32
|
cpusockets = Array.new
|
33
33
|
processor_info.each_with_index do |processor, i|
|
34
|
-
desc,instance,record,keyvalue = processor.split(":")
|
34
|
+
desc, instance, record, keyvalue = processor.split(":")
|
35
35
|
cpu[instance] ||= Mash.new
|
36
|
-
if
|
37
|
-
|
38
|
-
|
39
|
-
end
|
36
|
+
if currentcpu != instance
|
37
|
+
cpu["total"] += 1
|
38
|
+
currentcpu = instance
|
39
|
+
end
|
40
40
|
kv = keyvalue.split(/\s+/)
|
41
41
|
key = kv.shift
|
42
42
|
value = kv.join(" ").chomp
|
43
43
|
case key
|
44
44
|
when /chip_id/
|
45
|
-
|
46
|
-
|
45
|
+
cpu[instance]["socket"] = value
|
46
|
+
cpusockets.push(value) if cpusockets.index(value).nil?
|
47
47
|
when /cpu_type/
|
48
|
-
|
48
|
+
cpu[instance]["arch"] = value
|
49
49
|
when /clock_MHz/
|
50
|
-
|
50
|
+
cpu[instance]["mhz"] = value
|
51
51
|
when /brand/
|
52
|
-
|
52
|
+
cpu[instance]["model_name"] = value.sub(/\s+/, " ")
|
53
53
|
when /^state$/
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
cpu[instance]["state"] = value
|
55
|
+
cpu["cpustates"][value] ||= 0
|
56
|
+
cpu["cpustates"][value] += 1
|
57
57
|
when /core_id/
|
58
|
-
|
58
|
+
cpu[instance]["core_id"] = value
|
59
59
|
# Detect hyperthreading/multithreading
|
60
|
-
|
60
|
+
cpucores.push(value) if cpucores.index(value).nil?
|
61
61
|
when /family|fpu_type|model|stepping|vendor_id/
|
62
|
-
|
62
|
+
cpu[instance][key] = value
|
63
63
|
end
|
64
64
|
end
|
65
65
|
cpu["cores"] = cpucores.size
|
@@ -6,9 +6,9 @@
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -20,72 +20,72 @@ Ohai.plugin(:DMI) do
|
|
20
20
|
provides "dmi"
|
21
21
|
|
22
22
|
collect_data(:solaris2) do
|
23
|
-
require
|
23
|
+
require "ohai/common/dmi"
|
24
24
|
|
25
25
|
# if we already have a "dmi" with keys (presumably from dmidecode), don't try smbios
|
26
26
|
# note that a single key just means dmidecode exited with its version
|
27
|
-
if (dmi.class.to_s ==
|
28
|
-
Ohai::Log.debug(
|
27
|
+
if (dmi.class.to_s == "Mash") and (dmi.keys.length > 1)
|
28
|
+
Ohai::Log.debug("skipping smbios output, since DMI information has already been provided")
|
29
29
|
return
|
30
30
|
end
|
31
31
|
|
32
32
|
dmi Mash.new
|
33
33
|
|
34
|
-
# bad Solaris shows strings defined by system instead of SMB IDs
|
34
|
+
# bad Solaris shows strings defined by system instead of SMB IDs
|
35
35
|
# this is what the *real* IDs are:
|
36
36
|
# pulled from http://src.opensolaris.org/source/xref/nwam/nwam1/usr/src/uts/common/sys/smbios.h
|
37
37
|
smb_to_id = {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
38
|
+
"SMB_TYPE_BIOS" => 0, # BIOS information (R)
|
39
|
+
"SMB_TYPE_SYSTEM" => 1, # system information (R)
|
40
|
+
"SMB_TYPE_BASEBOARD" => 2, # base board
|
41
|
+
"SMB_TYPE_CHASSIS" => 3, # system enclosure or chassis (R)
|
42
|
+
"SMB_TYPE_PROCESSOR" => 4, # processor (R)
|
43
|
+
"SMB_TYPE_MEMCTL" => 5, # memory controller (O)
|
44
|
+
"SMB_TYPE_MEMMOD" => 6, # memory module (O)
|
45
|
+
"SMB_TYPE_CACHE" => 7, # processor cache (R)
|
46
|
+
"SMB_TYPE_PORT" => 8, # port connector
|
47
|
+
"SMB_TYPE_SLOT" => 9, # upgradeable system slot (R)
|
48
|
+
"SMB_TYPE_OBDEVS" => 10, # on-board devices
|
49
|
+
"SMB_TYPE_OEMSTR" => 11, # OEM string table
|
50
|
+
"SMB_TYPE_SYSCONFSTR" => 12, # system configuration string table
|
51
|
+
"SMB_TYPE_LANG" => 13, # BIOS language information
|
52
|
+
"SMB_TYPE_GROUP" => 14, # group associations
|
53
|
+
"SMB_TYPE_EVENTLOG" => 15, # system event log
|
54
|
+
"SMB_TYPE_MEMARRAY" => 16, # physical memory array (R)
|
55
|
+
"SMB_TYPE_MEMDEVICE" => 17, # memory device (R)
|
56
|
+
"SMB_TYPE_MEMERR32" => 18, # 32-bit memory error information
|
57
|
+
"SMB_TYPE_MEMARRAYMAP" => 19, # memory array mapped address (R)
|
58
|
+
"SMB_TYPE_MEMDEVICEMAP" => 20, # memory device mapped address (R)
|
59
|
+
"SMB_TYPE_POINTDEV" => 21, # built-in pointing device
|
60
|
+
"SMB_TYPE_BATTERY" => 22, # portable battery
|
61
|
+
"SMB_TYPE_RESET" => 23, # system reset settings
|
62
|
+
"SMB_TYPE_SECURITY" => 24, # hardware security settings
|
63
|
+
"SMB_TYPE_POWERCTL" => 25, # system power controls
|
64
|
+
"SMB_TYPE_VPROBE" => 26, # voltage probe
|
65
|
+
"SMB_TYPE_COOLDEV" => 27, # cooling device
|
66
|
+
"SMB_TYPE_TPROBE" => 28, # temperature probe
|
67
|
+
"SMB_TYPE_IPROBE" => 29, # current probe
|
68
|
+
"SMB_TYPE_OOBRA" => 30, # out-of-band remote access facility
|
69
|
+
"SMB_TYPE_BIS" => 31, # boot integrity services
|
70
|
+
"SMB_TYPE_BOOT" => 32, # system boot status (R)
|
71
|
+
"SMB_TYPE_MEMERR64" => 33, # 64-bit memory error information
|
72
|
+
"SMB_TYPE_MGMTDEV" => 34, # management device
|
73
|
+
"SMB_TYPE_MGMTDEVCP" => 35, # management device component
|
74
|
+
"SMB_TYPE_MGMTDEVDATA" => 36, # management device threshold data
|
75
|
+
"SMB_TYPE_MEMCHAN" => 37, # memory channel
|
76
|
+
"SMB_TYPE_IPMIDEV" => 38, # IPMI device information
|
77
|
+
"SMB_TYPE_POWERSUP" => 39, # system power supply
|
78
|
+
"SMB_TYPE_ADDINFO" => 40, # additional information
|
79
|
+
"SMB_TYPE_OBDEVEXT" => 41, # on-board device extended info
|
80
|
+
"SMB_TYPE_MCHI" => 42, # mgmt controller host interface
|
81
|
+
"SMB_TYPE_INACTIVE" => 126, # inactive table entry
|
82
|
+
"SMB_TYPE_EOT" => 127, # end of table
|
83
|
+
"SMB_TYPE_OEM_LO" => 128, # start of OEM-specific type range
|
84
|
+
"SUN_OEM_EXT_PROCESSOR" => 132, # processor extended info
|
85
|
+
"SUN_OEM_PCIEXRC" => 138, # PCIE RootComplex/RootPort info
|
86
|
+
"SUN_OEM_EXT_MEMARRAY" => 144, # phys memory array extended info
|
87
|
+
"SUN_OEM_EXT_MEMDEVICE" => 145, # memory device extended info
|
88
|
+
"SMB_TYPE_OEM_HI" => 256, # end of OEM-specific type range
|
89
89
|
}
|
90
90
|
|
91
91
|
# all output lines should fall within one of these patterns
|
@@ -103,9 +103,9 @@ Ohai.plugin(:DMI) do
|
|
103
103
|
# ==== EXAMPLE: ====
|
104
104
|
# ID SIZE TYPE
|
105
105
|
# 0 40 SMB_TYPE_BIOS (BIOS information)
|
106
|
-
#
|
106
|
+
#
|
107
107
|
# Vendor: HP
|
108
|
-
# Version String: 2.16
|
108
|
+
# Version String: 2.16
|
109
109
|
# ... similar lines trimmed
|
110
110
|
# Characteristics: 0x7fc9da80
|
111
111
|
# SMB_BIOSFL_PCI (PCI is supported)
|
@@ -116,8 +116,8 @@ Ohai.plugin(:DMI) do
|
|
116
116
|
next if blank_line.match(raw_line)
|
117
117
|
|
118
118
|
# remove/replace any characters that don't fall inside permissible ASCII range, or whitespace
|
119
|
-
line = raw_line.gsub(/[^\x20-\x7E\n\t\r]/,
|
120
|
-
if
|
119
|
+
line = raw_line.gsub(/[^\x20-\x7E\n\t\r]/, ".")
|
120
|
+
if line != raw_line
|
121
121
|
Ohai::Log.debug("converted characters from line:\n#{raw_line}")
|
122
122
|
end
|
123
123
|
|
@@ -164,7 +164,7 @@ Ohai.plugin(:DMI) do
|
|
164
164
|
Ohai::Log.debug("unexpected data line found before header; discarding:\n#{line}")
|
165
165
|
next
|
166
166
|
end
|
167
|
-
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][data[1]] =
|
167
|
+
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][data[1]] = ""
|
168
168
|
field = data[1]
|
169
169
|
|
170
170
|
elsif extended_data = extended_data_line.match(line)
|
@@ -177,7 +177,7 @@ Ohai.plugin(:DMI) do
|
|
177
177
|
next
|
178
178
|
end
|
179
179
|
# overwrite "raw" value with a new Mash
|
180
|
-
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][field] = Mash.new unless dmi[dmi_record[:type]][:all_records][dmi_record[:position]][field].class.to_s ==
|
180
|
+
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][field] = Mash.new unless dmi[dmi_record[:type]][:all_records][dmi_record[:position]][field].class.to_s == "Mash"
|
181
181
|
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][field][extended_data[1]] = extended_data[2]
|
182
182
|
|
183
183
|
else
|
@@ -42,10 +42,10 @@ Ohai.plugin(:Filesystem) do
|
|
42
42
|
# Grab file system type from df (must be done separately)
|
43
43
|
so = shell_out("df -na")
|
44
44
|
so.stdout.lines do |line|
|
45
|
-
next unless
|
45
|
+
next unless line =~ /^(.+?)\s*: (\S+)\s*$/
|
46
46
|
mount = $1
|
47
|
-
fs.each { |filesystem,fs_attributes|
|
48
|
-
next unless
|
47
|
+
fs.each { |filesystem, fs_attributes|
|
48
|
+
next unless fs_attributes[:mount] == mount
|
49
49
|
fs[filesystem][:fs_type] = $2
|
50
50
|
}
|
51
51
|
end
|
@@ -53,7 +53,7 @@ Ohai.plugin(:Filesystem) do
|
|
53
53
|
# Grab mount information from /bin/mount
|
54
54
|
so = shell_out("mount")
|
55
55
|
so.stdout.lines do |line|
|
56
|
-
next unless
|
56
|
+
next unless line =~ /^(.+?) on (.+?) (.+?) on (.+?)$/
|
57
57
|
filesystem = $2
|
58
58
|
fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
|
59
59
|
fs[filesystem][:mount] = $1
|
@@ -69,30 +69,30 @@ Ohai.plugin(:Filesystem) do
|
|
69
69
|
if configuration(:zfs_properties).nil? || configuration(:zfs_properties).empty?
|
70
70
|
zfs_get << "all"
|
71
71
|
else
|
72
|
-
zfs_get << [configuration(:zfs_properties)].join(
|
72
|
+
zfs_get << [configuration(:zfs_properties)].join(",")
|
73
73
|
end
|
74
74
|
so = shell_out(zfs_get)
|
75
75
|
so.stdout.lines do |line|
|
76
|
-
next unless
|
76
|
+
next unless line =~ /^([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]+)$/
|
77
77
|
filesystem = $1
|
78
78
|
zfs[filesystem] = Mash.new unless zfs.has_key?(filesystem)
|
79
|
-
zfs[filesystem][:values] = Mash.new unless zfs[filesystem].has_key?(
|
80
|
-
zfs[filesystem][:sources] = Mash.new unless zfs[filesystem].has_key?(
|
79
|
+
zfs[filesystem][:values] = Mash.new unless zfs[filesystem].has_key?("values")
|
80
|
+
zfs[filesystem][:sources] = Mash.new unless zfs[filesystem].has_key?("sources")
|
81
81
|
zfs[filesystem][:values][$2] = $3
|
82
82
|
zfs[filesystem][:sources][$2] = $4.chomp
|
83
83
|
end
|
84
84
|
|
85
85
|
zfs.each { |filesystem, attributes|
|
86
86
|
fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
|
87
|
-
fs[filesystem][:fs_type] =
|
88
|
-
fs[filesystem][:mount] = attributes[:values][:mountpoint] if attributes[:values].has_key?(
|
87
|
+
fs[filesystem][:fs_type] = "zfs"
|
88
|
+
fs[filesystem][:mount] = attributes[:values][:mountpoint] if attributes[:values].has_key?("mountpoint")
|
89
89
|
fs[filesystem][:zfs_values] = attributes[:values]
|
90
90
|
fs[filesystem][:zfs_sources] = attributes[:sources]
|
91
91
|
# find all zfs parents
|
92
|
-
parents = filesystem.split(
|
92
|
+
parents = filesystem.split("/")
|
93
93
|
zfs_parents = []
|
94
|
-
(0
|
95
|
-
next_parent = parents[0
|
94
|
+
(0..parents.length - 1).to_a.each { |parent_indexes|
|
95
|
+
next_parent = parents[0..parent_indexes].join("/")
|
96
96
|
zfs_parents.push(next_parent)
|
97
97
|
}
|
98
98
|
zfs_parents.pop
|
@@ -20,9 +20,9 @@ Ohai.plugin(:Memory) do
|
|
20
20
|
collect_data(:solaris2) do
|
21
21
|
memory Mash.new
|
22
22
|
memory[:swap] = Mash.new
|
23
|
-
meminfo =
|
23
|
+
meminfo = shell_out("prtconf | grep Memory").stdout
|
24
24
|
memory[:total] = "#{meminfo.split[2].to_i * 1024}kB"
|
25
|
-
|
25
|
+
|
26
26
|
tokens = shell_out("swap -s").stdout.strip.split
|
27
27
|
used_swap = tokens[8][0..-1].to_i #strip k from end
|
28
28
|
free_swap = tokens[10][0..-1].to_i #strip k from end
|
@@ -73,14 +73,14 @@ Ohai.plugin(:Network) do
|
|
73
73
|
|
74
74
|
def arpname_to_ifname(iface, arpname)
|
75
75
|
iface.keys.each do |ifn|
|
76
|
-
return ifn if ifn.split(
|
76
|
+
return ifn if ifn.split(":")[0].eql?(arpname)
|
77
77
|
end
|
78
78
|
|
79
79
|
nil
|
80
80
|
end
|
81
81
|
|
82
82
|
collect_data(:solaris2) do
|
83
|
-
require
|
83
|
+
require "scanf"
|
84
84
|
|
85
85
|
iface = Mash.new
|
86
86
|
network Mash.new unless network
|
@@ -98,7 +98,7 @@ Ohai.plugin(:Network) do
|
|
98
98
|
iface[cint][:mtu] = $2
|
99
99
|
iface[cint][:index] = $3
|
100
100
|
if line =~ / flags\=\d+\<((ADDRCONF|ANYCAST|BROADCAST|CoS|DEPRECATED|DHCP|DUPLICATE|FAILED|FIXEDMTU|INACTIVE|L3PROTECT|LOOPBACK|MIP|MULTI_BCAST|MULTICAST|NOARP|NOFAILOVER|NOLOCAL|NONUD|NORTEXCH|NOXMIT|OFFLINE|POINTOPOINT|PREFERRED|PRIVATE|ROUTER|RUNNING|STANDBY|TEMPORARY|UNNUMBERED|UP|VIRTUAL|XRESOLV|IPv4|IPv6|,)+)\>\s/
|
101
|
-
flags = $1.split(
|
101
|
+
flags = $1.split(",")
|
102
102
|
else
|
103
103
|
flags = Array.new
|
104
104
|
end
|
@@ -111,11 +111,11 @@ Ohai.plugin(:Network) do
|
|
111
111
|
end
|
112
112
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask (([0-9a-f]){1,8})\s*$/
|
113
113
|
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
|
114
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf(
|
114
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf("%2x" * 4) * "." }
|
115
115
|
end
|
116
116
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask (([0-9a-f]){1,8}) broadcast (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
|
117
117
|
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
|
118
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf(
|
118
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf("%2x" * 4) * ".", "broadcast" => $4 }
|
119
119
|
end
|
120
120
|
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*)\/(\d+)\s*$/
|
121
121
|
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
|