ohai 15.3.1 → 15.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -6
  3. data/lib/ohai/mixin/{network_constants.rb → network_helper.rb} +8 -1
  4. data/lib/ohai/plugins/aix/network.rb +3 -8
  5. data/lib/ohai/plugins/darwin/network.rb +6 -4
  6. data/lib/ohai/plugins/filesystem.rb +166 -0
  7. data/lib/ohai/plugins/network.rb +5 -5
  8. data/lib/ohai/plugins/openstack.rb +2 -1
  9. data/lib/ohai/plugins/solaris2/network.rb +6 -4
  10. data/lib/ohai/version.rb +1 -1
  11. data/ohai.gemspec +1 -1
  12. metadata +3 -162
  13. data/Rakefile +0 -42
  14. data/lib/ohai/plugins/windows/filesystem.rb +0 -147
  15. data/spec/data/plugins/dpkg-query.output +0 -4
  16. data/spec/data/plugins/lslpp.output +0 -50
  17. data/spec/data/plugins/pacman.output +0 -51
  18. data/spec/data/plugins/pkg-query.output +0 -58
  19. data/spec/data/plugins/pkginfo.output +0 -50
  20. data/spec/data/plugins/pkglist.output +0 -24
  21. data/spec/data/plugins/rpmquery.output +0 -7
  22. data/spec/functional/application_spec.rb +0 -107
  23. data/spec/functional/loader_spec.rb +0 -53
  24. data/spec/functional/plugins/powershell_spec.rb +0 -88
  25. data/spec/functional/plugins/root_group_spec.rb +0 -41
  26. data/spec/functional/plugins/windows/uptime_spec.rb +0 -51
  27. data/spec/ohai_spec.rb +0 -27
  28. data/spec/rcov.opts +0 -2
  29. data/spec/spec.opts +0 -2
  30. data/spec/spec_helper.rb +0 -124
  31. data/spec/support/integration_helper.rb +0 -61
  32. data/spec/support/platform_helpers.rb +0 -38
  33. data/spec/unit/application_spec.rb +0 -96
  34. data/spec/unit/config_spec.rb +0 -57
  35. data/spec/unit/dsl/plugin_spec.rb +0 -634
  36. data/spec/unit/hints_spec.rb +0 -65
  37. data/spec/unit/loader_spec.rb +0 -195
  38. data/spec/unit/mixin/azure_metadata_spec.rb +0 -72
  39. data/spec/unit/mixin/command_spec.rb +0 -151
  40. data/spec/unit/mixin/dmi_decode.rb +0 -75
  41. data/spec/unit/mixin/ec2_metadata_spec.rb +0 -88
  42. data/spec/unit/mixin/softlayer_metadata_spec.rb +0 -72
  43. data/spec/unit/plugin_config_spec.rb +0 -117
  44. data/spec/unit/plugins/abort_spec.rb +0 -69
  45. data/spec/unit/plugins/aix/cpu_spec.rb +0 -127
  46. data/spec/unit/plugins/aix/filesystem_spec.rb +0 -238
  47. data/spec/unit/plugins/aix/hostname_spec.rb +0 -33
  48. data/spec/unit/plugins/aix/kernel_spec.rb +0 -61
  49. data/spec/unit/plugins/aix/memory_spec.rb +0 -49
  50. data/spec/unit/plugins/aix/network_spec.rb +0 -313
  51. data/spec/unit/plugins/aix/platform_spec.rb +0 -44
  52. data/spec/unit/plugins/aix/uptime_spec.rb +0 -42
  53. data/spec/unit/plugins/aix/virtualization_spec.rb +0 -319
  54. data/spec/unit/plugins/azure_spec.rb +0 -243
  55. data/spec/unit/plugins/bsd/filesystem_spec.rb +0 -138
  56. data/spec/unit/plugins/bsd/virtualization_spec.rb +0 -145
  57. data/spec/unit/plugins/c_spec.rb +0 -341
  58. data/spec/unit/plugins/chef_spec.rb +0 -44
  59. data/spec/unit/plugins/cloud_spec.rb +0 -484
  60. data/spec/unit/plugins/darwin/cpu_spec.rb +0 -124
  61. data/spec/unit/plugins/darwin/filesystem_spec.rb +0 -140
  62. data/spec/unit/plugins/darwin/hardware_spec.rb +0 -105
  63. data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +0 -1110
  64. data/spec/unit/plugins/darwin/hostname_spec.rb +0 -43
  65. data/spec/unit/plugins/darwin/kernel_spec.rb +0 -65
  66. data/spec/unit/plugins/darwin/memory_spec.rb +0 -64
  67. data/spec/unit/plugins/darwin/network_spec.rb +0 -849
  68. data/spec/unit/plugins/darwin/platform_spec.rb +0 -71
  69. data/spec/unit/plugins/darwin/virtualization_spec.rb +0 -156
  70. data/spec/unit/plugins/digital_ocean_spec.rb +0 -106
  71. data/spec/unit/plugins/dmi_spec.rb +0 -156
  72. data/spec/unit/plugins/docker_spec.rb +0 -100
  73. data/spec/unit/plugins/ec2_spec.rb +0 -452
  74. data/spec/unit/plugins/elixir_spec.rb +0 -55
  75. data/spec/unit/plugins/erlang_spec.rb +0 -71
  76. data/spec/unit/plugins/eucalyptus_spec.rb +0 -109
  77. data/spec/unit/plugins/fail_spec.rb +0 -260
  78. data/spec/unit/plugins/freebsd/cpu_spec.rb +0 -129
  79. data/spec/unit/plugins/freebsd/hostname_spec.rb +0 -35
  80. data/spec/unit/plugins/freebsd/kernel_spec.rb +0 -36
  81. data/spec/unit/plugins/freebsd/platform_spec.rb +0 -38
  82. data/spec/unit/plugins/gce_spec.rb +0 -81
  83. data/spec/unit/plugins/go_spec.rb +0 -48
  84. data/spec/unit/plugins/groovy_spec.rb +0 -66
  85. data/spec/unit/plugins/haskell_spec.rb +0 -231
  86. data/spec/unit/plugins/hostname_spec.rb +0 -162
  87. data/spec/unit/plugins/init_package_spec.rb +0 -60
  88. data/spec/unit/plugins/java_spec.rb +0 -230
  89. data/spec/unit/plugins/joyent_spec.rb +0 -100
  90. data/spec/unit/plugins/kernel_spec.rb +0 -38
  91. data/spec/unit/plugins/linode_spec.rb +0 -135
  92. data/spec/unit/plugins/linux/block_device_spec.rb +0 -75
  93. data/spec/unit/plugins/linux/cpu_spec.rb +0 -441
  94. data/spec/unit/plugins/linux/filesystem_spec.rb +0 -550
  95. data/spec/unit/plugins/linux/fips_spec.rb +0 -60
  96. data/spec/unit/plugins/linux/hostname_spec.rb +0 -52
  97. data/spec/unit/plugins/linux/hostnamectl_spec.rb +0 -59
  98. data/spec/unit/plugins/linux/kernel_spec.rb +0 -71
  99. data/spec/unit/plugins/linux/lsb_spec.rb +0 -147
  100. data/spec/unit/plugins/linux/lspci_spec.rb +0 -133
  101. data/spec/unit/plugins/linux/machineid_spec.rb +0 -46
  102. data/spec/unit/plugins/linux/mdadm_spec.rb +0 -170
  103. data/spec/unit/plugins/linux/memory_spec.rb +0 -256
  104. data/spec/unit/plugins/linux/network_spec.rb +0 -1392
  105. data/spec/unit/plugins/linux/platform_spec.rb +0 -812
  106. data/spec/unit/plugins/linux/sessions_spec.rb +0 -98
  107. data/spec/unit/plugins/linux/sysctl_spec.rb +0 -53
  108. data/spec/unit/plugins/linux/systemd_paths_spec.rb +0 -122
  109. data/spec/unit/plugins/linux/uptime_spec.rb +0 -48
  110. data/spec/unit/plugins/linux/virtualization_spec.rb +0 -650
  111. data/spec/unit/plugins/lua_spec.rb +0 -60
  112. data/spec/unit/plugins/mono_spec.rb +0 -67
  113. data/spec/unit/plugins/netbsd/hostname_spec.rb +0 -43
  114. data/spec/unit/plugins/netbsd/kernel_spec.rb +0 -35
  115. data/spec/unit/plugins/netbsd/platform_spec.rb +0 -38
  116. data/spec/unit/plugins/network_spec.rb +0 -1078
  117. data/spec/unit/plugins/nodejs_spec.rb +0 -55
  118. data/spec/unit/plugins/ohai_spec.rb +0 -32
  119. data/spec/unit/plugins/ohai_time_spec.rb +0 -44
  120. data/spec/unit/plugins/openbsd/hostname_spec.rb +0 -43
  121. data/spec/unit/plugins/openbsd/kernel_spec.rb +0 -36
  122. data/spec/unit/plugins/openbsd/platform_spec.rb +0 -33
  123. data/spec/unit/plugins/openstack_spec.rb +0 -311
  124. data/spec/unit/plugins/os_spec.rb +0 -115
  125. data/spec/unit/plugins/packages_spec.rb +0 -353
  126. data/spec/unit/plugins/passwd_spec.rb +0 -65
  127. data/spec/unit/plugins/perl_spec.rb +0 -62
  128. data/spec/unit/plugins/php_spec.rb +0 -97
  129. data/spec/unit/plugins/platform_spec.rb +0 -65
  130. data/spec/unit/plugins/powershell_spec.rb +0 -71
  131. data/spec/unit/plugins/python_spec.rb +0 -51
  132. data/spec/unit/plugins/rackspace_spec.rb +0 -350
  133. data/spec/unit/plugins/root_group_spec.rb +0 -90
  134. data/spec/unit/plugins/ruby_spec.rb +0 -60
  135. data/spec/unit/plugins/rust_spec.rb +0 -43
  136. data/spec/unit/plugins/scala_spec.rb +0 -58
  137. data/spec/unit/plugins/scaleway_spec.rb +0 -93
  138. data/spec/unit/plugins/scsi_spec.rb +0 -69
  139. data/spec/unit/plugins/shard_spec.rb +0 -121
  140. data/spec/unit/plugins/shells_spec.rb +0 -56
  141. data/spec/unit/plugins/softlayer_spec.rb +0 -60
  142. data/spec/unit/plugins/solaris2/cpu_spec.rb +0 -2926
  143. data/spec/unit/plugins/solaris2/dmi_spec.rb +0 -153
  144. data/spec/unit/plugins/solaris2/filesystem.rb +0 -407
  145. data/spec/unit/plugins/solaris2/hostname_spec.rb +0 -37
  146. data/spec/unit/plugins/solaris2/kernel_spec.rb +0 -183
  147. data/spec/unit/plugins/solaris2/memory_spec.rb +0 -43
  148. data/spec/unit/plugins/solaris2/network_spec.rb +0 -201
  149. data/spec/unit/plugins/solaris2/platform_spec.rb +0 -108
  150. data/spec/unit/plugins/solaris2/virtualization_spec.rb +0 -97
  151. data/spec/unit/plugins/ssh_host_keys_spec.rb +0 -116
  152. data/spec/unit/plugins/sysconf_spec.rb +0 -680
  153. data/spec/unit/plugins/timezone_spec.rb +0 -30
  154. data/spec/unit/plugins/vbox_host_spec.rb +0 -14
  155. data/spec/unit/plugins/virtualbox_spec.rb +0 -375
  156. data/spec/unit/plugins/vmware_spec.rb +0 -81
  157. data/spec/unit/plugins/windows/cpu_spec.rb +0 -118
  158. data/spec/unit/plugins/windows/filesystem_spec.rb +0 -226
  159. data/spec/unit/plugins/windows/fips_spec.rb +0 -60
  160. data/spec/unit/plugins/windows/kernel_spec.rb +0 -79
  161. data/spec/unit/plugins/windows/memory_spec.rb +0 -52
  162. data/spec/unit/plugins/windows/network_spec.rb +0 -137
  163. data/spec/unit/plugins/windows/system_enclosure_spec.rb +0 -45
  164. data/spec/unit/plugins/windows/uptime_spec.rb +0 -38
  165. data/spec/unit/plugins/windows/virtualization_spec.rb +0 -63
  166. data/spec/unit/plugins/zpools_spec.rb +0 -244
  167. data/spec/unit/provides_map_spec.rb +0 -208
  168. data/spec/unit/runner_spec.rb +0 -422
  169. data/spec/unit/system_spec.rb +0 -416
  170. data/spec/unit/util/file_helper_spec.rb +0 -47
  171. data/spec/unit/util/ip_helper_spec.rb +0 -128
