ohai 16.6.5 → 16.10.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -11
- data/bin/ohai +1 -0
- data/lib/ohai.rb +1 -0
- data/lib/ohai/application.rb +1 -0
- data/lib/ohai/common/dmi.rb +1 -0
- data/lib/ohai/config.rb +1 -0
- data/lib/ohai/dsl.rb +1 -0
- data/lib/ohai/dsl/plugin.rb +2 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -2
- data/lib/ohai/exception.rb +1 -0
- data/lib/ohai/hints.rb +1 -0
- data/lib/ohai/log.rb +1 -0
- data/lib/ohai/mash.rb +1 -0
- data/lib/ohai/mixin/azure_metadata.rb +4 -3
- data/lib/ohai/mixin/chef_utils_wiring.rb +1 -0
- data/lib/ohai/mixin/command.rb +1 -0
- data/lib/ohai/mixin/constant_helper.rb +1 -0
- data/lib/ohai/mixin/dmi_decode.rb +1 -0
- data/lib/ohai/mixin/do_metadata.rb +3 -2
- data/lib/ohai/mixin/ec2_metadata.rb +37 -11
- data/lib/ohai/mixin/gce_metadata.rb +4 -3
- data/lib/ohai/mixin/http_helper.rb +1 -0
- data/lib/ohai/mixin/network_helper.rb +1 -0
- data/lib/ohai/mixin/os.rb +1 -0
- data/lib/ohai/mixin/scaleway_metadata.rb +3 -2
- data/lib/ohai/mixin/seconds_to_human.rb +1 -0
- data/lib/ohai/mixin/shell_out.rb +1 -0
- data/lib/ohai/mixin/softlayer_metadata.rb +2 -1
- data/lib/ohai/mixin/string.rb +1 -0
- data/lib/ohai/mixin/train_helpers.rb +1 -0
- data/lib/ohai/mixin/which.rb +1 -0
- data/lib/ohai/plugin_config.rb +1 -0
- data/lib/ohai/plugins/aix/kernel.rb +7 -4
- data/lib/ohai/plugins/aix/memory.rb +4 -3
- data/lib/ohai/plugins/aix/network.rb +51 -58
- data/lib/ohai/plugins/aix/platform.rb +3 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -2
- data/lib/ohai/plugins/aix/virtualization.rb +6 -6
- data/lib/ohai/plugins/azure.rb +1 -0
- data/lib/ohai/plugins/bsd/virtualization.rb +2 -1
- data/lib/ohai/plugins/c.rb +4 -3
- data/lib/ohai/plugins/chef.rb +1 -0
- data/lib/ohai/plugins/cloud.rb +2 -1
- data/lib/ohai/plugins/command.rb +1 -0
- data/lib/ohai/plugins/cpu.rb +27 -28
- data/lib/ohai/plugins/darwin/hardware.rb +1 -0
- data/lib/ohai/plugins/darwin/memory.rb +2 -3
- data/lib/ohai/plugins/darwin/network.rb +8 -9
- data/lib/ohai/plugins/darwin/platform.rb +1 -0
- data/lib/ohai/plugins/darwin/virtualization.rb +1 -0
- data/lib/ohai/plugins/digital_ocean.rb +3 -1
- data/lib/ohai/plugins/dmi.rb +5 -4
- data/lib/ohai/plugins/docker.rb +2 -1
- data/lib/ohai/plugins/dragonflybsd/memory.rb +9 -8
- data/lib/ohai/plugins/dragonflybsd/network.rb +1 -0
- data/lib/ohai/plugins/dragonflybsd/platform.rb +3 -2
- data/lib/ohai/plugins/ec2.rb +4 -0
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +1 -0
- data/lib/ohai/plugins/eucalyptus.rb +4 -1
- data/lib/ohai/plugins/filesystem.rb +1 -1
- data/lib/ohai/plugins/fips.rb +1 -0
- data/lib/ohai/plugins/freebsd/memory.rb +9 -8
- data/lib/ohai/plugins/freebsd/network.rb +1 -0
- data/lib/ohai/plugins/freebsd/platform.rb +3 -2
- data/lib/ohai/plugins/gce.rb +1 -0
- data/lib/ohai/plugins/go.rb +1 -1
- data/lib/ohai/plugins/groovy.rb +1 -1
- data/lib/ohai/plugins/grub2.rb +40 -0
- data/lib/ohai/plugins/haskell.rb +1 -0
- data/lib/ohai/plugins/hostname.rb +2 -2
- data/lib/ohai/plugins/init_package.rb +1 -0
- data/lib/ohai/plugins/java.rb +1 -0
- data/lib/ohai/plugins/kernel.rb +7 -8
- data/lib/ohai/plugins/keys.rb +1 -0
- data/lib/ohai/plugins/languages.rb +1 -0
- data/lib/ohai/plugins/libvirt.rb +4 -3
- data/lib/ohai/plugins/linode.rb +22 -14
- data/lib/ohai/plugins/linux/block_device.rb +1 -0
- data/lib/ohai/plugins/linux/hostnamectl.rb +3 -2
- data/lib/ohai/plugins/linux/interrupts.rb +1 -0
- data/lib/ohai/plugins/linux/ipc.rb +1 -0
- data/lib/ohai/plugins/linux/lsb.rb +6 -19
- data/lib/ohai/plugins/linux/lspci.rb +1 -1
- data/lib/ohai/plugins/linux/machineid.rb +1 -0
- data/lib/ohai/plugins/linux/mdadm.rb +1 -0
- data/lib/ohai/plugins/linux/memory.rb +37 -36
- data/lib/ohai/plugins/linux/network.rb +30 -4
- data/lib/ohai/plugins/linux/platform.rb +6 -2
- data/lib/ohai/plugins/linux/selinux.rb +1 -0
- data/lib/ohai/plugins/linux/sessions.rb +1 -0
- data/lib/ohai/plugins/linux/sysctl.rb +1 -0
- data/lib/ohai/plugins/linux/systemd_paths.rb +1 -0
- data/lib/ohai/plugins/linux/virtualization.rb +1 -0
- data/lib/ohai/plugins/lua.rb +1 -1
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/netbsd/memory.rb +1 -0
- data/lib/ohai/plugins/netbsd/network.rb +1 -0
- data/lib/ohai/plugins/netbsd/platform.rb +3 -2
- data/lib/ohai/plugins/network.rb +2 -1
- data/lib/ohai/plugins/nodejs.rb +1 -1
- data/lib/ohai/plugins/ohai.rb +1 -0
- data/lib/ohai/plugins/ohai_time.rb +1 -0
- data/lib/ohai/plugins/openbsd/memory.rb +1 -0
- data/lib/ohai/plugins/openbsd/network.rb +1 -0
- data/lib/ohai/plugins/openbsd/platform.rb +3 -2
- data/lib/ohai/plugins/openstack.rb +1 -0
- data/lib/ohai/plugins/os.rb +2 -1
- data/lib/ohai/plugins/packages.rb +2 -1
- data/lib/ohai/plugins/passwd.rb +2 -1
- data/lib/ohai/plugins/perl.rb +1 -1
- data/lib/ohai/plugins/php.rb +1 -1
- data/lib/ohai/plugins/platform.rb +1 -0
- data/lib/ohai/plugins/powershell.rb +1 -1
- data/lib/ohai/plugins/ps.rb +1 -0
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +6 -5
- data/lib/ohai/plugins/root_group.rb +1 -0
- data/lib/ohai/plugins/ruby.rb +3 -2
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/scala.rb +1 -0
- data/lib/ohai/plugins/scaleway.rb +2 -1
- data/lib/ohai/plugins/scsi.rb +1 -1
- data/lib/ohai/plugins/shard.rb +1 -1
- data/lib/ohai/plugins/shells.rb +1 -0
- data/lib/ohai/plugins/softlayer.rb +1 -0
- data/lib/ohai/plugins/solaris2/dmi.rb +1 -0
- data/lib/ohai/plugins/solaris2/memory.rb +1 -0
- data/lib/ohai/plugins/solaris2/network.rb +2 -1
- data/lib/ohai/plugins/solaris2/platform.rb +6 -12
- data/lib/ohai/plugins/solaris2/virtualization.rb +3 -3
- data/lib/ohai/plugins/ssh_host_key.rb +1 -0
- data/lib/ohai/plugins/sysconf.rb +1 -0
- data/lib/ohai/plugins/timezone.rb +1 -0
- data/lib/ohai/plugins/train.rb +1 -1
- data/lib/ohai/plugins/uptime.rb +2 -1
- data/lib/ohai/plugins/virtualbox.rb +2 -1
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/dmi.rb +1 -0
- data/lib/ohai/plugins/windows/drivers.rb +1 -0
- data/lib/ohai/plugins/windows/memory.rb +1 -0
- data/lib/ohai/plugins/windows/network.rb +2 -1
- data/lib/ohai/plugins/windows/platform.rb +1 -0
- data/lib/ohai/plugins/windows/system_enclosure.rb +1 -0
- data/lib/ohai/plugins/windows/virtualization.rb +1 -0
- data/lib/ohai/plugins/zpools.rb +5 -3
- data/lib/ohai/provides_map.rb +1 -0
- data/lib/ohai/runner.rb +3 -4
- data/lib/ohai/system.rb +1 -0
- data/lib/ohai/train_transport.rb +1 -0
- data/lib/ohai/util/file_helper.rb +1 -0
- data/lib/ohai/util/ip_helper.rb +2 -1
- data/lib/ohai/util/win32.rb +1 -0
- data/lib/ohai/version.rb +2 -1
- data/ohai.gemspec +2 -1
- metadata +14 -14
- data/lib/ohai/plugins/joyent.rb +0 -77
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Joshua Timberman <joshua@chef.io>
|
3
4
|
# Author:: Isa Farnik (<isa@chef.io>)
|
@@ -24,10 +25,10 @@ Ohai.plugin(:Memory) do
|
|
24
25
|
memory Mash.new
|
25
26
|
memory[:swap] = Mash.new
|
26
27
|
|
27
|
-
meminfo = shell_out("svmon -G -O unit=
|
28
|
+
meminfo = shell_out("svmon -G -O unit=KB,summary=longreal | grep '[0-9]'").stdout
|
28
29
|
total_in_mb, _u, free_in_mb = meminfo.split
|
29
|
-
memory[:total] = "#{total_in_mb.to_i
|
30
|
-
memory[:free] = "#{free_in_mb.to_i
|
30
|
+
memory[:total] = "#{total_in_mb.to_i}kB"
|
31
|
+
memory[:free] = "#{free_in_mb.to_i}kB"
|
31
32
|
|
32
33
|
swap_info = shell_out("swap -s").stdout.split # returns swap info in 4K blocks
|
33
34
|
memory[:swap]["total"] = "#{swap_info[2].to_i * 4}kB"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
4
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
@@ -21,7 +22,7 @@
|
|
21
22
|
Ohai.plugin(:Network) do
|
22
23
|
require_relative "../../mixin/network_helper"
|
23
24
|
|
24
|
-
provides "network", "counters/network", "macaddress"
|
25
|
+
provides "network", "network/interfaces", "counters/network", "macaddress"
|
25
26
|
|
26
27
|
include Ohai::Mixin::NetworkHelper
|
27
28
|
|
@@ -37,46 +38,44 @@ Ohai.plugin(:Network) do
|
|
37
38
|
# => state up/down (ifconfig/lsattr)
|
38
39
|
# => arp (arp -an)
|
39
40
|
|
40
|
-
|
41
|
+
ifaces = Mash.new
|
41
42
|
|
42
43
|
network Mash.new unless network
|
43
|
-
network[:interfaces] ||= Mash.new
|
44
44
|
|
45
45
|
# We unfortunately have to do things a bit different here, if ohai is running
|
46
46
|
# within a WPAR. For instance, the WPAR isn't aware of some of its own networking
|
47
|
-
# minutia such as default gateway/route.
|
47
|
+
# minutia such as default gateway/route. lpars return 0 here. wpars return > 0
|
48
48
|
unless shell_out("uname -W").stdout.to_i > 0
|
49
49
|
# :default_interface, :default_gateway - route -n get 0
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
50
|
+
default_line = shell_out("netstat -rn")
|
51
|
+
.stdout
|
52
|
+
.each_line
|
53
|
+
.detect { |l| l.start_with?("default") }
|
54
|
+
.split
|
55
|
+
network[:default_gateway] = default_line[1]
|
56
|
+
network[:default_interface] = default_line[5]
|
58
57
|
end
|
59
58
|
|
60
|
-
# Splits the ifconfig output
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
case lin
|
59
|
+
# Splits the ifconfig output into arrays of interface strings
|
60
|
+
shell_out("ifconfig -a").stdout.split(/\n(?=\w)/).each do |int_lines|
|
61
|
+
int_name, int_data = int_lines.split(":", 2)
|
62
|
+
|
63
|
+
ifaces[int_name] = Mash.new
|
64
|
+
ifaces[int_name][:addresses] ||= Mash.new
|
65
|
+
ifaces[int_name][:state] = (int_data.include?("<UP,") ? "up" : "down")
|
66
|
+
|
67
|
+
int_data.each_line do |line|
|
68
|
+
case line
|
71
69
|
when /flags=\S+<(\S+)>/
|
72
|
-
|
73
|
-
|
70
|
+
ifaces[int_name][:flags] = $1.split(",")
|
71
|
+
ifaces[int_name][:metric] = $1 if line =~ /metric\s(\S+)/
|
74
72
|
else
|
75
73
|
# We have key value pairs.
|
76
|
-
if
|
77
|
-
tmp_addr
|
74
|
+
if line =~ %r{inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(/(\d{1,2}))?}
|
75
|
+
tmp_addr = $1
|
76
|
+
tmp_prefix = $3
|
78
77
|
if tmp_prefix.nil?
|
79
|
-
netmask = hex_to_dec_netmask($1) if
|
78
|
+
netmask = hex_to_dec_netmask($1) if line =~ /netmask\s0x(\S+)\s/
|
80
79
|
unless netmask
|
81
80
|
tmp_prefix ||= "32"
|
82
81
|
netmask = IPAddr.new("255.255.255.255").mask(tmp_prefix.to_i).to_s
|
@@ -85,57 +84,51 @@ Ohai.plugin(:Network) do
|
|
85
84
|
netmask = IPAddr.new("255.255.255.255").mask(tmp_prefix.to_i).to_s
|
86
85
|
end
|
87
86
|
|
88
|
-
|
89
|
-
|
90
|
-
iface[interface][:addresses][tmp_addr][:netmask] = netmask
|
87
|
+
ifaces[int_name][:addresses][tmp_addr] = { "family" => "inet", "prefixlen" => tmp_prefix }
|
88
|
+
ifaces[int_name][:addresses][tmp_addr][:netmask] = netmask
|
91
89
|
|
92
|
-
if
|
93
|
-
|
90
|
+
if line =~ /broadcast\s(\S+)\s/
|
91
|
+
ifaces[int_name][:addresses][tmp_addr][:broadcast] = $1
|
94
92
|
end
|
95
|
-
elsif
|
96
|
-
# TODO do we have more properties on inet6 in aix? broadcast
|
97
|
-
|
98
|
-
|
93
|
+
elsif line =~ %r{inet6 ([a-f0-9\:]+)%?(\d*)/?(\d*)?}
|
94
|
+
# TODO: do we have more properties on inet6 in aix? broadcast
|
95
|
+
ifaces[int_name][:addresses] ||= Mash.new
|
96
|
+
ifaces[int_name][:addresses][$1] = { "family" => "inet6", "zone_index" => $2, "prefixlen" => $3 }
|
99
97
|
else
|
100
|
-
#
|
101
|
-
|
102
|
-
|
103
|
-
(
|
104
|
-
|
98
|
+
# add all key value data into the interface mash
|
99
|
+
# for example "tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1"
|
100
|
+
# has keys tcp_sendspace, tcp_recvspace, and rfc1323
|
101
|
+
line.split.each_slice(2) do |key, value|
|
102
|
+
ifaces[int_name][key] = value
|
105
103
|
end
|
106
104
|
end
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
110
108
|
# Query macaddress
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
iface[interface][:addresses][$1.upcase] = { "family" => "lladdr" }
|
116
|
-
macaddress $1.upcase unless shell_out("uname -W").stdout.to_i > 0
|
117
|
-
end
|
109
|
+
shell_out("entstat -d #{int_name}").stdout =~ /Hardware Address: (\S+)/
|
110
|
+
if $1
|
111
|
+
ifaces[int_name][:addresses][$1.upcase] = { "family" => "lladdr" }
|
112
|
+
macaddress $1.upcase unless shell_out("uname -W").stdout.to_i > 0
|
118
113
|
end
|
119
114
|
end # ifconfig stdout
|
120
115
|
|
121
116
|
# Query routes information
|
122
117
|
%w{inet inet6}.each do |family|
|
123
|
-
|
124
|
-
so_n.stdout.lines.each do |line|
|
118
|
+
shell_out("netstat -nrf #{family}").stdout.each_line do |line|
|
125
119
|
if line =~ /(\S+)\s+(\S+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\S+)/
|
126
120
|
interface = $6
|
127
|
-
|
128
|
-
|
129
|
-
|
121
|
+
ifaces[interface][:routes] ||= []
|
122
|
+
ifaces[interface][:routes] << Mash.new( destination: $1, family: family,
|
123
|
+
via: $2, flags: $3)
|
130
124
|
end
|
131
125
|
end
|
132
126
|
end
|
133
127
|
|
134
128
|
# List the arp entries in system.
|
135
|
-
so = shell_out("arp -an")
|
136
129
|
count = 0
|
137
|
-
|
138
|
-
|
130
|
+
network[:arp] ||= Mash.new
|
131
|
+
shell_out("arp -an").stdout.each_line do |line|
|
139
132
|
if line =~ /\s*(\S+) \((\S+)\) at ([a-fA-F0-9\:]+) \[(\w+)\] stored in bucket/
|
140
133
|
network[:arp][count] ||= Mash.new
|
141
134
|
network[:arp][count][:remote_host] = $1
|
@@ -144,6 +137,6 @@ Ohai.plugin(:Network) do
|
|
144
137
|
count += 1
|
145
138
|
end
|
146
139
|
end
|
147
|
-
network["interfaces"] =
|
140
|
+
network["interfaces"] = ifaces
|
148
141
|
end
|
149
142
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Joshua Timberman <joshua@chef.io>
|
3
4
|
# Author:: Isa Farnik (<isa@chef.io>)
|
@@ -22,8 +23,8 @@ Ohai.plugin(:Platform) do
|
|
22
23
|
depends "kernel"
|
23
24
|
|
24
25
|
collect_data(:aix) do
|
25
|
-
platform
|
26
|
+
platform "aix"
|
27
|
+
platform_family "aix"
|
26
28
|
platform_version [kernel[:version], kernel[:release]].join(".")
|
27
|
-
platform_family platform
|
28
29
|
end
|
29
30
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Kurt Yoder (<ktyopscode@yoderhome.com>)
|
3
4
|
# Author:: Isa Farnik (<isa@chef.io>)
|
@@ -40,9 +41,9 @@ Ohai.plugin(:Uptime) do
|
|
40
41
|
when /^\d+-\d/
|
41
42
|
(d, h, m, s) = so.split(/[-:]/)
|
42
43
|
when /^\d+:\d+:\d/
|
43
|
-
(h, m, s) = so.split(
|
44
|
+
(h, m, s) = so.split(":")
|
44
45
|
else
|
45
|
-
(m, s) = so.split(
|
46
|
+
(m, s) = so.split(":")
|
46
47
|
end
|
47
48
|
elapsed_seconds = ((d.to_i * 86400) + (h.to_i * 3600) + (m.to_i * 60) + s.to_i)
|
48
49
|
|
@@ -23,17 +23,14 @@ Ohai.plugin(:Virtualization) do
|
|
23
23
|
collect_data(:aix) do
|
24
24
|
virtualization Mash.new
|
25
25
|
|
26
|
-
|
27
|
-
lpar_no = so.stdout.split($/)[0].split(/\s/)[0]
|
28
|
-
lpar_name = so.stdout.split($/)[0].split(/\s/)[1]
|
26
|
+
lpar_no, lpar_name = shell_out("uname -L").stdout.split(nil, 2)
|
29
27
|
|
30
28
|
unless lpar_no.to_i == -1 || (lpar_no.to_i == 1 && lpar_name == "NULL")
|
31
29
|
virtualization[:lpar_no] = lpar_no
|
32
30
|
virtualization[:lpar_name] = lpar_name
|
33
31
|
end
|
34
32
|
|
35
|
-
|
36
|
-
wpar_no = so.stdout.split($/)[0]
|
33
|
+
wpar_no = shell_out("uname -W").stdout.strip
|
37
34
|
if wpar_no.to_i > 0
|
38
35
|
virtualization[:wpar_no] = wpar_no
|
39
36
|
else
|
@@ -41,8 +38,11 @@ Ohai.plugin(:Virtualization) do
|
|
41
38
|
so = shell_out("lswpar -L").stdout.scan(/={65}.*?(?:EXPORTED\n\n)+/m)
|
42
39
|
wpars = Mash.new
|
43
40
|
so.each do |wpar|
|
44
|
-
|
41
|
+
wpar_heading = wpar.lines[1].split
|
42
|
+
wpar_name = wpar_heading[0]
|
43
|
+
|
45
44
|
wpars[wpar_name] = Mash.new
|
45
|
+
wpars[wpar_name][:state] = wpar_heading[2].downcase
|
46
46
|
|
47
47
|
wpar.scan(/^[A-Z]{4,}.*?[A-Z\:0-9]$.*?\n\n/m).each do |section|
|
48
48
|
|
data/lib/ohai/plugins/azure.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Bryan McLellan (btm@loftninjas.org)
|
3
4
|
# Copyright:: Copyright (c) 2009 Bryan McLellan
|
@@ -30,7 +31,7 @@ Ohai.plugin(:Virtualization) do
|
|
30
31
|
|
31
32
|
# detect when in a jail or when a jail is actively running (not in stopped state)
|
32
33
|
so = shell_out("sysctl -n security.jail.jailed")
|
33
|
-
if so.stdout.
|
34
|
+
if so.stdout.strip.to_i == 1
|
34
35
|
virtualization[:system] = "jail"
|
35
36
|
virtualization[:role] = "guest"
|
36
37
|
virtualization[:systems][:jail] = "guest"
|
data/lib/ohai/plugins/c.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Doug MacEachern <dougm@vmware.com>
|
3
4
|
# Copyright:: Copyright (c) 2010 VMware, Inc.
|
@@ -122,12 +123,12 @@ Ohai.plugin(:C) do
|
|
122
123
|
end
|
123
124
|
|
124
125
|
def collect_xlc
|
125
|
-
#
|
126
|
-
|
126
|
+
# IBM XL C/C++ for AIX, V13.1.3 (5725-C72, 5765-J07)
|
127
|
+
# Version: 13.01.0003.0000
|
127
128
|
so = shell_out("xlc -qversion")
|
128
129
|
if so.exitstatus == 0 || (so.exitstatus >> 8) == 249
|
129
130
|
description = so.stdout.split($/).first
|
130
|
-
if description =~ /V(\d+\.\d+)/
|
131
|
+
if description =~ /V(\d+\.\d+(.\d+)?)/
|
131
132
|
@c[:xlc] = Mash.new
|
132
133
|
@c[:xlc][:version] = $1
|
133
134
|
@c[:xlc][:description] = description.strip
|
data/lib/ohai/plugins/chef.rb
CHANGED
data/lib/ohai/plugins/cloud.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Cary Penniman (<cary@rightscale.com>)
|
3
4
|
# License:: Apache License, Version 2.0
|
@@ -109,7 +110,7 @@ Ohai.plugin(:Cloud) do
|
|
109
110
|
ipaddr = ""
|
110
111
|
begin
|
111
112
|
ipaddr = IPAddr.new(ip)
|
112
|
-
raise ArgumentError, "not valid #{address_family} address" unless
|
113
|
+
raise ArgumentError, "not valid #{address_family} address" unless address_family == :ipv4 ? ipaddr.ipv4? : ipaddr.ipv6?
|
113
114
|
rescue ArgumentError => e
|
114
115
|
raise "ERROR: the ohai 'cloud' plugin failed with an IP address of '#{ip}' : #{e.message}"
|
115
116
|
end
|
data/lib/ohai/plugins/command.rb
CHANGED
data/lib/ohai/plugins/cpu.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Author:: Bryan McLellan (btm@loftninjas.org)
|
@@ -35,11 +36,9 @@ Ohai.plugin(:CPU) do
|
|
35
36
|
when /CPU:\s+(.+) \(([\d.]+).+\)/
|
36
37
|
cpuinfo["model_name"] = $1
|
37
38
|
cpuinfo["mhz"] = $2
|
38
|
-
when /Features=.+<(.+)>/
|
39
|
+
when /Features=.+<(.+)>/, /Features2=[a-f\dx]+<(.+)>/
|
39
40
|
cpuinfo["flags"].concat($1.downcase.split(","))
|
40
41
|
# Features2=0x80000001<SSE3,<b31>>
|
41
|
-
when /Features2=[a-f\dx]+<(.+)>/
|
42
|
-
cpuinfo["flags"].concat($1.downcase.split(","))
|
43
42
|
else
|
44
43
|
yield(cpuinfo, line)
|
45
44
|
end
|
@@ -86,15 +85,15 @@ Ohai.plugin(:CPU) do
|
|
86
85
|
when /cache size\s+:\s(.+)/
|
87
86
|
cpuinfo[current_cpu]["cache_size"] = $1
|
88
87
|
when /flags\s+:\s(.+)/
|
89
|
-
cpuinfo[current_cpu]["flags"] = $1.split
|
88
|
+
cpuinfo[current_cpu]["flags"] = $1.split
|
90
89
|
when /BogoMIPS\s+:\s(.+)/
|
91
90
|
cpuinfo[current_cpu]["bogomips"] = $1
|
92
91
|
when /Features\s+:\s(.+)/
|
93
|
-
cpuinfo[current_cpu]["features"] = $1.split
|
92
|
+
cpuinfo[current_cpu]["features"] = $1.split
|
94
93
|
when /bogomips per cpu:\s(.+)/
|
95
94
|
cpuinfo["bogomips_per_cpu"] = $1
|
96
95
|
when /features\s+:\s(.+)/
|
97
|
-
cpuinfo["features"] = $1.split
|
96
|
+
cpuinfo["features"] = $1.split
|
98
97
|
when /processor\s(\d):\s(.+)/
|
99
98
|
current_cpu = $1
|
100
99
|
cpu_number += 1
|
@@ -201,7 +200,7 @@ Ohai.plugin(:CPU) do
|
|
201
200
|
end
|
202
201
|
|
203
202
|
so = shell_out("sysctl -n hw.ncpu")
|
204
|
-
info[:total] = so.stdout.
|
203
|
+
info[:total] = so.stdout.strip.to_i
|
205
204
|
cpu info
|
206
205
|
end
|
207
206
|
|
@@ -221,7 +220,7 @@ Ohai.plugin(:CPU) do
|
|
221
220
|
|
222
221
|
[["hw.model", :model_name], ["hw.ncpu", :total], ["hw.cpuspeed", :mhz]].each do |param, node|
|
223
222
|
so = shell_out("sysctl -n #{param}")
|
224
|
-
cpuinfo[node] = so.stdout.
|
223
|
+
cpuinfo[node] = so.stdout.strip
|
225
224
|
end
|
226
225
|
|
227
226
|
cpu cpuinfo
|
@@ -279,7 +278,7 @@ Ohai.plugin(:CPU) do
|
|
279
278
|
when /^machdep.cpu.stepping: (.*)$/
|
280
279
|
cpu[:stepping] = Regexp.last_match[1].to_i
|
281
280
|
when /^machdep.cpu.features: (.*)$/
|
282
|
-
cpu[:flags] = Regexp.last_match[1].downcase.split
|
281
|
+
cpu[:flags] = Regexp.last_match[1].downcase.split
|
283
282
|
end
|
284
283
|
end
|
285
284
|
end
|
@@ -349,25 +348,25 @@ Ohai.plugin(:CPU) do
|
|
349
348
|
key = kv.shift
|
350
349
|
value = kv.join(" ").chomp
|
351
350
|
case key
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
351
|
+
when /chip_id/
|
352
|
+
cpu[instance]["socket"] = value
|
353
|
+
cpusockets.push(value) if cpusockets.index(value).nil?
|
354
|
+
when /cpu_type/
|
355
|
+
cpu[instance]["arch"] = value
|
356
|
+
when /clock_MHz/
|
357
|
+
cpu[instance]["mhz"] = value
|
358
|
+
when /brand/
|
359
|
+
cpu[instance]["model_name"] = value.sub(/\s+/, " ")
|
360
|
+
when /^state$/
|
361
|
+
cpu[instance]["state"] = value
|
362
|
+
cpu["cpustates"][value] ||= 0
|
363
|
+
cpu["cpustates"][value] += 1
|
364
|
+
when /core_id/
|
365
|
+
cpu[instance]["core_id"] = value
|
366
|
+
# Detect hyperthreading/multithreading
|
367
|
+
cpucores.push(value) if cpucores.index(value).nil?
|
368
|
+
when /family|fpu_type|model|stepping|vendor_id/
|
369
|
+
cpu[instance][key] = value
|
371
370
|
end
|
372
371
|
end
|
373
372
|
cpu["cores"] = cpucores.size
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Patrick Collins (<pat@burned.com>)
|
3
4
|
# Copyright:: Copyright (c) Chef Software Inc.
|
@@ -43,9 +44,7 @@ Ohai.plugin(:Memory) do
|
|
43
44
|
megabyte_val = (pages * page_size) / 1024 / 1024.0
|
44
45
|
total_consumed += megabyte_val
|
45
46
|
case match
|
46
|
-
when "wired down"
|
47
|
-
active += megabyte_val.to_i
|
48
|
-
when "active"
|
47
|
+
when "wired down", "active"
|
49
48
|
active += megabyte_val.to_i
|
50
49
|
when "inactive"
|
51
50
|
inactive += megabyte_val.to_i
|