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:: Benjamin Black (<bb@chef.io>)
|
3
4
|
# Copyright:: Copyright (c) Chef Software Inc.
|
@@ -26,7 +27,7 @@ Ohai.plugin(:Network) do
|
|
26
27
|
|
27
28
|
def parse_media(media_string)
|
28
29
|
media = {}
|
29
|
-
line_array = media_string.split
|
30
|
+
line_array = media_string.split
|
30
31
|
|
31
32
|
0.upto(line_array.length - 1) do |i|
|
32
33
|
unless line_array[i].eql?("none")
|
@@ -40,11 +41,9 @@ Ohai.plugin(:Network) do
|
|
40
41
|
else
|
41
42
|
media[line_array[i]]["options"] = $1.split(",")
|
42
43
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
media["autoselect"]["options"] = []
|
47
|
-
end
|
44
|
+
elsif line_array[i].eql?("autoselect")
|
45
|
+
media["autoselect"] = {} unless media.key?("autoselect")
|
46
|
+
media["autoselect"]["options"] = []
|
48
47
|
end
|
49
48
|
else
|
50
49
|
media["none"] = { "options" => [] }
|
@@ -144,15 +143,15 @@ Ohai.plugin(:Network) do
|
|
144
143
|
end
|
145
144
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask 0x(([0-9a-f]){1,8}) broadcast (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
|
146
145
|
iface[cint][:addresses] ||= Mash.new
|
147
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2)
|
146
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2), "broadcast" => $4 }
|
148
147
|
end
|
149
148
|
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*) prefixlen (\d+)\s*/
|
150
149
|
iface[cint][:addresses] ||= Mash.new
|
151
|
-
iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4
|
150
|
+
iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4, "scope" => scope_lookup($1) }
|
152
151
|
end
|
153
152
|
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*) prefixlen (\d+) scopeid 0x([a-f0-9]+)/
|
154
153
|
iface[cint][:addresses] ||= Mash.new
|
155
|
-
iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4
|
154
|
+
iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4, "scope" => scope_lookup($1) }
|
156
155
|
end
|
157
156
|
if line =~ /^\s+media: ((\w+)|(\w+ [a-zA-Z0-9\-\<\>]+)) status: (\w+)/
|
158
157
|
iface[cint][:media] ||= Mash.new
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Dylan Page (<dpage@digitalocean.com>)
|
3
4
|
# Author:: Stafford Brunk (<stafford.brunk@gmail.com>)
|
@@ -48,7 +49,8 @@ Ohai.plugin(:DigitalOcean) do
|
|
48
49
|
false
|
49
50
|
end
|
50
51
|
|
51
|
-
|
52
|
+
# linux and freebsd is all digitalocean supports
|
53
|
+
collect_data(:linux, :freebsd) do
|
52
54
|
if looks_like_digital_ocean?
|
53
55
|
logger.trace("Plugin Digitalocean: looks_like_digital_ocean? == true")
|
54
56
|
digital_ocean Mash.new
|
data/lib/ohai/plugins/dmi.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Kurt Yoder (ktyopscode@yoderhome.com)
|
3
4
|
# Copyright:: Copyright (c) 2010 Kurt Yoder
|
@@ -92,14 +93,14 @@ Ohai.plugin(:DMI) do
|
|
92
93
|
field = nil
|
93
94
|
|
94
95
|
elsif ( type = type_line.match(line) )
|
95
|
-
if dmi_record
|
96
|
+
if dmi_record.nil?
|
96
97
|
logger.trace("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
|
97
98
|
next
|
98
99
|
end
|
99
100
|
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][:application_identifier] = type[1]
|
100
101
|
|
101
102
|
elsif ( data = data_line.match(line) )
|
102
|
-
if dmi_record
|
103
|
+
if dmi_record.nil?
|
103
104
|
logger.trace("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
|
104
105
|
next
|
105
106
|
end
|
@@ -107,11 +108,11 @@ Ohai.plugin(:DMI) do
|
|
107
108
|
field = data[1]
|
108
109
|
|
109
110
|
elsif ( extended_data = extended_data_line.match(line) )
|
110
|
-
if dmi_record
|
111
|
+
if dmi_record.nil?
|
111
112
|
logger.trace("Plugin DMI: unexpected extended data line found before header; discarding:\n#{line}")
|
112
113
|
next
|
113
114
|
end
|
114
|
-
if field
|
115
|
+
if field.nil?
|
115
116
|
logger.trace("Plugin DMI: unexpected extended data line found outside data section; discarding:\n#{line}")
|
116
117
|
next
|
117
118
|
end
|
data/lib/ohai/plugins/docker.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Copyright:: Copyright (c) Chef Software Inc.
|
3
4
|
# License:: Apache License, Version 2.0
|
@@ -47,7 +48,7 @@ Ohai.plugin(:Docker) do
|
|
47
48
|
docker[:swarm] = shellout_data["Swarm"]
|
48
49
|
end
|
49
50
|
|
50
|
-
collect_data do
|
51
|
+
collect_data(:linux, :windows, :darwin) do
|
51
52
|
require "json" unless defined?(JSON)
|
52
53
|
|
53
54
|
if virtualization[:systems][:docker]
|
@@ -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
|
@@ -25,22 +26,22 @@ Ohai.plugin(:Memory) do
|
|
25
26
|
|
26
27
|
# /usr/src/sys/sys/vmmeter.h
|
27
28
|
so = shell_out("sysctl -n vm.stats.vm.v_page_size")
|
28
|
-
memory[:page_size] = so.stdout.
|
29
|
+
memory[:page_size] = so.stdout.strip
|
29
30
|
so = shell_out("sysctl -n vm.stats.vm.v_page_count")
|
30
|
-
memory[:page_count] = so.stdout.
|
31
|
+
memory[:page_count] = so.stdout.strip
|
31
32
|
memory[:total] = memory[:page_size].to_i * memory[:page_count].to_i
|
32
33
|
so = shell_out("sysctl -n vm.stats.vm.v_free_count")
|
33
|
-
memory[:free] = memory[:page_size].to_i * so.stdout.
|
34
|
+
memory[:free] = memory[:page_size].to_i * so.stdout.strip.to_i
|
34
35
|
so = shell_out("sysctl -n vm.status.vm.v_active_count")
|
35
|
-
memory[:active] = memory[:page_size].to_i * so.stdout.
|
36
|
+
memory[:active] = memory[:page_size].to_i * so.stdout.strip.to_i
|
36
37
|
so = shell_out("sysctl -n vm.status.vm.v_inactive_count")
|
37
|
-
memory[:inactive] = memory[:page_size].to_i * so.stdout.
|
38
|
+
memory[:inactive] = memory[:page_size].to_i * so.stdout.strip.to_i
|
38
39
|
so = shell_out("sysctl -n vm.stats.vm.v_cache_count")
|
39
|
-
memory[:cache] = memory[:page_size].to_i * so.stdout.
|
40
|
+
memory[:cache] = memory[:page_size].to_i * so.stdout.strip.to_i
|
40
41
|
so = shell_out("sysctl -n vm.stats.vm.v_wire_count")
|
41
|
-
memory[:wired] = memory[:page_size].to_i * so.stdout.
|
42
|
+
memory[:wired] = memory[:page_size].to_i * so.stdout.strip.to_i
|
42
43
|
so = shell_out("sysctl -n vfs.bufspace")
|
43
|
-
memory[:buffers] = so.stdout.
|
44
|
+
memory[:buffers] = so.stdout.strip
|
44
45
|
|
45
46
|
so = shell_out("swapinfo")
|
46
47
|
so.stdout.lines do |line|
|
@@ -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
|
@@ -20,8 +21,8 @@ Ohai.plugin(:Platform) do
|
|
20
21
|
provides "platform", "platform_version", "platform_family"
|
21
22
|
|
22
23
|
collect_data(:dragonflybsd) do
|
23
|
-
platform shell_out("uname -s").stdout.
|
24
|
-
platform_version shell_out("uname -r").stdout.
|
24
|
+
platform shell_out("uname -s").stdout.strip.downcase
|
25
|
+
platform_version shell_out("uname -r").stdout.strip
|
25
26
|
platform_family "dragonflybsd"
|
26
27
|
end
|
27
28
|
end
|
data/lib/ohai/plugins/ec2.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Tim Dysinger (<tim@dysinger.net>)
|
3
4
|
# Author:: Benjamin Black (<bb@chef.io>)
|
@@ -120,6 +121,9 @@ Ohai.plugin(:EC2) do
|
|
120
121
|
logger.trace("Plugin EC2: looks_like_ec2? == true")
|
121
122
|
ec2 Mash.new
|
122
123
|
fetch_metadata.each do |k, v|
|
124
|
+
# this includes sensitive data we don't want to store on the node
|
125
|
+
next if k == "identity_credentials_ec2_security_credentials_ec2_instance"
|
126
|
+
|
123
127
|
# fetch_metadata returns IAM security credentials, including the IAM user's
|
124
128
|
# secret access key. We'd rather not have ohai send this information
|
125
129
|
# to the server. If the instance is associated with an IAM role we grab
|
data/lib/ohai/plugins/elixir.rb
CHANGED
data/lib/ohai/plugins/erlang.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Tim Dysinger (<tim@dysinger.net>)
|
3
4
|
# Author:: Benjamin Black (<bb@chef.io>)
|
@@ -28,6 +29,8 @@ Ohai.plugin(:Eucalyptus) do
|
|
28
29
|
provides "eucalyptus"
|
29
30
|
depends "network/interfaces"
|
30
31
|
|
32
|
+
MAC_MATCH = /^[dD]0:0[dD]:/.freeze
|
33
|
+
|
31
34
|
# returns the mac address from the collection of all address types
|
32
35
|
def get_mac_address(addresses)
|
33
36
|
detected_addresses = addresses.detect { |address, keypair| keypair == { "family" => "lladdr" } }
|
@@ -42,7 +45,7 @@ Ohai.plugin(:Eucalyptus) do
|
|
42
45
|
def has_euca_mac?
|
43
46
|
network[:interfaces].each_value do |iface|
|
44
47
|
mac = get_mac_address(iface[:addresses])
|
45
|
-
if
|
48
|
+
if MAC_MATCH.match?(mac)
|
46
49
|
logger.trace("Plugin Eucalyptus: has_euca_mac? == true (#{mac})")
|
47
50
|
return true
|
48
51
|
end
|
data/lib/ohai/plugins/fips.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
|
@@ -25,22 +26,22 @@ Ohai.plugin(:Memory) do
|
|
25
26
|
|
26
27
|
# /usr/src/sys/sys/vmmeter.h
|
27
28
|
so = shell_out("sysctl -n vm.stats.vm.v_page_size")
|
28
|
-
memory[:page_size] = so.stdout.
|
29
|
+
memory[:page_size] = so.stdout.strip
|
29
30
|
so = shell_out("sysctl -n vm.stats.vm.v_page_count")
|
30
|
-
memory[:page_count] = so.stdout.
|
31
|
+
memory[:page_count] = so.stdout.strip
|
31
32
|
memory[:total] = memory[:page_size].to_i * memory[:page_count].to_i
|
32
33
|
so = shell_out("sysctl -n vm.stats.vm.v_free_count")
|
33
|
-
memory[:free] = memory[:page_size].to_i * so.stdout.
|
34
|
+
memory[:free] = memory[:page_size].to_i * so.stdout.strip.to_i
|
34
35
|
so = shell_out("sysctl -n vm.status.vm.v_active_count")
|
35
|
-
memory[:active] = memory[:page_size].to_i * so.stdout.
|
36
|
+
memory[:active] = memory[:page_size].to_i * so.stdout.strip.to_i
|
36
37
|
so = shell_out("sysctl -n vm.status.vm.v_inactive_count")
|
37
|
-
memory[:inactive] = memory[:page_size].to_i * so.stdout.
|
38
|
+
memory[:inactive] = memory[:page_size].to_i * so.stdout.strip.to_i
|
38
39
|
so = shell_out("sysctl -n vm.stats.vm.v_cache_count")
|
39
|
-
memory[:cache] = memory[:page_size].to_i * so.stdout.
|
40
|
+
memory[:cache] = memory[:page_size].to_i * so.stdout.strip.to_i
|
40
41
|
so = shell_out("sysctl -n vm.stats.vm.v_wire_count")
|
41
|
-
memory[:wired] = memory[:page_size].to_i * so.stdout.
|
42
|
+
memory[:wired] = memory[:page_size].to_i * so.stdout.strip.to_i
|
42
43
|
so = shell_out("sysctl -n vfs.bufspace")
|
43
|
-
memory[:buffers] = so.stdout.
|
44
|
+
memory[:buffers] = so.stdout.strip
|
44
45
|
|
45
46
|
so = shell_out("swapinfo")
|
46
47
|
so.stdout.lines do |line|
|
@@ -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
|
@@ -20,8 +21,8 @@ Ohai.plugin(:Platform) do
|
|
20
21
|
provides "platform", "platform_version", "platform_family"
|
21
22
|
|
22
23
|
collect_data(:freebsd) do
|
23
|
-
platform shell_out("uname -s").stdout.
|
24
|
-
platform_version shell_out("uname -r").stdout.
|
24
|
+
platform shell_out("uname -s").stdout.strip.downcase
|
25
|
+
platform_version shell_out("uname -r").stdout.strip
|
25
26
|
platform_family "freebsd"
|
26
27
|
end
|
27
28
|
end
|
data/lib/ohai/plugins/gce.rb
CHANGED
data/lib/ohai/plugins/go.rb
CHANGED
data/lib/ohai/plugins/groovy.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Author:: Davide Cavalca <dcavalca@fb.com>
|
4
|
+
# Copyright:: Copyright (c) 2020 Facebook
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
Ohai.plugin(:Grub2) do
|
21
|
+
provides "grub2/environment"
|
22
|
+
optional true
|
23
|
+
|
24
|
+
collect_data(:dragonflybsd, :freebsd, :linux, :netbsd) do
|
25
|
+
editenv_path = which("grub2-editenv")
|
26
|
+
if editenv_path
|
27
|
+
editenv_out = shell_out("#{editenv_path} list")
|
28
|
+
|
29
|
+
grub2 Mash.new unless grub2
|
30
|
+
grub2[:environment] ||= Mash.new
|
31
|
+
|
32
|
+
editenv_out.stdout.each_line do |line|
|
33
|
+
key, val = line.split("=", 2)
|
34
|
+
grub2[:environment][key] = val.strip
|
35
|
+
end
|
36
|
+
else
|
37
|
+
logger.trace("Plugin Grub2: Could not find grub2-editenv. Skipping plugin.")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/ohai/plugins/haskell.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Author:: Benjamin Black (<nostromo@gmail.com>)
|
@@ -37,8 +38,7 @@ Ohai.plugin(:Hostname) do
|
|
37
38
|
# fqdn and domain may be broken if DNS is broken on the host
|
38
39
|
|
39
40
|
def from_cmd(cmd)
|
40
|
-
|
41
|
-
so.stdout.split($/)[0]
|
41
|
+
shell_out(cmd).stdout.strip
|
42
42
|
end
|
43
43
|
|
44
44
|
# forward and reverse lookup to canonicalize FQDN (hostname -f equivalent)
|
data/lib/ohai/plugins/java.rb
CHANGED
data/lib/ohai/plugins/kernel.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Author:: Benjamin Black (<nostromo@gmail.com>)
|
@@ -33,7 +34,7 @@ Ohai.plugin(:Kernel) do
|
|
33
34
|
["uname -v", :version], ["uname -m", :machine],
|
34
35
|
["uname -p", :processor]].each do |cmd, property|
|
35
36
|
so = shell_out(cmd)
|
36
|
-
kernel[property] = so.stdout.
|
37
|
+
kernel[property] = so.stdout.strip
|
37
38
|
end
|
38
39
|
kernel
|
39
40
|
end
|
@@ -114,7 +115,6 @@ Ohai.plugin(:Kernel) do
|
|
114
115
|
when 16 then "WIN95"
|
115
116
|
when 17 then "WIN98"
|
116
117
|
when 19 then "WINCE"
|
117
|
-
else nil
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -133,7 +133,6 @@ Ohai.plugin(:Kernel) do
|
|
133
133
|
when 6 then "Appliance PC"
|
134
134
|
when 7 then "Performance Server"
|
135
135
|
when 8 then "Maximum"
|
136
|
-
else nil
|
137
136
|
end
|
138
137
|
end
|
139
138
|
|
@@ -169,7 +168,7 @@ Ohai.plugin(:Kernel) do
|
|
169
168
|
kernel[:os] = kernel[:name]
|
170
169
|
|
171
170
|
so = shell_out("sysctl -n hw.optional.x86_64")
|
172
|
-
if so.stdout.
|
171
|
+
if so.stdout.strip.to_i == 1
|
173
172
|
kernel[:machine] = "x86_64"
|
174
173
|
end
|
175
174
|
|
@@ -189,7 +188,7 @@ Ohai.plugin(:Kernel) do
|
|
189
188
|
kernel[:os] = kernel[:name]
|
190
189
|
|
191
190
|
so = shell_out("uname -i")
|
192
|
-
kernel[:ident] = so.stdout.
|
191
|
+
kernel[:ident] = so.stdout.strip
|
193
192
|
so = shell_out("sysctl kern.securelevel")
|
194
193
|
kernel[:securelevel] = so.stdout.split($/).select { |e| e =~ /kern.securelevel: (.+)$/ }
|
195
194
|
|
@@ -200,7 +199,7 @@ Ohai.plugin(:Kernel) do
|
|
200
199
|
kernel init_kernel
|
201
200
|
|
202
201
|
so = shell_out("uname -o")
|
203
|
-
kernel[:os] = so.stdout.
|
202
|
+
kernel[:os] = so.stdout.strip
|
204
203
|
|
205
204
|
modules = Mash.new
|
206
205
|
so = shell_out("env lsmod")
|
@@ -232,7 +231,7 @@ Ohai.plugin(:Kernel) do
|
|
232
231
|
kernel init_kernel
|
233
232
|
|
234
233
|
so = shell_out("uname -s")
|
235
|
-
kernel[:os] = so.stdout.
|
234
|
+
kernel[:os] = so.stdout.strip
|
236
235
|
|
237
236
|
so = file_open("/etc/release", &:gets)
|
238
237
|
md = /(?<update>\d.*\d)/.match(so)
|
@@ -244,7 +243,7 @@ Ohai.plugin(:Kernel) do
|
|
244
243
|
# EXAMPLE:
|
245
244
|
# Id Loadaddr Size Info Rev Module Name
|
246
245
|
# 6 1180000 4623 1 1 specfs (filesystem for specfs)
|
247
|
-
module_description =
|
246
|
+
module_description = /\s*(\d+)\s+([a-f\d]+)\s+([a-f\d]+)\s+(?:[\-\d]+)\s+(?:\d+)\s+(\S+)\s+\((.+)\)$/
|
248
247
|
so.stdout.lines do |line|
|
249
248
|
if ( mod = module_description.match(line) )
|
250
249
|
modules[mod[4]] = { id: mod[1].to_i, loadaddr: mod[2], size: mod[3].to_i(16), description: mod[5] }
|