@@ -1,46 +0,0 @@
1
- #
2
- # Author:: Davide Cavalca <dcavalca@fb.com>
3
- # Copyright:: Copyright (c) 2016 Facebook
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- describe Ohai::System, "Machine id plugin" do
22
- let(:plugin) { get_plugin("linux/machineid") }
23
-
24
- before do
25
- allow(plugin).to receive(:collect_os).and_return(:linux)
26
- end
27
-
28
- it "reads /etc/machine-id if available" do
29
- machine_id = "6f702523e2fc7499eb1dc68e5314dacf"
30
-
31
- allow(::File).to receive(:exist?).with("/etc/machine-id").and_return(true)
32
- allow(::File).to receive(:read).with("/etc/machine-id").and_return(machine_id)
33
- plugin.run
34
- expect(plugin[:machine_id]).to eq(machine_id)
35
- end
36
-
37
- it "reads /var/lib/dbus/machine-id if available" do
38
- machine_id = "6f702523e2fc7499eb1dc68e5314dacf"
39
-
40
- allow(::File).to receive(:exist?).with("/etc/machine-id").and_return(false)
41
- allow(::File).to receive(:exist?).with("/var/lib/dbus/machine-id").and_return(true)
42
- allow(::File).to receive(:read).with("/var/lib/dbus/machine-id").and_return(machine_id)
43
- plugin.run
44
- expect(plugin[:machine_id]).to eq(machine_id)
45
- end
46
- end
@@ -1,170 +0,0 @@
1
- #
2
- # Author:: Tim Smith <tsmith@limelight.com>
3
- # Copyright:: Copyright (c) 2014 Limelight Networks, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- describe Ohai::System, "Linux Mdadm Plugin" do
22
- before do
23
- @md0 = <<~MD
24
- /dev/md0:
25
- Version : 1.2
26
- Creation Time : Thu Jan 30 03:11:40 2014
27
- Raid Level : raid10
28
- Array Size : 2929893888 (2794.16 GiB 3000.21 GB)
29
- Used Dev Size : 976631296 (931.39 GiB 1000.07 GB)
30
- Raid Devices : 6
31
- Total Devices : 6
32
- Persistence : Superblock is persistent
33
-
34
- Update Time : Tue May 6 23:30:32 2014
35
- State : clean
36
- Active Devices : 6
37
- Working Devices : 6
38
- Failed Devices : 0
39
- Spare Devices : 0
40
-
41
- Layout : near=2
42
- Chunk Size : 256K
43
-
44
- Name : host.therealtimsmith.com:3 (local to host host.therealtimsmith.com)
45
- UUID : 5ed74d5b:70bfe21d:8cd57792:c1e13d65
46
- Events : 155
47
-
48
- Number Major Minor RaidDevice State
49
- 0 8 32 0 active sync /dev/sdc
50
- 1 8 48 1 active sync /dev/sdd
51
- 2 8 64 2 active sync /dev/sde
52
- 3 8 80 3 active sync /dev/sdf
53
- 4 8 96 4 active sync /dev/sdg
54
- 5 8 112 5 active sync /dev/sdh
55
- MD
56
- @plugin = get_plugin("linux/mdadm")
57
- allow(@plugin).to receive(:collect_os).and_return(:linux)
58
- @double_file = double("/proc/mdstat")
59
- allow(@double_file).to receive(:each)
60
- .and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
61
- .and_yield("md0 : active raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
62
- .and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
63
- allow(File).to receive(:open).with("/proc/mdstat").and_return(@double_file)
64
- allow(File).to receive(:exist?).with("/proc/mdstat").and_return(true)
65
- allow(@plugin).to receive(:shell_out).with("mdadm --detail /dev/md0").and_return(mock_shell_out(0, @md0, ""))
66
- end
67
-
68
- describe "gathering Mdadm information via /proc/mdstat and mdadm" do
69
-
70
- it "does not raise an error" do
71
- expect { @plugin.run }.not_to raise_error
72
- end
73
-
74
- it "detects raid level" do
75
- @plugin.run
76
- expect(@plugin[:mdadm][:md0][:level]).to eq(10)
77
- end
78
-
79
- it "detects raid state" do
80
- @plugin.run
81
- expect(@plugin[:mdadm][:md0][:state]).to eq("clean")
82
- end
83
-
84
- it "detects raid size" do
85
- @plugin.run
86
- expect(@plugin[:mdadm][:md0][:size]).to eq(2794.16)
87
- end
88
-
89
- it "detects raid metadata level" do
90
- @plugin.run
91
- expect(@plugin[:mdadm][:md0][:version]).to eq(1.2)
92
- end
93
-
94
- device_counts = { raid: 6, total: 6, active: 6, working: 6, failed: 0, spare: 0 }
95
- device_counts.each_pair do |item, expected_value|
96
- it "detects device count of \"#{item}\"" do
97
- @plugin.run
98
- expect(@plugin[:mdadm][:md0][:device_counts][item]).to eq(expected_value)
99
- end
100
- end
101
-
102
- it "detects member devices" do
103
- @plugin.run
104
- expect(@plugin[:mdadm][:md0][:members].sort).to eq(
105
- %w{sdc sdd sde sdf sdg sdh}
106
- )
107
- end
108
-
109
- it "detects member devices even if there are multi-digit numbers" do
110
- new_mdstat = double("/proc/mdstat2")
111
- allow(new_mdstat).to receive(:each)
112
- .and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
113
- .and_yield("md0 : active raid10 sdj[2010] sdi[99] sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
114
- .and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
115
- allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
116
-
117
- @plugin.run
118
- expect(@plugin[:mdadm][:md0][:members].sort).to eq(
119
- %w{sdc sdd sde sdf sdg sdh sdi sdj}
120
- )
121
- end
122
-
123
- it "detects member devices even if mdstat has extra entries" do
124
- new_mdstat = double("/proc/mdstat2")
125
- allow(new_mdstat).to receive(:each)
126
- .and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]")
127
- .and_yield("md0 : active (somecraphere) <morestuff> raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]")
128
- .and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
129
- allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
130
-
131
- @plugin.run
132
- expect(@plugin[:mdadm][:md0][:members].sort).to eq(
133
- %w{sdc sdd sde sdf sdg sdh}
134
- )
135
- end
136
-
137
- it "accuratelies report inactive arrays" do
138
- new_mdstat = double("/proc/mdstat_inactive")
139
- allow(new_mdstat).to receive(:each)
140
- .and_yield("Personalities :")
141
- .and_yield("md0 : inactive nvme2n1p3[2](S)")
142
- allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
143
-
144
- @plugin.run
145
- expect(@plugin[:mdadm][:md0][:spares]).to eq(%w{nvme2n1p3})
146
- end
147
-
148
- it "reports journal devices" do
149
- new_mdstat = double("/proc/mdstat_journal")
150
- allow(new_mdstat).to receive(:each)
151
- .and_yield("Personalies : [raid6]")
152
- .and_yield("md0 : active (somecraphere) <morestuff raid6 sdbc1[7] sdd1[6] sde1[5] sdd1[4] sde1[3] sdf1[2] sdg1[1] nvme2n1p3[0](J)")
153
- allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
154
-
155
- @plugin.run
156
- expect(@plugin[:mdadm][:md0][:journal]).to eq("nvme2n1p3")
157
- end
158
-
159
- it "reports spare devices" do
160
- new_mdstat = double("/proc/mdstat_spare")
161
- allow(new_mdstat).to receive(:each)
162
- .and_yield("Personalies : [raid6]")
163
- .and_yield("md0 : active (somecraphere) <morestuff raid6 sdbc1[7] sdd1[6] sde1[5] sdd1[4] sde1[3] sdf1[2] sdg1[1] sdh1[0](S)")
164
- allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
165
-
166
- @plugin.run
167
- expect(@plugin[:mdadm][:md0][:spares]).to eq(%w{sdh1})
168
- end
169
- end
170
- end
@@ -1,256 +0,0 @@
1
- #
2
- # License:: Apache License, Version 2.0
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- require "spec_helper"
18
-
19
- describe Ohai::System, "Linux memory plugin" do
20
- before do
21
- @plugin = get_plugin("linux/memory")
22
- allow(@plugin).to receive(:collect_os).and_return(:linux)
23
- @double_file = double("/proc/meminfo")
24
- allow(@double_file).to receive(:each)
25
- .and_yield("MemTotal: 131932120 kB")
26
- .and_yield("MemFree: 2269032 kB")
27
- .and_yield("MemAvailable: 9208922 kB")
28
- .and_yield("Buffers: 646368 kB")
29
- .and_yield("Cached: 32346556 kB")
30
- .and_yield("SwapCached: 312 kB")
31
- .and_yield("Active: 98595796 kB")
32
- .and_yield("Inactive: 18477320 kB")
33
- .and_yield("HighTotal: 0 kB")
34
- .and_yield("HighFree: 0 kB")
35
- .and_yield("LowTotal: 131932120 kB")
36
- .and_yield("LowFree: 2269032 kB")
37
- .and_yield("SwapTotal: 16777208 kB")
38
- .and_yield("SwapFree: 14127356 kB")
39
- .and_yield("Dirty: 3212 kB")
40
- .and_yield("Writeback: 0 kB")
41
- .and_yield("AnonPages: 84082132 kB")
42
- .and_yield("Mapped: 3445224 kB")
43
- .and_yield("Slab: 9892096 kB")
44
- .and_yield("SReclaimable: 362636 kB")
45
- .and_yield("SUnreclaim: 18860 kB")
46
- .and_yield("PageTables: 1759332 kB")
47
- .and_yield("NFS_Unstable: 0 kB")
48
- .and_yield("Bounce: 0 kB")
49
- .and_yield("CommitLimit: 148709328 kB")
50
- .and_yield("Committed_AS: 333717060 kB")
51
- .and_yield("VmallocTotal: 34359738367 kB")
52
- .and_yield("VmallocUsed: 276796 kB")
53
- .and_yield("VmallocChunk: 34359461515 kB")
54
- .and_yield("HugePages_Total: 11542")
55
- .and_yield("HugePages_Free: 11235")
56
- .and_yield("HugePages_Rsvd: 11226")
57
- .and_yield("HugePages_Surp: 0")
58
- .and_yield("Hugepagesize: 2048 kB")
59
- .and_yield("Hugetlb: 0 kB")
60
- .and_yield("DirectMap4k: 3720736 kB")
61
- .and_yield("DirectMap2M: 12795904 kB")
62
- .and_yield("DirectMap1G: 0 kB")
63
-
64
- allow(File).to receive(:open).with("/proc/meminfo").and_return(@double_file)
65
- end
66
-
67
- it "gets total memory" do
68
- @plugin.run
69
- expect(@plugin[:memory][:total]).to eql("131932120kB")
70
- end
71
-
72
- it "gets free memory" do
73
- @plugin.run
74
- expect(@plugin[:memory][:free]).to eql("2269032kB")
75
- end
76
-
77
- it "gets available memory" do
78
- @plugin.run
79
- expect(@plugin[:memory][:available]).to eql("9208922kB")
80
- end
81
-
82
- it "gets memory used for file buffers" do
83
- @plugin.run
84
- expect(@plugin[:memory][:buffers]).to eql("646368kB")
85
- end
86
-
87
- it "gets cache memory" do
88
- @plugin.run
89
- expect(@plugin[:memory][:cached]).to eql("32346556kB")
90
- end
91
-
92
- it "gets active memory" do
93
- @plugin.run
94
- expect(@plugin[:memory][:active]).to eql("98595796kB")
95
- end
96
-
97
- it "gets inactive memory" do
98
- @plugin.run
99
- expect(@plugin[:memory][:inactive]).to eql("18477320kB")
100
- end
101
-
102
- it "gets high_total memory" do
103
- @plugin.run
104
- expect(@plugin[:memory][:high_total]).to eql("0kB")
105
- end
106
-
107
- it "gets high_free memory" do
108
- @plugin.run
109
- expect(@plugin[:memory][:high_free]).to eql("0kB")
110
- end
111
-
112
- it "gets low_total memory" do
113
- @plugin.run
114
- expect(@plugin[:memory][:low_total]).to eql("131932120kB")
115
- end
116
-
117
- it "gets low_free memory" do
118
- @plugin.run
119
- expect(@plugin[:memory][:low_free]).to eql("2269032kB")
120
- end
121
-
122
- it "gets dirty memory" do
123
- @plugin.run
124
- expect(@plugin[:memory][:dirty]).to eql("3212kB")
125
- end
126
-
127
- it "gets writeback memory" do
128
- @plugin.run
129
- expect(@plugin[:memory][:writeback]).to eql("0kB")
130
- end
131
-
132
- it "gets anon_pages memory" do
133
- @plugin.run
134
- expect(@plugin[:memory][:anon_pages]).to eql("84082132kB")
135
- end
136
-
137
- it "gets mapped memory" do
138
- @plugin.run
139
- expect(@plugin[:memory][:mapped]).to eql("3445224kB")
140
- end
141
-
142
- it "gets slab memory" do
143
- @plugin.run
144
- expect(@plugin[:memory][:slab]).to eql("9892096kB")
145
- end
146
-
147
- it "gets slab_reclaimable memory" do
148
- @plugin.run
149
- expect(@plugin[:memory][:slab_reclaimable]).to eql("362636kB")
150
- end
151
-
152
- it "gets slab_reclaimable memory" do
153
- @plugin.run
154
- expect(@plugin[:memory][:slab_unreclaim]).to eql("18860kB")
155
- end
156
-
157
- it "gets page_tables memory" do
158
- @plugin.run
159
- expect(@plugin[:memory][:page_tables]).to eql("1759332kB")
160
- end
161
-
162
- it "gets nfs_unstable memory" do
163
- @plugin.run
164
- expect(@plugin[:memory][:nfs_unstable]).to eql("0kB")
165
- end
166
-
167
- it "gets bounce memory" do
168
- @plugin.run
169
- expect(@plugin[:memory][:bounce]).to eql("0kB")
170
- end
171
-
172
- it "gets commit_limit memory" do
173
- @plugin.run
174
- expect(@plugin[:memory][:commit_limit]).to eql("148709328kB")
175
- end
176
-
177
- it "gets committed_as memory" do
178
- @plugin.run
179
- expect(@plugin[:memory][:committed_as]).to eql("333717060kB")
180
- end
181
-
182
- it "gets vmalloc_total memory" do
183
- @plugin.run
184
- expect(@plugin[:memory][:vmalloc_total]).to eql("34359738367kB")
185
- end
186
-
187
- it "gets vmalloc_used memory" do
188
- @plugin.run
189
- expect(@plugin[:memory][:vmalloc_used]).to eql("276796kB")
190
- end
191
-
192
- it "gets vmalloc_chunk memory" do
193
- @plugin.run
194
- expect(@plugin[:memory][:vmalloc_chunk]).to eql("34359461515kB")
195
- end
196
-
197
- it "gets total swap" do
198
- @plugin.run
199
- expect(@plugin[:memory][:swap][:total]).to eql("16777208kB")
200
- end
201
-
202
- it "gets cached swap" do
203
- @plugin.run
204
- expect(@plugin[:memory][:swap][:cached]).to eql("312kB")
205
- end
206
-
207
- it "gets free swap" do
208
- @plugin.run
209
- expect(@plugin[:memory][:swap][:free]).to eql("14127356kB")
210
- end
211
-
212
- it "gets total hugepages" do
213
- @plugin.run
214
- expect(@plugin[:memory][:hugepages][:total]).to eql("11542")
215
- end
216
-
217
- it "gets free hugepages" do
218
- @plugin.run
219
- expect(@plugin[:memory][:hugepages][:free]).to eql("11235")
220
- end
221
-
222
- it "gets reserved hugepages" do
223
- @plugin.run
224
- expect(@plugin[:memory][:hugepages][:reserved]).to eql("11226")
225
- end
226
-
227
- it "gets surplus hugepages" do
228
- @plugin.run
229
- expect(@plugin[:memory][:hugepages][:surplus]).to eql("0")
230
- end
231
-
232
- it "gets hugepage size" do
233
- @plugin.run
234
- expect(@plugin[:memory][:hugepage_size]).to eql("2048kB")
235
- end
236
-
237
- it "gets hugetlb memory" do
238
- @plugin.run
239
- expect(@plugin[:memory][:hugetlb]).to eql("0kB")
240
- end
241
-
242
- it "gets directmap 4k memory" do
243
- @plugin.run
244
- expect(@plugin[:memory][:directmap][:'4k']).to eql("3720736kB")
245
- end
246
-
247
- it "gets directmap 2M memory" do
248
- @plugin.run
249
- expect(@plugin[:memory][:directmap][:'2M']).to eql("12795904kB")
250
- end
251
-
252
- it "gets directmap 1G memory" do
253
- @plugin.run
254
- expect(@plugin[:memory][:directmap][:'1G']).to eql("0kB")
255
- end
256
- end