diff --git a/NOTICE.txt b/NOTICE.txt index 34785c7cbdb..d0f85cb5d59 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -8539,6 +8539,218 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-ucfg@v0.8.3/ limitations under the License. +-------------------------------------------------------------------------------- +Dependency : github.com/elastic/go-windows +Version: v1.0.1 +Licence type (autodetected): Apache-2.0 +-------------------------------------------------------------------------------- + +Contents of probable licence file $GOMODCACHE/github.com/elastic/go-windows@v1.0.1/LICENSE.txt: + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + -------------------------------------------------------------------------------- Dependency : github.com/elastic/gosigar Version: v0.14.1 @@ -27056,218 +27268,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------- -Dependency : github.com/elastic/go-windows -Version: v1.0.1 -Licence type (autodetected): Apache-2.0 --------------------------------------------------------------------------------- - -Contents of probable licence file $GOMODCACHE/github.com/elastic/go-windows@v1.0.1/LICENSE.txt: - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -------------------------------------------------------------------------------- Dependency : github.com/elazarl/goproxy Version: v0.0.0-20180725130230-947c36da3153 diff --git a/go.mod b/go.mod index 14cc32f6042..25248070c4c 100644 --- a/go.mod +++ b/go.mod @@ -74,7 +74,7 @@ require ( github.com/elastic/go-sysinfo v1.7.0 github.com/elastic/go-txfile v0.0.7 github.com/elastic/go-ucfg v0.8.3 - github.com/elastic/go-windows v1.0.1 // indirect + github.com/elastic/go-windows v1.0.1 github.com/elastic/gosigar v0.14.1 github.com/fatih/color v1.9.0 github.com/fsnotify/fsevents v0.1.1 diff --git a/libbeat/metric/system/memory/memory.go b/libbeat/metric/system/memory/memory.go deleted file mode 100644 index 72e351db384..00000000000 --- a/libbeat/metric/system/memory/memory.go +++ /dev/null @@ -1,172 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -// +build darwin freebsd linux openbsd windows - -package memory - -import ( - "github.com/pkg/errors" - - "github.com/elastic/beats/v7/libbeat/common" - "github.com/elastic/beats/v7/libbeat/logp" - sysinfo "github.com/elastic/go-sysinfo" - sysinfotypes "github.com/elastic/go-sysinfo/types" - sigar "github.com/elastic/gosigar" -) - -// MemStat includes the memory usage statistics and ratios of usage and total memory usage -type MemStat struct { - sigar.Mem - UsedPercent float64 `json:"used_p"` - ActualUsedPercent float64 `json:"actual_used_p"` -} - -// Get returns the memory stats of the host -func Get() (*MemStat, error) { - mem := sigar.Mem{} - err := mem.Get() - if err != nil { - return nil, err - } - - return &MemStat{Mem: mem}, nil -} - -// AddMemPercentage calculates the ratio of used and total size of memory -func AddMemPercentage(m *MemStat) { - if m.Mem.Total == 0 { - return - } - - perc := float64(m.Mem.Used) / float64(m.Mem.Total) - m.UsedPercent = common.Round(perc, common.DefaultDecimalPlacesCount) - - actualPerc := float64(m.Mem.ActualUsed) / float64(m.Mem.Total) - m.ActualUsedPercent = common.Round(actualPerc, common.DefaultDecimalPlacesCount) -} - -// SwapStat includes the current swap usage and the ratio of used and total swap size -type SwapStat struct { - sigar.Swap - UsedPercent float64 `json:"used_p"` -} - -// GetSwap returns the swap usage of the host -func GetSwap() (*SwapStat, error) { - swap := sigar.Swap{} - err := swap.Get() - if err != nil { - return nil, err - } - - // This shouldn't happen, but it has been reported to happen and - // this can provoke too big values for used swap. - // Workaround this by assuming that all swap is free in that case. - if swap.Free > swap.Total || swap.Used > swap.Total { - logger := logp.NewLogger("memory") - logger.Debugf("memory", - "Unexpected values for swap memory - total: %v free: %v used: %v. Setting swap used to 0.", - swap.Total, swap.Free, swap.Used) - swap.Free = swap.Total - swap.Used = 0 - } - - return &SwapStat{Swap: swap}, nil -} - -// GetMemoryEvent returns the event created from memory statistics -func GetMemoryEvent(memStat *MemStat) common.MapStr { - return common.MapStr{ - "total": memStat.Total, - "used": memStat.Used, - "free": memStat.Free, - "actual_used": memStat.ActualUsed, - "actual_free": memStat.ActualFree, - "used_p": memStat.UsedPercent, - "actual_used_p": memStat.ActualUsedPercent, - } -} - -// GetSwapEvent returns the event created from swap usage -func GetSwapEvent(swapStat *SwapStat) common.MapStr { - return common.MapStr{ - "total": swapStat.Total, - "used": swapStat.Used, - "free": swapStat.Free, - "used_p": swapStat.UsedPercent, - } -} - -// AddSwapPercentage calculates the ratio of used and total swap size -func AddSwapPercentage(s *SwapStat) { - if s.Swap.Total == 0 { - return - } - - perc := float64(s.Swap.Used) / float64(s.Swap.Total) - s.UsedPercent = common.Round(perc, common.DefaultDecimalPlacesCount) -} - -// HugeTLBPagesStat includes metrics about huge pages usage -type HugeTLBPagesStat struct { - sigar.HugeTLBPages - UsedPercent float64 `json:"used_p"` -} - -// GetHugeTLBPages returns huge pages usage metrics -func GetHugeTLBPages() (*HugeTLBPagesStat, error) { - pages := sigar.HugeTLBPages{} - err := pages.Get() - - if err == nil { - return &HugeTLBPagesStat{HugeTLBPages: pages}, nil - } - - if sigar.IsNotImplemented(err) { - return nil, nil - } - - return nil, err -} - -// AddHugeTLBPagesPercentage calculates ratio of used huge pages -func AddHugeTLBPagesPercentage(s *HugeTLBPagesStat) { - if s.Total == 0 { - return - } - - perc := float64(s.Total-s.Free+s.Reserved) / float64(s.Total) - s.UsedPercent = common.Round(perc, common.DefaultDecimalPlacesCount) -} - -// GetVMStat gets linux vmstat metrics -func GetVMStat() (*sysinfotypes.VMStatInfo, error) { - h, err := sysinfo.Host() - if err != nil { - return nil, errors.Wrap(err, "failed to read self process information") - } - if vmstatHandle, ok := h.(sysinfotypes.VMStat); ok { - info, err := vmstatHandle.VMStat() - if err != nil { - return nil, errors.Wrap(err, "error getting VMStat info") - } - return info, nil - } - return nil, nil - -} diff --git a/libbeat/metric/system/memory/memory_test.go b/libbeat/metric/system/memory/memory_test.go deleted file mode 100644 index e71e092de52..00000000000 --- a/libbeat/metric/system/memory/memory_test.go +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -// +build !integration -// +build darwin freebsd linux openbsd windows - -package memory - -import ( - "runtime" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/elastic/gosigar" -) - -func TestGetMemory(t *testing.T) { - mem, err := Get() - - assert.NotNil(t, mem) - assert.NoError(t, err) - - assert.True(t, (mem.Total > 0)) - assert.True(t, (mem.Used > 0)) - assert.True(t, (mem.Free >= 0)) - assert.True(t, (mem.ActualFree >= 0)) - assert.True(t, (mem.ActualUsed > 0)) -} - -func TestGetSwap(t *testing.T) { - if runtime.GOOS == "windows" { - return //no load data on windows - } - - swap, err := GetSwap() - - assert.NotNil(t, swap) - assert.NoError(t, err) - - assert.True(t, (swap.Total >= 0)) - assert.True(t, (swap.Used >= 0)) - assert.True(t, (swap.Free >= 0)) -} - -func TestMemPercentage(t *testing.T) { - m := MemStat{ - Mem: gosigar.Mem{ - Total: 7, - Used: 5, - Free: 2, - }, - } - AddMemPercentage(&m) - assert.Equal(t, m.UsedPercent, 0.7143) - - m = MemStat{ - Mem: gosigar.Mem{Total: 0}, - } - AddMemPercentage(&m) - assert.Equal(t, m.UsedPercent, 0.0) -} - -func TestActualMemPercentage(t *testing.T) { - m := MemStat{ - Mem: gosigar.Mem{ - Total: 7, - ActualUsed: 5, - ActualFree: 2, - }, - } - AddMemPercentage(&m) - assert.Equal(t, m.ActualUsedPercent, 0.7143) - - m = MemStat{ - Mem: gosigar.Mem{ - Total: 0, - }, - } - AddMemPercentage(&m) - assert.Equal(t, m.ActualUsedPercent, 0.0) -} diff --git a/libbeat/metric/system/process/process.go b/libbeat/metric/system/process/process.go index 9e7eb5ac932..3a301000a9a 100644 --- a/libbeat/metric/system/process/process.go +++ b/libbeat/metric/system/process/process.go @@ -32,7 +32,7 @@ import ( "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/beats/v7/libbeat/common/match" "github.com/elastic/beats/v7/libbeat/logp" - "github.com/elastic/beats/v7/libbeat/metric/system/memory" + sysinfo "github.com/elastic/go-sysinfo" sigar "github.com/elastic/gosigar" "github.com/elastic/gosigar/cgroup" ) @@ -288,12 +288,20 @@ func GetOwnResourceUsageTimeInMillis() (int64, int64, error) { func (procStats *Stats) getProcessEvent(process *Process) common.MapStr { + // This is a holdover until we migrate this library to metricbeat/internal + // At which point we'll use the memory code there. var totalPhyMem uint64 - baseMem, err := memory.Get() + host, err := sysinfo.Host() if err != nil { - procStats.logger.Warnf("Getting memory details: %v", err) + procStats.logger.Warnf("Getting host details: %v", err) } else { - totalPhyMem = baseMem.Mem.Total + memStats, err := host.Memory() + if err != nil { + procStats.logger.Warnf("Getting memory details: %v", err) + } else { + totalPhyMem = memStats.Total + } + } proc := common.MapStr{ diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 6accbbe91dd..d1e7f2ec657 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -50409,6 +50409,18 @@ format: bytes The total amount of free memory in bytes. This value does not include memory consumed by system caches and buffers (see system.memory.actual.free). +type: long + +format: bytes + +-- + +*`system.memory.cached`*:: ++ +-- +Total Cached memory on system. + + type: long format: bytes diff --git a/metricbeat/internal/metrics/memory/memory.go b/metricbeat/internal/metrics/memory/memory.go new file mode 100644 index 00000000000..73597e8974f --- /dev/null +++ b/metricbeat/internal/metrics/memory/memory.go @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package memory + +import ( + "github.com/pkg/errors" + + "github.com/elastic/beats/v7/libbeat/common" + "github.com/elastic/beats/v7/metricbeat/internal/metrics" +) + +// Memory holds os-specifc memory usage data +// The vast majority of these values are cross-platform +// However, we're wrapping all them for the sake of safety, and for the more variable swap metrics +type Memory struct { + Total metrics.OptUint `struct:"total,omitempty"` + Used UsedMemStats `struct:"used,omitempty"` + + Free metrics.OptUint `struct:"free,omitempty"` + Cached metrics.OptUint `struct:"cached,omitempty"` + // "Actual" values are, technically, a linux-only concept + // For better or worse we've expanded it to include "derived" + // Memory values on other platforms, which we should + // probably keep for the sake of backwards compatibility + // However, because the derived value varies from platform to platform, + // We may want to more precisely document what these mean. + Actual ActualMemoryMetrics `struct:"actual,omitempty"` + + // Swap metrics + Swap SwapMetrics `struct:"swap,omitempty"` +} + +// UsedMemStats wraps used.* memory metrics +type UsedMemStats struct { + Pct metrics.OptFloat `struct:"pct,omitempty"` + Bytes metrics.OptUint `struct:"bytes,omitempty"` +} + +// ActualMemoryMetrics wraps the actual.* memory metrics +type ActualMemoryMetrics struct { + Free metrics.OptUint `struct:"free,omitempty"` + Used UsedMemStats `struct:"used,omitempty"` +} + +// SwapMetrics wraps swap.* memory metrics +type SwapMetrics struct { + Total metrics.OptUint `struct:"total,omitempty"` + Used UsedMemStats `struct:"used,omitempty"` + Free metrics.OptUint `struct:"free,omitempty"` +} + +// Get returns platform-independent memory metrics. +func Get(procfs string) (Memory, error) { + base, err := get(procfs) + if err != nil { + return Memory{}, errors.Wrap(err, "error getting system memory info") + } + base.fillPercentages() + return base, nil +} + +// IsZero implements the zeroer interface for structform's folders +func (used UsedMemStats) IsZero() bool { + return used.Pct.IsZero() && used.Bytes.IsZero() +} + +// IsZero implements the zeroer interface for structform's folders +func (swap SwapMetrics) IsZero() bool { + return swap.Free.IsZero() && swap.Used.IsZero() && swap.Total.IsZero() +} + +func (base *Memory) fillPercentages() { + // Add percentages + // In theory, `Used` and `Total` are available everywhere, so assume values are good. + if base.Total.Exists() && base.Total.ValueOr(0) != 0 { + percUsed := float64(base.Used.Bytes.ValueOr(0)) / float64(base.Total.ValueOr(1)) + base.Used.Pct = metrics.OptFloatWith(common.Round(percUsed, common.DefaultDecimalPlacesCount)) + + actualPercUsed := float64(base.Actual.Used.Bytes.ValueOr(0)) / float64(base.Total.ValueOr(0)) + base.Actual.Used.Pct = metrics.OptFloatWith(common.Round(actualPercUsed, common.DefaultDecimalPlacesCount)) + } + + if base.Swap.Total.ValueOr(0) != 0 && base.Swap.Used.Bytes.Exists() { + perc := float64(base.Swap.Used.Bytes.ValueOr(0)) / float64(base.Swap.Total.ValueOr(0)) + base.Swap.Used.Pct = metrics.OptFloatWith(common.Round(perc, common.DefaultDecimalPlacesCount)) + } +} diff --git a/metricbeat/internal/metrics/memory/memory_aix.go b/metricbeat/internal/metrics/memory/memory_aix.go new file mode 100644 index 00000000000..e936c518479 --- /dev/null +++ b/metricbeat/internal/metrics/memory/memory_aix.go @@ -0,0 +1,75 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package memory + +/* +#cgo LDFLAGS: -L/usr/lib -lperfstat + +#include +#include +#include +#include +#include +#include +#include +#include + +*/ +import "C" + +import ( + "fmt" + "os" + + "github.com/elastic/beats/v7/metricbeat/internal/metrics" +) + +var system struct { + ticks uint64 + btime uint64 + pagesize uint64 +} + +func init() { + // sysconf(_SC_CLK_TCK) returns the number of ticks by second. + system.ticks = uint64(C.sysconf(C._SC_CLK_TCK)) + system.pagesize = uint64(os.Getpagesize()) +} + +func get(_ string) (Memory, error) { + memData := Memory{} + meminfo := C.perfstat_memory_total_t{} + _, err := C.perfstat_memory_total(nil, &meminfo, C.sizeof_perfstat_memory_total_t, 1) + if err != nil { + return memData, fmt.Errorf("perfstat_memory_total: %s", err) + } + + totalMem := uint64(meminfo.real_total) * system.pagesize + freeMem := uint64(meminfo.real_free) * system.pagesize + + memData.Total = metrics.OptUintWith(totalMem) + memData.Free = metrics.OptUintWith(freeMem) + + kern := uint64(meminfo.numperm) * system.pagesize // number of pages in file cache + + memData.Used.Bytes = metrics.OptUintWith(totalMem - freeMem) + memData.Actual.Free = metrics.OptUintWith(freeMem + kern) + memData.Actual.Used.Bytes = metrics.OptUintWith(memData.Used.Bytes.ValueOr(0) - kern) + + return memData, nil +} diff --git a/metricbeat/internal/metrics/memory/memory_darwin.go b/metricbeat/internal/metrics/memory/memory_darwin.go new file mode 100644 index 00000000000..7f9d08e0a8c --- /dev/null +++ b/metricbeat/internal/metrics/memory/memory_darwin.go @@ -0,0 +1,133 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package memory + +/* +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ +import "C" + +import ( + "bytes" + "encoding/binary" + "fmt" + "syscall" + "unsafe" + + "github.com/pkg/errors" + + "github.com/elastic/beats/v7/metricbeat/internal/metrics" +) + +type xswUsage struct { + Total, Avail, Used uint64 +} + +// get is the darwin implementation for fetching Memory data +func get(_ string) (Memory, error) { + var vmstat C.vm_statistics_data_t + + mem := Memory{} + + var total uint64 + + if err := sysctlbyname("hw.memsize", &total); err != nil { + return Memory{}, errors.Wrap(err, "error getting memsize") + } + mem.Total = metrics.OptUintWith(total) + + if err := vmInfo(&vmstat); err != nil { + return Memory{}, errors.Wrap(err, "error getting VM info") + } + + kern := uint64(vmstat.inactive_count) << 12 + free := uint64(vmstat.free_count) << 12 + + mem.Free = metrics.OptUintWith(free) + mem.Used.Bytes = metrics.OptUintWith(total - free) + + mem.Actual.Free = metrics.OptUintWith(free + kern) + mem.Actual.Used.Bytes = metrics.OptUintWith((total - free) - kern) + + var err error + mem.Swap, err = getSwap() + if err != nil { + return mem, errors.Wrap(err, "error getting swap memory") + } + + return mem, nil +} + +// Get fetches swap data +func getSwap() (SwapMetrics, error) { + swUsage := xswUsage{} + + swap := SwapMetrics{} + if err := sysctlbyname("vm.swapusage", &swUsage); err != nil { + return swap, errors.Wrap(err, "error getting swap usage") + } + + swap.Total = metrics.OptUintWith(swUsage.Total) + swap.Used.Bytes = metrics.OptUintWith(swUsage.Used) + swap.Free = metrics.OptUintWith(swUsage.Avail) + + return swap, nil +} + +// generic Sysctl buffer unmarshalling +func sysctlbyname(name string, data interface{}) (err error) { + val, err := syscall.Sysctl(name) + if err != nil { + return err + } + + buf := []byte(val) + + switch v := data.(type) { + case *uint64: + *v = *(*uint64)(unsafe.Pointer(&buf[0])) + return + } + + bbuf := bytes.NewBuffer([]byte(val)) + return binary.Read(bbuf, binary.LittleEndian, data) +} + +func vmInfo(vmstat *C.vm_statistics_data_t) error { + var count C.mach_msg_type_number_t = C.HOST_VM_INFO_COUNT + + status := C.host_statistics( + C.host_t(C.mach_host_self()), + C.HOST_VM_INFO, + C.host_info_t(unsafe.Pointer(vmstat)), + &count) + + if status != C.KERN_SUCCESS { + return fmt.Errorf("host_statistics=%d", status) + } + + return nil +} diff --git a/metricbeat/internal/metrics/memory/memory_freebsd.go b/metricbeat/internal/metrics/memory/memory_freebsd.go new file mode 100644 index 00000000000..13c1ebb0748 --- /dev/null +++ b/metricbeat/internal/metrics/memory/memory_freebsd.go @@ -0,0 +1,90 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package memory + +import ( + "unsafe" + + "github.com/pkg/errors" + + "github.com/elastic/beats/v7/metricbeat/internal/metrics" +) + +/* +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ +import "C" + +func get(_ string) (Memory, error) { + val := C.uint32_t(0) + sc := C.size_t(4) + + memData := Memory{} + + name := C.CString("vm.stats.vm.v_page_count") + _, err := C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) + C.free(unsafe.Pointer(name)) + if err != nil { + return memData, errors.Errorf("error in vm.stats.vm.v_page_count") + } + pagecount := uint64(val) + + name = C.CString("vm.stats.vm.v_page_size") + _, err = C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) + C.free(unsafe.Pointer(name)) + if err != nil { + return memData, errors.Errorf("error in vm.stats.vm.v_page_size") + } + pagesize := uint64(val) + + name = C.CString("vm.stats.vm.v_free_count") + _, err = C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) + C.free(unsafe.Pointer(name)) + if err != nil { + return memData, errors.Errorf("error in vm.stats.vm.v_free_count") + } + + memFree := uint64(val) * pagesize + memData.Free = metrics.OptUintWith(memFree) + + name = C.CString("vm.stats.vm.v_inactive_count") + _, err = C.sysctlbyname(name, unsafe.Pointer(&val), &sc, nil, 0) + C.free(unsafe.Pointer(name)) + if err != nil { + return memData, errors.Errorf("error in vm.stats.vm.v_inactive_count") + } + kern := uint64(val) + + memTotal := uint64(pagecount * pagesize) + + memData.Total = metrics.OptUintWith(memTotal) + + memData.Used.Bytes = metrics.OptUintWith(memTotal - memFree) + memData.Actual.Free = metrics.OptUintWith(memFree + (kern * pagesize)) + memData.Actual.Used.Bytes = metrics.OptUintWith((memTotal - memFree) - (kern * pagesize)) + + return memData, nil +} diff --git a/metricbeat/internal/metrics/memory/memory_linux.go b/metricbeat/internal/metrics/memory/memory_linux.go new file mode 100644 index 00000000000..dc563e1b47d --- /dev/null +++ b/metricbeat/internal/metrics/memory/memory_linux.go @@ -0,0 +1,143 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package memory + +import ( + "bufio" + "bytes" + "io" + "io/ioutil" + "path/filepath" + "strconv" + "strings" + + "github.com/pkg/errors" + + "github.com/elastic/beats/v7/metricbeat/internal/metrics" +) + +// get is the linux implementation for fetching Memory data +func get(rootfs string) (Memory, error) { + table, err := ParseMeminfo(rootfs) + if err != nil { + return Memory{}, errors.Wrap(err, "error fetching meminfo") + } + + memData := Memory{} + + var free, cached uint64 + if total, ok := table["MemTotal"]; ok { + memData.Total = metrics.OptUintWith(total) + } + if free, ok := table["MemFree"]; ok { + memData.Free = metrics.OptUintWith(free) + } + if cached, ok := table["Cached"]; ok { + memData.Cached = metrics.OptUintWith(cached) + } + + // overlook parsing issues here + // On the very small chance some of these don't exist, + // It's not the end of the world + buffers, _ := table["Buffers"] + + if memAvail, ok := table["MemAvailable"]; ok { + // MemAvailable is in /proc/meminfo (kernel 3.14+) + memData.Actual.Free = metrics.OptUintWith(memAvail) + } else { + // in the future we may want to find another way to do this. + // "MemAvailable" and other more derivied metrics + // Are very relative, and can be unhelpful in cerntain workloads + // We may want to find a way to more clearly express to users + // where a certain value is coming from and what it represents + + // The use of `cached` here is particularly concerning, + // as under certain intense DB server workloads, the cached memory can be quite large + // and give the impression that we've passed memory usage watermark + memData.Actual.Free = metrics.OptUintWith(free + buffers + cached) + } + + memData.Used.Bytes = metrics.OptUintWith(memData.Total.ValueOr(0) - memData.Free.ValueOr(0)) + memData.Actual.Used.Bytes = metrics.OptUintWith(memData.Total.ValueOr(0) - memData.Actual.Free.ValueOr(0)) + + // Populate swap data + swapTotal, okST := table["SwapTotal"] + if okST { + memData.Swap.Total = metrics.OptUintWith(swapTotal) + } + swapFree, okSF := table["SwapFree"] + if okSF { + memData.Swap.Free = metrics.OptUintWith(swapFree) + } + + if okSF && okST { + memData.Swap.Used.Bytes = metrics.OptUintWith(swapTotal - swapFree) + } + + return memData, nil + +} + +// ParseMeminfo parses the contents of /proc/meminfo into a hashmap +func ParseMeminfo(rootfs string) (map[string]uint64, error) { + table := map[string]uint64{} + + meminfoPath := filepath.Join(rootfs, "/proc/meminfo") + err := readFile(meminfoPath, func(line string) bool { + fields := strings.Split(line, ":") + + if len(fields) != 2 { + return true // skip on errors + } + + valueUnit := strings.Fields(fields[1]) + value, err := strconv.ParseUint(valueUnit[0], 10, 64) + if err != nil { + return true // skip on errors + } + + if len(valueUnit) > 1 && valueUnit[1] == "kB" { + value *= 1024 + } + table[fields[0]] = value + + return true + }) + return table, err +} + +func readFile(file string, handler func(string) bool) error { + contents, err := ioutil.ReadFile(file) + if err != nil { + return errors.Wrapf(err, "error reading file %s", file) + } + + reader := bufio.NewReader(bytes.NewBuffer(contents)) + + for { + line, _, err := reader.ReadLine() + if err == io.EOF { + break + } + if !handler(string(line)) { + break + } + } + + return nil +} diff --git a/metricbeat/internal/metrics/memory/memory_openbsd.go b/metricbeat/internal/metrics/memory/memory_openbsd.go new file mode 100644 index 00000000000..51e6ef830e3 --- /dev/null +++ b/metricbeat/internal/metrics/memory/memory_openbsd.go @@ -0,0 +1,236 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package memory + +/* +#include +#include +#include +#include +#include +#include +#include +#include +*/ +import "C" + +import ( + "syscall" + "unsafe" + + "github.com/pkg/errors" + + "github.com/elastic/beats/v7/metricbeat/internal/metrics" +) + +// Uvmexp wraps memory data from sysctl +type Uvmexp struct { + pagesize uint32 + pagemask uint32 + pageshift uint32 + npages uint32 + free uint32 + active uint32 + inactive uint32 + paging uint32 + wired uint32 + zeropages uint32 + reserve_pagedaemon uint32 + reserve_kernel uint32 + anonpages uint32 + vnodepages uint32 + vtextpages uint32 + freemin uint32 + freetarg uint32 + inactarg uint32 + wiredmax uint32 + anonmin uint32 + vtextmin uint32 + vnodemin uint32 + anonminpct uint32 + vtextmi uint32 + npct uint32 + vnodeminpct uint32 + nswapdev uint32 + swpages uint32 + swpginuse uint32 + swpgonly uint32 + nswget uint32 + nanon uint32 + nanonneeded uint32 + nfreeanon uint32 + faults uint32 + traps uint32 + intrs uint32 + swtch uint32 + softs uint32 + syscalls uint32 + pageins uint32 + obsolete_swapins uint32 + obsolete_swapouts uint32 + pgswapin uint32 + pgswapout uint32 + forks uint32 + forks_ppwait uint32 + forks_sharevm uint32 + pga_zerohit uint32 + pga_zeromiss uint32 + zeroaborts uint32 + fltnoram uint32 + fltnoanon uint32 + fltpgwait uint32 + fltpgrele uint32 + fltrelck uint32 + fltrelckok uint32 + fltanget uint32 + fltanretry uint32 + fltamcopy uint32 + fltnamap uint32 + fltnomap uint32 + fltlget uint32 + fltget uint32 + flt_anon uint32 + flt_acow uint32 + flt_obj uint32 + flt_prcopy uint32 + flt_przero uint32 + pdwoke uint32 + pdrevs uint32 + pdswout uint32 + pdfreed uint32 + pdscans uint32 + pdanscan uint32 + pdobscan uint32 + pdreact uint32 + pdbusy uint32 + pdpageouts uint32 + pdpending uint32 + pddeact uint32 + pdreanon uint32 + pdrevnode uint32 + pdrevtext uint32 + fpswtch uint32 + kmapent uint32 +} + +// Bcachestats reports cache stats from sysctl +type Bcachestats struct { + numbufs uint64 + numbufpages uint64 + numdirtypages uint64 + numcleanpages uint64 + pendingwrites uint64 + pendingreads uint64 + numwrites uint64 + numreads uint64 + cachehits uint64 + busymapped uint64 + dmapages uint64 + highpages uint64 + delwribufs uint64 + kvaslots uint64 + kvaslots_avail uint64 +} + +// Swapent reports swap metrics from sysctl +type Swapent struct { + se_dev C.dev_t + se_flags int32 + se_nblks int32 + se_inuse int32 + se_priority int32 + sw_path []byte +} + +func get(_ string) (Memory, error) { + + memData := Memory{} + + n := uintptr(0) + var uvmexp Uvmexp + mib := [2]int32{C.CTL_VM, C.VM_UVMEXP} + n = uintptr(0) + // First we determine how much memory we'll need to pass later on (via `n`) + _, _, errno := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, 0, uintptr(unsafe.Pointer(&n)), 0, 0) + if errno != 0 || n == 0 { + return memData, errors.Errorf("Error in size VM_UVMEXP sysctl call, errno %d", errno) + } + + _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 2, uintptr(unsafe.Pointer(&uvmexp)), uintptr(unsafe.Pointer(&n)), 0, 0) + if errno != 0 || n == 0 { + return memData, errors.Errorf("Error in VM_UVMEXP sysctl call, errno %d", errno) + } + + var bcachestats Bcachestats + mib3 := [3]int32{C.CTL_VFS, C.VFS_GENERIC, C.VFS_BCACHESTAT} + n = uintptr(0) + _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib3[0])), 3, 0, uintptr(unsafe.Pointer(&n)), 0, 0) + if errno != 0 || n == 0 { + return memData, errors.Errorf("Error in size VFS_BCACHESTAT sysctl call, errno %d", errno) + } + _, _, errno = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib3[0])), 3, uintptr(unsafe.Pointer(&bcachestats)), uintptr(unsafe.Pointer(&n)), 0, 0) + if errno != 0 || n == 0 { + return memData, errors.Errorf("Error in VFS_BCACHESTAT sysctl call, errno %d", errno) + } + + memFree := uint64(uvmexp.free) << uvmexp.pageshift + memUsed := uint64(uvmexp.npages-uvmexp.free) << uvmexp.pageshift + + memData.Total = metrics.OptUintWith(uint64(uvmexp.npages) << uvmexp.pageshift) + memData.Used.Bytes = metrics.OptUintWith(memUsed) + memData.Free = metrics.OptUintWith(memFree) + + memData.Actual.Free = metrics.OptUintWith(memFree + (uint64(bcachestats.numbufpages) << uvmexp.pageshift)) + memData.Actual.Used.Bytes = metrics.OptUintWith(memUsed - (uint64(bcachestats.numbufpages) << uvmexp.pageshift)) + + var err error + memData.Swap, err = getSwap() + if err != nil { + return memData, errors.Wrap(err, "error getting swap data") + } + + return memData, nil +} + +func getSwap() (SwapMetrics, error) { + swapData := SwapMetrics{} + nswap := C.swapctl(C.SWAP_NSWAP, unsafe.Pointer(uintptr(0)), 0) + + // If there are no swap devices, nothing to do here. + if nswap == 0 { + return swapData, nil + } + + swdev := make([]Swapent, nswap) + + rnswap := C.swapctl(C.SWAP_STATS, unsafe.Pointer(&swdev[0]), nswap) + if rnswap == 0 { + return swapData, errors.Errorf("error in SWAP_STATS sysctl, swapctl returned %d", rnswap) + } + + for i := 0; i < int(nswap); i++ { + if swdev[i].se_flags&C.SWF_ENABLE == 2 { + swapData.Used.Bytes = metrics.OptUintWith(swapData.Used.Bytes.ValueOr(0) + uint64(swdev[i].se_inuse/(1024/C.DEV_BSIZE))) + swapData.Total = metrics.OptUintWith(swapData.Total.ValueOr(0) + uint64(swdev[i].se_nblks/(1024/C.DEV_BSIZE))) + } + } + + swapData.Free = metrics.OptUintWith(swapData.Total.ValueOr(0) - swapData.Used.Bytes.ValueOr(0)) + + return swapData, nil +} diff --git a/metricbeat/internal/metrics/memory/memory_test.go b/metricbeat/internal/metrics/memory/memory_test.go new file mode 100644 index 00000000000..5b7908290ec --- /dev/null +++ b/metricbeat/internal/metrics/memory/memory_test.go @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// +build !integration +// +build darwin freebsd linux openbsd windows + +package memory + +import ( + "runtime" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/v7/metricbeat/internal/metrics" +) + +func TestGetMemory(t *testing.T) { + mem, err := Get("") + + assert.NotNil(t, mem) + assert.NoError(t, err) + + assert.True(t, mem.Total.Exists()) + assert.True(t, (mem.Total.ValueOr(0) > 0)) + + assert.True(t, mem.Used.Bytes.Exists()) + assert.True(t, (mem.Used.Bytes.ValueOr(0) > 0)) + + assert.True(t, mem.Free.Exists()) + assert.True(t, (mem.Free.ValueOr(0) >= 0)) + + assert.True(t, mem.Actual.Free.Exists()) + assert.True(t, (mem.Actual.Free.ValueOr(0) >= 0)) + + assert.True(t, mem.Actual.Used.Bytes.Exists()) + assert.True(t, (mem.Actual.Used.Bytes.ValueOr(0) > 0)) +} + +func TestGetSwap(t *testing.T) { + if runtime.GOOS == "freebsd" { + return //no load data on freebsd + } + + mem, err := Get("") + + assert.NotNil(t, mem) + assert.NoError(t, err) + + assert.True(t, mem.Swap.Total.Exists()) + assert.True(t, (mem.Swap.Total.ValueOr(0) >= 0)) + + assert.True(t, mem.Swap.Used.Bytes.Exists()) + assert.True(t, (mem.Swap.Used.Bytes.ValueOr(0) >= 0)) + + assert.True(t, mem.Swap.Free.Exists()) + assert.True(t, (mem.Swap.Free.ValueOr(0) >= 0)) +} + +func TestMemPercentage(t *testing.T) { + m := Memory{ + Total: metrics.OptUintWith(7), + Used: UsedMemStats{Bytes: metrics.OptUintWith(5)}, + Free: metrics.OptUintWith(2), + } + m.fillPercentages() + assert.Equal(t, m.Used.Pct.ValueOr(0), 0.7143) + + m = Memory{ + Total: metrics.OptUintWith(0), + } + m.fillPercentages() + assert.Equal(t, m.Used.Pct.ValueOr(0), 0.0) +} + +func TestActualMemPercentage(t *testing.T) { + m := Memory{ + Total: metrics.OptUintWith(7), + Actual: ActualMemoryMetrics{ + Used: UsedMemStats{Bytes: metrics.OptUintWith(5)}, + Free: metrics.OptUintWith(2), + }, + } + + m.fillPercentages() + assert.Equal(t, m.Actual.Used.Pct.ValueOr(0), 0.7143) + +} diff --git a/metricbeat/internal/metrics/memory/memory_windows.go b/metricbeat/internal/metrics/memory/memory_windows.go new file mode 100644 index 00000000000..b19bf977091 --- /dev/null +++ b/metricbeat/internal/metrics/memory/memory_windows.go @@ -0,0 +1,51 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package memory + +import ( + "github.com/pkg/errors" + + "github.com/elastic/beats/v7/metricbeat/internal/metrics" + "github.com/elastic/go-windows" +) + +// get is the windows implementation of get for memory metrics +func get(_ string) (Memory, error) { + + memData := Memory{} + + memoryStatusEx, err := windows.GlobalMemoryStatusEx() + if err != nil { + return memData, errors.Wrap(err, "Error fetching global memory status") + } + memData.Total = metrics.OptUintWith(memoryStatusEx.TotalPhys) + memData.Free = metrics.OptUintWith(memoryStatusEx.AvailPhys) + + memData.Used.Bytes = metrics.OptUintWith(memoryStatusEx.TotalPhys - memoryStatusEx.AvailPhys) + + // We shouldn't really be doing this, but we also don't want to make breaking changes right now, + // and memory.actual is used by quite a few visualizations + memData.Actual.Free = memData.Free + memData.Actual.Used.Bytes = memData.Used.Bytes + + memData.Swap.Free = metrics.OptUintWith(memoryStatusEx.AvailPageFile) + memData.Swap.Total = metrics.OptUintWith(memoryStatusEx.TotalPageFile) + memData.Swap.Used.Bytes = metrics.OptUintWith(memoryStatusEx.TotalPageFile - memoryStatusEx.AvailPageFile) + + return memData, nil +} diff --git a/metricbeat/internal/metrics/opt.go b/metricbeat/internal/metrics/opt.go index f2cdfb0f05c..a5f28975252 100644 --- a/metricbeat/internal/metrics/opt.go +++ b/metricbeat/internal/metrics/opt.go @@ -17,6 +17,10 @@ package metrics +import "github.com/elastic/go-structform" + +// Uint + // OptUint is a wrapper for "optional" types, with the bool value indicating // if the stored int is a legitimate value. type OptUint struct { @@ -24,8 +28,8 @@ type OptUint struct { value uint64 } -// NewNone returns a new OptUint wrapper -func NewNone() OptUint { +// NewUintNone returns a new OptUint wrapper +func NewUintNone() OptUint { return OptUint{ exists: false, value: 0, @@ -45,6 +49,11 @@ func (opt OptUint) IsZero() bool { return !opt.exists } +// Exists returns true if the underlying value exists +func (opt OptUint) Exists() bool { + return opt.exists +} + // ValueOr returns the stored value, or a given int // Please do not use this for populating reported data, // as we actually want to avoid sending zeros where values are functionally null @@ -63,3 +72,70 @@ func SumOptUint(opts ...OptUint) uint64 { } return sum } + +// Fold implements the folder interface for OptUint +func (in *OptUint) Fold(v structform.ExtVisitor) error { + if in.exists { + value := in.value + v.OnUint64(value) + } else { + v.OnNil() + } + return nil +} + +// Float + +// OptFloat is a wrapper for "optional" types, with the bool value indicating +// if the stored int is a legitimate value. +type OptFloat struct { + exists bool + value float64 +} + +// NewFloatNone returns a new uint wrapper +func NewFloatNone() OptFloat { + return OptFloat{ + exists: false, + value: 0, + } +} + +// OptFloatWith returns a new uint wrapper for the specified value +func OptFloatWith(f float64) OptFloat { + return OptFloat{ + exists: true, + value: f, + } +} + +// IsZero returns true if the underlying value nil +func (opt OptFloat) IsZero() bool { + return !opt.exists +} + +// Exists returns true if the underlying value exists +func (opt OptFloat) Exists() bool { + return opt.exists +} + +// ValueOr returns the stored value, or zero +// Please do not use this for populating reported data, +// as we actually want to avoid sending zeros where values are functionally null +func (opt OptFloat) ValueOr(f float64) float64 { + if opt.exists { + return opt.value + } + return f +} + +// Fold implements the folder interface for OptUint +func (in *OptFloat) Fold(v structform.ExtVisitor) error { + if in.exists { + value := in.value + v.OnFloat64(value) + } else { + v.OnNil() + } + return nil +} diff --git a/metricbeat/module/linux/memory/_meta/data.json b/metricbeat/module/linux/memory/_meta/data.json index 79a3d431869..cb4acfe5da0 100644 --- a/metricbeat/module/linux/memory/_meta/data.json +++ b/metricbeat/module/linux/memory/_meta/data.json @@ -26,25 +26,25 @@ }, "page_stats": { "direct_efficiency": { - "pct": 0.9228 + "pct": 0.9839 }, "kswapd_efficiency": { - "pct": 0.7523 + "pct": 0.7739 }, "pgfree": { - "pages": 16061818710 + "pages": 40941189636 }, "pgscan_direct": { - "pages": 1198580 + "pages": 1199988 }, "pgscan_kswapd": { - "pages": 50222460 + "pages": 19970993 }, "pgsteal_direct": { - "pages": 1106083 + "pages": 1180686 }, "pgsteal_kswapd": { - "pages": 37782783 + "pages": 15456470 } } } diff --git a/metricbeat/module/linux/memory/data.go b/metricbeat/module/linux/memory/data.go index d3f1a5ef2f8..eb4706e02f0 100644 --- a/metricbeat/module/linux/memory/data.go +++ b/metricbeat/module/linux/memory/data.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -// +build darwin freebsd linux openbsd windows +// +build linux package memory @@ -23,77 +23,128 @@ import ( "github.com/pkg/errors" "github.com/elastic/beats/v7/libbeat/common" - mem "github.com/elastic/beats/v7/libbeat/metric/system/memory" + "github.com/elastic/beats/v7/metricbeat/internal/metrics/memory" + sysinfo "github.com/elastic/go-sysinfo" + sysinfotypes "github.com/elastic/go-sysinfo/types" ) // FetchLinuxMemStats gets page_stat and huge pages data for linux func FetchLinuxMemStats(baseMap common.MapStr) error { - vmstat, err := mem.GetVMStat() + vmstat, err := GetVMStat() if err != nil { - return errors.Wrap(err, "VMStat") + return errors.Wrap(err, "error fetching VMStats") } - if vmstat != nil { - pageStats := common.MapStr{ - "pgscan_kswapd": common.MapStr{ - "pages": vmstat.PgscanKswapd, - }, - "pgscan_direct": common.MapStr{ - "pages": vmstat.PgscanDirect, - }, - "pgfree": common.MapStr{ - "pages": vmstat.Pgfree, - }, - "pgsteal_kswapd": common.MapStr{ - "pages": vmstat.PgstealKswapd, - }, - "pgsteal_direct": common.MapStr{ - "pages": vmstat.PgstealDirect, - }, - } - // This is similar to the vmeff stat gathered by sar - // these ratios calculate thhe efficiency of page reclaim - if vmstat.PgscanDirect != 0 { - pageStats["direct_efficiency"] = common.MapStr{ - "pct": common.Round(float64(vmstat.PgstealDirect)/float64(vmstat.PgscanDirect), common.DefaultDecimalPlacesCount), - } + pageStats := common.MapStr{ + "pgscan_kswapd": common.MapStr{ + "pages": vmstat.PgscanKswapd, + }, + "pgscan_direct": common.MapStr{ + "pages": vmstat.PgscanDirect, + }, + "pgfree": common.MapStr{ + "pages": vmstat.Pgfree, + }, + "pgsteal_kswapd": common.MapStr{ + "pages": vmstat.PgstealKswapd, + }, + "pgsteal_direct": common.MapStr{ + "pages": vmstat.PgstealDirect, + }, + } + // This is similar to the vmeff stat gathered by sar + // these ratios calculate thhe efficiency of page reclaim + if vmstat.PgscanDirect != 0 { + pageStats["direct_efficiency"] = common.MapStr{ + "pct": common.Round(float64(vmstat.PgstealDirect)/float64(vmstat.PgscanDirect), common.DefaultDecimalPlacesCount), } + } - if vmstat.PgscanKswapd != 0 { - pageStats["kswapd_efficiency"] = common.MapStr{ - "pct": common.Round(float64(vmstat.PgstealKswapd)/float64(vmstat.PgscanKswapd), common.DefaultDecimalPlacesCount), - } + if vmstat.PgscanKswapd != 0 { + pageStats["kswapd_efficiency"] = common.MapStr{ + "pct": common.Round(float64(vmstat.PgstealKswapd)/float64(vmstat.PgscanKswapd), common.DefaultDecimalPlacesCount), } - baseMap["page_stats"] = pageStats + } + baseMap["page_stats"] = pageStats + + thp, err := getHugePages() + if err != nil { + return errors.Wrap(err, "error getting huge pages") + } + thp["swap"] = common.MapStr{ + "out": common.MapStr{ + "pages": vmstat.ThpSwpout, + "fallback": vmstat.ThpSwpoutFallback, + }, } - hugePagesStat, err := mem.GetHugeTLBPages() + baseMap["hugepages"] = thp + + return nil +} + +func getHugePages() (common.MapStr, error) { + // see https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt + table, err := memory.ParseMeminfo("") if err != nil { - return errors.Wrap(err, "hugepages") + return nil, errors.Wrap(err, "error parsing meminfo") } - if hugePagesStat != nil { - mem.AddHugeTLBPagesPercentage(hugePagesStat) - thp := common.MapStr{ - "total": hugePagesStat.Total, - "used": common.MapStr{ - "bytes": hugePagesStat.TotalAllocatedSize, - "pct": hugePagesStat.UsedPercent, - }, - "free": hugePagesStat.Free, - "reserved": hugePagesStat.Reserved, - "surplus": hugePagesStat.Surplus, - "default_size": hugePagesStat.DefaultSize, + thp := common.MapStr{} + + total, okTotal := table["HugePages_Total"] + free, okFree := table["HugePages_Free"] + reserved, okReserved := table["HugePages_Rsvd"] + totalSize, okTotalSize := table["Hugetlb"] + defaultSize, okDefaultSize := table["Hugepagesize"] + + // Calculate percentages + if okTotal && okFree && okReserved { + thp.Put("total", total) + thp.Put("free", free) + thp.Put("reserved", reserved) + + // TODO: this repliactes the behavior of metricbeat in the past, + // but it might be possilbe to do something like (HugePages_Total*Hugepagesize)-Hugetlb / (HugePages_Total*Hugepagesize) + var perc float64 + if total > 0 { + perc = float64(total-free+reserved) / float64(total) } - if vmstat != nil { - thp["swap"] = common.MapStr{ - "out": common.MapStr{ - "pages": vmstat.ThpSwpout, - "fallback": vmstat.ThpSwpoutFallback, - }, - } + thp.Put("used.pct", common.Round(perc, common.DefaultDecimalPlacesCount)) + + if !okTotalSize && okDefaultSize { + thp.Put("used.bytes", (total-free+reserved)*defaultSize) } - baseMap["hugepages"] = thp } - return nil + if okTotalSize { + thp.Put("used.bytes", totalSize) + } + if okDefaultSize { + thp.Put("default_size", defaultSize) + } + if surplus, ok := table["HugePages_Surp"]; ok { + thp.Put("surplus", surplus) + } + + return thp, nil +} + +// GetVMStat gets linux vmstat metrics +func GetVMStat() (*sysinfotypes.VMStatInfo, error) { + // TODO: We may want to pull this code out of go-sysinfo. + // It's platform specific, and not used by anything else. + h, err := sysinfo.Host() + if err != nil { + return nil, errors.Wrap(err, "failed to read self process information") + } + vmstatHandle, ok := h.(sysinfotypes.VMStat) + if !ok { + return nil, errors.Wrap(err, "VMStat not available for platform") + } + info, err := vmstatHandle.VMStat() + if err != nil { + return nil, errors.Wrap(err, "error getting VMStat info") + } + return info, nil + } diff --git a/libbeat/metric/system/memory/doc.go b/metricbeat/module/linux/memory/doc.go similarity index 100% rename from libbeat/metric/system/memory/doc.go rename to metricbeat/module/linux/memory/doc.go diff --git a/metricbeat/module/linux/memory/memory.go b/metricbeat/module/linux/memory/memory.go index 163e3bea771..13f080196ad 100644 --- a/metricbeat/module/linux/memory/memory.go +++ b/metricbeat/module/linux/memory/memory.go @@ -15,9 +15,13 @@ // specific language governing permissions and limitations // under the License. +// +build linux + package memory import ( + "github.com/pkg/errors" + "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/beats/v7/libbeat/common/cfgwarn" "github.com/elastic/beats/v7/metricbeat/mb" @@ -54,7 +58,10 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { // of an error set the Error field of mb.Event or simply call report.Error(). func (m *MetricSet) Fetch(report mb.ReporterV2) error { rootEvent := common.MapStr{} - FetchLinuxMemStats(rootEvent) + err := FetchLinuxMemStats(rootEvent) + if err != nil { + return errors.Wrap(err, "error fetching memory stats") + } report.Event(mb.Event{ MetricSetFields: rootEvent, }) diff --git a/metricbeat/module/linux/memory/memory_test.go b/metricbeat/module/linux/memory/memory_test.go index 2980c94841e..52b0bdcc7e1 100644 --- a/metricbeat/module/linux/memory/memory_test.go +++ b/metricbeat/module/linux/memory/memory_test.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -// +build darwin freebsd linux openbsd windows +// +build linux package memory diff --git a/metricbeat/module/system/fields.go b/metricbeat/module/system/fields.go index fdeeea5f9c6..ffde1aef0bc 100644 --- a/metricbeat/module/system/fields.go +++ b/metricbeat/module/system/fields.go @@ -32,5 +32,5 @@ func init() { // AssetSystem returns asset data. // This is the base64 encoded gzipped contents of module/system. func AssetSystem() string { - return "eJzsff+PGzey5+/5KwgfFhm/m5E93mzevvnhAMfzcjeAvR7YDt4DDgeZ6i5J3GGTHZItWfnrDyyyv7PV3VJLIy8yWGSTGYn8VLFYrCoWq27IE+zuiN5pA8kPhBhmONyRF5/xFy9+ICQGHSmWGibFHflfPxBCiPsj0YaaTJMEjGKRviacPQF59/gboSImCSRS7Uim6QquiVlTQ6gCEknOITIQk6WSCTFrIDIFRQ0TK49i9gMhei2VmUdSLNnqjhiVwQ+EKOBANdyRFf2BkCUDHus7BHRDBE3gjqRKRqA1/o4Qs0vth5XMUv+bAC3259F9Ladk5v9QnaE6i6Ubit/m8zzBbitVXPl9x2z258sacrBuuBn5VSoC32iSIv9VJgQTqxez1uxRms3SyLTm1xHlEM+XXNLqH5dSJdTckRRUBM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bWPhG0QZphIdww+smjVaJMLfGj9xZ0itZ+plxvl8hCjUbeDu1ITP+HcytN/2iMwEuXRtYXL7mZX5CD5AcJQF3S6BfXD/kLcox0I4i7q5CL0xib1uua9M3ecQhzNfLDDkYTe6ai8ZbSCQIDEhlmIKNH46+5NPuS6uQfmha9NTzaqbIRO0qvpQfxRfdSXzgM912d6hDM0Uxa99DjKm5rqAWurajv4BM/JOKgU6xUKfRua1tjTgnf4rqzFf6Z1+JcC8Yunmp1cmSucJJDPysaPNTHeKY7jY/NGdP/pXlwwMAEmVrun+HPfulR6IFhG7ve4XyU8LsRX5fGm7+buXgi4dMjUBuT7p5/swvXICfBbaPj3ThAfaWgRMr1sXfScAWN4BVqYdxc2ISw3zLe0sm3IStA2EVkfMSyTz4GVYHbdhyWXALoAMQa13Yq7DDRTPCjrHMRSzgqjZJP1ZMFscQzAvmcA1aYaCzg66ADIGdTP+82yo3wxBzak2cxqFbmDOCjrHMQSz1TVnOUH6VR4TqxDiwkmLJzVff7v/FzFfLSHPaL5m8SWar/tXlww0X89t/HWh3vMvxe5IG/XKR0cJvrohvtYrOfinHGKVi4r7lI8lHHnV5huBzJJwNkPgaiDfPvlXG39mIs3MPP9Qwjhn4fSBAcmsHz/ntGInoXKodqpYpkHpXt4fkCj2Xq5WEN8U5d1BayZFM4C8j8cd4bSDU3zLB2geTHBWDa1640fM+1ZUr0a4XDGruZpT7HnrdiTN979k2mdxuq6eAzgQuIQ9EoX9epEjVJGGjgUI5YocswaF8A1NTalfTwSRLKTk0IoP9CKxX8OOGJHTTDS/GdrLkWNSxcIrkle9bST97cEQyamlorIaTkHHgVnKlH8atw6rg/PJ14B9pMnjMJ3g1mg+8sq19wh9W7sW9HfSZbnYBqDyX/5/AAAA///lIhrz" } diff --git a/metricbeat/module/system/memory/_meta/data.json b/metricbeat/module/system/memory/_meta/data.json index 06abee40a35..ce7da4541cf 100644 --- a/metricbeat/module/system/memory/_meta/data.json +++ b/metricbeat/module/system/memory/_meta/data.json @@ -15,13 +15,14 @@ "system": { "memory": { "actual": { - "free": 8461623296, + "free": 46533455872, "used": { - "bytes": 7159164928, - "pct": 0.4583 + "bytes": 20981358592, + "pct": 0.3108 } }, - "free": 1299234816, + "cached": 42114609152, + "free": 3916599296, "hugepages": { "default_size": 2097152, "free": 0, @@ -41,49 +42,49 @@ }, "page_stats": { "direct_efficiency": { - "pct": 0.9242 + "pct": 0.9871 }, "kswapd_efficiency": { - "pct": 0.7518 + "pct": 0.7105 }, "pgfree": { - "pages": 15924304810 + "pages": 69780946234 }, "pgscan_direct": { - "pages": 1185751 + "pages": 1512375 }, "pgscan_kswapd": { - "pages": 50008148 + "pages": 25880646 }, "pgsteal_direct": { - "pages": 1095884 + "pages": 1492831 }, "pgsteal_kswapd": { - "pages": 37594071 + "pages": 18387096 } }, "swap": { - "free": 7823421440, + "free": 8560832512, "in": { - "pages": 2702 + "pages": 727 }, "out": { - "pages": 23582 + "pages": 11197 }, "readahead": { - "cached": 554, - "pages": 986 + "cached": 9, + "pages": 45 }, - "total": 7897870336, + "total": 8589930496, "used": { - "bytes": 74448896, - "pct": 0.0094 + "bytes": 29097984, + "pct": 0.0034 } }, - "total": 15620788224, + "total": 67514814464, "used": { - "bytes": 14321553408, - "pct": 0.9168 + "bytes": 63598215168, + "pct": 0.942 } } } diff --git a/metricbeat/module/system/memory/_meta/fields.yml b/metricbeat/module/system/memory/_meta/fields.yml index ab80bf3ba28..9a8a7714a5e 100644 --- a/metricbeat/module/system/memory/_meta/fields.yml +++ b/metricbeat/module/system/memory/_meta/fields.yml @@ -23,6 +23,12 @@ The total amount of free memory in bytes. This value does not include memory consumed by system caches and buffers (see system.memory.actual.free). + - name: cached + type: long + format: bytes + description: > + Total Cached memory on system. + - name: used.pct type: scaled_float format: percent diff --git a/metricbeat/module/system/memory/helper_linux.go b/metricbeat/module/system/memory/helper_linux.go new file mode 100644 index 00000000000..a0ba099afae --- /dev/null +++ b/metricbeat/module/system/memory/helper_linux.go @@ -0,0 +1,32 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package memory + +import ( + "github.com/elastic/beats/v7/libbeat/common" + linux "github.com/elastic/beats/v7/metricbeat/module/linux/memory" + sysinfotypes "github.com/elastic/go-sysinfo/types" +) + +func fetchLinuxMemStats(baseMap common.MapStr) error { + return linux.FetchLinuxMemStats(baseMap) +} + +func getVMStat() (*sysinfotypes.VMStatInfo, error) { + return linux.GetVMStat() +} diff --git a/metricbeat/module/system/memory/helper_other.go b/metricbeat/module/system/memory/helper_other.go new file mode 100644 index 00000000000..adbeba59aa6 --- /dev/null +++ b/metricbeat/module/system/memory/helper_other.go @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// +build darwin freebsd aix openbsd windows + +package memory + +import ( + "errors" + + "github.com/elastic/beats/v7/libbeat/common" + sysinfotypes "github.com/elastic/go-sysinfo/types" +) + +// These whole helper files are a shim until we can make breaking changes and remove these +// data enrichers from the metricset, as they're linux-only. +// DEPRECATE: 8.0 +func fetchLinuxMemStats(baseMap common.MapStr) error { + return errors.New("MemStats is only available on Linux") +} + +func getVMStat() (*sysinfotypes.VMStatInfo, error) { + return nil, errors.New("VMStat is only available on Linux") +} diff --git a/metricbeat/module/system/memory/memory.go b/metricbeat/module/system/memory/memory.go index 26c6bea1867..54565231c53 100644 --- a/metricbeat/module/system/memory/memory.go +++ b/metricbeat/module/system/memory/memory.go @@ -21,14 +21,15 @@ package memory import ( "fmt" + "runtime" "github.com/pkg/errors" "github.com/elastic/beats/v7/libbeat/common" - mem "github.com/elastic/beats/v7/libbeat/metric/system/memory" + "github.com/elastic/beats/v7/libbeat/common/transform/typeconv" + metrics "github.com/elastic/beats/v7/metricbeat/internal/metrics/memory" "github.com/elastic/beats/v7/metricbeat/mb" "github.com/elastic/beats/v7/metricbeat/mb/parse" - linux "github.com/elastic/beats/v7/metricbeat/module/linux/memory" "github.com/elastic/beats/v7/metricbeat/module/system" ) @@ -58,74 +59,34 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { // Fetch fetches memory metrics from the OS. func (m *MetricSet) Fetch(r mb.ReporterV2) error { - memStat, err := mem.Get() - if err != nil { - return errors.Wrap(err, "memory") - } - mem.AddMemPercentage(memStat) - swapStat, err := mem.GetSwap() + eventRaw, err := metrics.Get("") if err != nil { - return errors.Wrap(err, "swap") - } - mem.AddSwapPercentage(swapStat) - - memory := common.MapStr{ - "total": memStat.Total, - "used": common.MapStr{ - "bytes": memStat.Used, - "pct": memStat.UsedPercent, - }, - "free": memStat.Free, - "actual": common.MapStr{ - "free": memStat.ActualFree, - "used": common.MapStr{ - "pct": memStat.ActualUsedPercent, - "bytes": memStat.ActualUsed, - }, - }, + return errors.Wrap(err, "error fetching memory metrics") } - vmstat, err := mem.GetVMStat() - if err != nil { - return errors.Wrap(err, "VMStat") - } - - swap := common.MapStr{ - "total": swapStat.Total, - "used": common.MapStr{ - "bytes": swapStat.Used, - "pct": swapStat.UsedPercent, - }, - "free": swapStat.Free, - } - - if vmstat != nil { - // Swap in and swap out numbers - swap["in"] = common.MapStr{ - "pages": vmstat.Pswpin, - } - swap["out"] = common.MapStr{ - "pages": vmstat.Pswpout, - } - //Swap readahead - //See https://www.kernel.org/doc/ols/2007/ols2007v2-pages-273-284.pdf - swap["readahead"] = common.MapStr{ - "pages": vmstat.SwapRa, - "cached": vmstat.SwapRaHit, - } - } + memory := common.MapStr{} + err = typeconv.Convert(&memory, &eventRaw) // for backwards compatibility, only report if we're not in fleet mode - if !m.IsAgent { - err := linux.FetchLinuxMemStats(memory) + // This is entirely linux-specific data that should live in linux/memory. + // DEPRECATE: remove this for 8.0 + if !m.IsAgent && runtime.GOOS == "linux" { + err := fetchLinuxMemStats(memory) if err != nil { return errors.Wrap(err, "error getting page stats") } + vmstat, err := getVMStat() + if err != nil { + return errors.Wrap(err, "Error getting VMStat data") + } + // Swap in and swap out numbers + memory.Put("swap.in.pages", vmstat.Pswpin) + memory.Put("swap.out.pages", vmstat.Pswpout) + memory.Put("swap.readahead.pages", vmstat.SwapRa) + memory.Put("swap.readahead.cached", vmstat.SwapRaHit) } - memory["swap"] = swap - r.Event(mb.Event{ MetricSetFields: memory, }) diff --git a/metricbeat/module/system/memory/memory_test.go b/metricbeat/module/system/memory/memory_test.go index 978d2de8ae1..515bfcb26b8 100644 --- a/metricbeat/module/system/memory/memory_test.go +++ b/metricbeat/module/system/memory/memory_test.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -// +build darwin freebsd linux openbsd windows +// +build darwin freebsd linux openbsd windows aix package memory diff --git a/metricbeat/module/system/test_system.py b/metricbeat/module/system/test_system.py index b1c83db81eb..e4d69723cf1 100644 --- a/metricbeat/module/system/test_system.py +++ b/metricbeat/module/system/test_system.py @@ -67,8 +67,11 @@ SYSTEM_FSSTAT_FIELDS = ["count", "total_files", "total_size"] +SYSTEM_MEMORY_FIELDS_LINUX = ["swap", "actual.free", "free", "total", "cached", "used.bytes", "used.pct", "actual.used.bytes", + "actual.used.pct", "hugepages", "page_stats"] + SYSTEM_MEMORY_FIELDS = ["swap", "actual.free", "free", "total", "used.bytes", "used.pct", "actual.used.bytes", - "actual.used.pct", "hugepages", "page_stats"] + "actual.used.pct", "hugepages", "page_stats"] SYSTEM_NETWORK_FIELDS = ["name", "out.bytes", "in.bytes", "out.packets", "in.packets", "in.error", "out.error", "in.dropped", "out.dropped"] @@ -384,7 +387,13 @@ def test_memory(self): if not re.match("(?i)linux", sys.platform) and not "page_stats" in memory: # Ensure presence of page_stats only in Linux memory["page_stats"] = None - self.assertCountEqual(self.de_dot(SYSTEM_MEMORY_FIELDS), memory.keys()) + + if sys.platform.startswith("linux"): + self.assertCountEqual(self.de_dot( + SYSTEM_MEMORY_FIELDS_LINUX), memory.keys()) + else: + self.assertCountEqual(self.de_dot( + SYSTEM_MEMORY_FIELDS), memory.keys()) # Check that percentages are calculated. mem = memory