diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 2d37aca0ce6..84c0d61fc29 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -342,6 +342,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Add `metricset.period` field with the configured fetching period. {pull}13242[13242] {issue}12616[12616] - Add rate metrics for ec2 metricset. {pull}13203[13203] - Add Performance metricset to Oracle module {pull}12547[12547] +- Add proc/vmstat data to the system/memory metricset on linux {pull}13322[13322] *Packetbeat* diff --git a/NOTICE.txt b/NOTICE.txt index 46798974a75..2c4f176d5c2 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -820,8 +820,8 @@ Apache License 2.0 -------------------------------------------------------------------- Dependency: github.com/elastic/go-sysinfo -Version: v1.0.2 -Revision: 06c1f463545498d8f4b378d4dcf3171794c28537 +Version: v1.1.0 +Revision: 51d9d1362d77a4792dfb39a7a19f056cdf1b9840 License type (autodetected): Apache-2.0 ./vendor/github.com/elastic/go-sysinfo/LICENSE.txt: -------------------------------------------------------------------- diff --git a/libbeat/metric/system/memory/memory.go b/libbeat/metric/system/memory/memory.go index 585c80d5c74..d2833d4b092 100644 --- a/libbeat/metric/system/memory/memory.go +++ b/libbeat/metric/system/memory/memory.go @@ -20,8 +20,12 @@ package memory import ( + "github.com/pkg/errors" + "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" + sysinfo "github.com/elastic/go-sysinfo" + sysinfotypes "github.com/elastic/go-sysinfo/types" sigar "github.com/elastic/gosigar" ) @@ -148,3 +152,20 @@ func AddHugeTLBPagesPercentage(s *HugeTLBPagesStat) { 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/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index 20c96fefc69..c47c93f6772 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -28371,6 +28371,42 @@ format: bytes -- +*`system.memory.swap.out.pages`*:: ++ +-- +count of pages swapped out + +type: long + +-- + +*`system.memory.swap.in.pages`*:: ++ +-- +count of pages swapped in + +type: long + +-- + +*`system.memory.swap.readahead.pages`*:: ++ +-- +swap readahead pages + +type: long + +-- + +*`system.memory.swap.readahead.cached`*:: ++ +-- +swap readahead cache hits + +type: long + +-- + *`system.memory.swap.used.pct`*:: + -- @@ -28473,6 +28509,30 @@ format: bytes -- +[float] +=== swap.out + +huge pages swapped out + + +*`system.memory.hugepages.swap.out.pages`*:: ++ +-- +pages swapped out + +type: long + +-- + +*`system.memory.hugepages.swap.out.fallback`*:: ++ +-- +Count of huge pages that must be split before swapout + +type: long + +-- + [float] === network diff --git a/metricbeat/module/system/fields.go b/metricbeat/module/system/fields.go index 994c269e8e6..c9f235243d5 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 ../metricbeat/module/system. func AssetSystem() string { - return "eJzsfVuPGzfy77s/RWEOFhnvmZE93iSbnYcDOPYGGCBZDzwOdoGDP2SquyRxh012SLZk5dP/wUvf2VK31Lo4iB6cjNRN/qpYLFYVi8VbeMbNPaiN0pi8ANBUM7yHqyf7xdULgBhVJGmqqeD38P9eAAC4H0FpojMFCWpJI3UDjD4jvHv8FQiPIcFEyA1kiizwBvSSaC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QWoZfw8ef3L3OH18vCTpqrAJEC8DXrJlVOZ8BrL09cIQFL7b9vML66mEs5mVE1WUhOxWIi1WJyYeV7Uf1FKyldNLG3NGIwoBIm8k7lljyJZAK+KyAVBJIZxDHEJJLppnDcqWm1AcAvLI1Jb1+9SrMZZ5HO5nP2BXH01uUpvmwznsv/T0vOf2iWs+naPxRzghro1Y34QsodiLsf7Rj/uY+tAHw79D1BDHgqYjuKsV/o+KnyOgepkd6KA77s+/gMfIEow+OuQ+SB1/sHq0T4W8MH3vfBkHnG+XSAKtR94O70+SP+nQT+fmj2XM5dG93cf2Zlztw3oz/Ig263DNu73+pb1GMhnEfdnIRdDUqxUKEd8OWOlevkFfh7j9MZCwxl2I2u2ntXGwgk8UfEUgyBzk84ejXRaH1w7ZA2Att/bnZ0XOgWyMjPDs82tVAyPwO/Ktthllmd8j1ZVyeD5SOulWjqHi/5HSbknVQKdIqNUYzM+0FowLzzK2sxX+mNfiXAvGLp6ttXJkqnCSQTct/Rlrf7GD7cnO/gTqm7Z5f0PJyXKl3S7XVY3TPdEy0iLl+ZxxZUOCzEVuXzqe2W71YOumzI2Azk9mS33PvZlSPgs9C22ZkmPNDWI2A6/Gz+yADLPFVl2EHSjLjUMF3Tzqu9R0HbQGhtxLREMg2+z1fHbVhyHrALICHUhasVj7oJfXr/B9mELCPPuAll8TluQttnl/TchE5twrtQb/k/xepIG61iB/v6nx2Jz/U7Q83nU/1APiI4MGHu2x9OksEPQOdfbfyZiTQz0/xDCeOc+aZgwwzExyWQ+8ecV+yfWpKavPj/AAAA//8oXnt2" } diff --git a/metricbeat/module/system/memory/_meta/data.json b/metricbeat/module/system/memory/_meta/data.json index db5d2f6e1e1..b38aaa7991f 100644 --- a/metricbeat/module/system/memory/_meta/data.json +++ b/metricbeat/module/system/memory/_meta/data.json @@ -1,9 +1,5 @@ { "@timestamp": "2017-10-12T08:05:34.853Z", - "agent": { - "hostname": "host.example.com", - "name": "host.example.com" - }, "event": { "dataset": "system.memory", "duration": 115000, @@ -18,18 +14,24 @@ "system": { "memory": { "actual": { - "free": 4974256128, + "free": 671084544, "used": { - "bytes": 11597463552, - "pct": 0.6998 + "bytes": 362037248, + "pct": 0.3504 } }, - "free": 1320112128, + "free": 340848640, "hugepages": { "default_size": 2097152, "free": 0, "reserved": 0, "surplus": 0, + "swap": { + "out": { + "fallback": 0, + "pages": 0 + } + }, "total": 0, "used": { "bytes": 0, @@ -37,17 +39,27 @@ } }, "swap": { - "free": 3482378240, - "total": 8589930496, + "free": 0, + "in": { + "pages": 0 + }, + "out": { + "pages": 0 + }, + "readahead": { + "cached": 0, + "pages": 0 + }, + "total": 0, "used": { - "bytes": 5107552256, - "pct": 0.5946 + "bytes": 0, + "pct": 0 } }, - "total": 16571719680, + "total": 1033121792, "used": { - "bytes": 15251607552, - "pct": 0.9203 + "bytes": 692273152, + "pct": 0.6701 } } } diff --git a/metricbeat/module/system/memory/_meta/fields.yml b/metricbeat/module/system/memory/_meta/fields.yml index 9544dfee485..5fbe09e39d1 100644 --- a/metricbeat/module/system/memory/_meta/fields.yml +++ b/metricbeat/module/system/memory/_meta/fields.yml @@ -79,6 +79,22 @@ description: > Available swap memory. + - name: out.pages + type: long + description: count of pages swapped out + + - name: in.pages + type: long + description: count of pages swapped in + + - name: readahead.pages + type: long + description: swap readahead pages + + - name: readahead.cached + type: long + description: swap readahead cache hits + - name: used.pct type: scaled_float format: percent @@ -131,3 +147,14 @@ format: bytes description: > Default size for huge pages. + + - name: swap.out + type: group + description: huge pages swapped out + fields: + - name: pages + type: long + description: pages swapped out + - name: fallback + type: long + description: Count of huge pages that must be split before swapout diff --git a/metricbeat/module/system/memory/memory.go b/metricbeat/module/system/memory/memory.go index 34987a040f1..57c6d588892 100644 --- a/metricbeat/module/system/memory/memory.go +++ b/metricbeat/module/system/memory/memory.go @@ -75,6 +75,11 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { }, } + vmstat, err := mem.GetVMStat() + if err != nil { + return errors.Wrap(err, "VMStat") + } + swap := common.MapStr{ "total": swapStat.Total, "used": common.MapStr{ @@ -83,6 +88,24 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { }, "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["swap"] = swap hugePagesStat, err := mem.GetHugeTLBPages() @@ -91,7 +114,7 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { } if hugePagesStat != nil { mem.AddHugeTLBPagesPercentage(hugePagesStat) - memory["hugepages"] = common.MapStr{ + thp := common.MapStr{ "total": hugePagesStat.Total, "used": common.MapStr{ "bytes": hugePagesStat.TotalAllocatedSize, @@ -102,6 +125,15 @@ func (m *MetricSet) Fetch(r mb.ReporterV2) error { "surplus": hugePagesStat.Surplus, "default_size": hugePagesStat.DefaultSize, } + if vmstat != nil { + thp["swap"] = common.MapStr{ + "out": common.MapStr{ + "pages": vmstat.ThpSwpout, + "fallback": vmstat.ThpSwpoutFallback, + }, + } + } + memory["hugepages"] = thp } r.Event(mb.Event{ diff --git a/vendor/github.com/elastic/go-sysinfo/CHANGELOG.md b/vendor/github.com/elastic/go-sysinfo/CHANGELOG.md index f1727d20b14..280c2269ca2 100644 --- a/vendor/github.com/elastic/go-sysinfo/CHANGELOG.md +++ b/vendor/github.com/elastic/go-sysinfo/CHANGELOG.md @@ -18,6 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [1.1.0] - 2019-08-22 + +### Added + +- Add `VMStat` interface for Linux. [#59](https://github.com/elastic/go-sysinfo/pull/59) + ## [1.0.2] - 2019-07-09 ### Fixed @@ -51,6 +57,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changed the host containerized check to reduce false positives. [#42](https://github.com/elastic/go-sysinfo/pull/42) [#43](https://github.com/elastic/go-sysinfo/pull/43) -[Unreleased]: https://github.com/elastic/go-sysinfo/compare/v1.0.1...HEAD +[Unreleased]: https://github.com/elastic/go-sysinfo/compare/v1.1.0...HEAD +[1.1.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.1.0 +[1.0.2]: https://github.com/elastic/go-sysinfo/releases/tag/v1.0.2 [1.0.1]: https://github.com/elastic/go-sysinfo/releases/tag/v1.0.1 [1.0.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.0.0 diff --git a/vendor/github.com/elastic/go-sysinfo/Makefile b/vendor/github.com/elastic/go-sysinfo/Makefile new file mode 100644 index 00000000000..0f69ebf3aba --- /dev/null +++ b/vendor/github.com/elastic/go-sysinfo/Makefile @@ -0,0 +1,29 @@ +GOPATH?=~/go + +.phony: update +update: fmt lic imports + +.PHONY: lic +lic: $(GOPATH)/bin/go-licenser + go-licenser + +.PHONY: fmt +fmt: $(GOPATH)/bin/gofumpt + gofumpt -w -l ./ + +.PHONY: imports +imports: $(GOPATH)/bin/goimports + goimports -l -local github.com/elastic/go-sysinfo ./ + +$(GOPATH)/bin/go-licenser: + @echo "go-licenser missing, installing" + GO111MODULE=off go get -u github.com/elastic/go-licenser + +$(GOPATH)/bin/gofumpt: + @echo "gofumpt missing, installing" + #Ugly boilerplate for go mod installs + cd $(mktemp -d); go mod init tmp; go get mvdan.cc/gofumpt + +$(GOPATH)/bin/goimports: + @echo "goimports missing, installing" + GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports \ No newline at end of file diff --git a/vendor/github.com/elastic/go-sysinfo/README.md b/vendor/github.com/elastic/go-sysinfo/README.md index 3a657a4b2d4..958f11c235f 100644 --- a/vendor/github.com/elastic/go-sysinfo/README.md +++ b/vendor/github.com/elastic/go-sysinfo/README.md @@ -36,6 +36,7 @@ that are implemented. | `Info()` | x | x | x | | `Memory()` | x | x | x | | `CPUTimer` | x | x | x | +| `VMStat` | | x | | | `Process` Features | Darwin | Linux | Windows | |------------------------|--------|-------|---------| diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/host_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/host_linux.go index 9b09ddff98c..19325b02d36 100644 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/host_linux.go +++ b/vendor/github.com/elastic/go-sysinfo/providers/linux/host_linux.go @@ -71,6 +71,16 @@ func (h *host) Memory() (*types.HostMemoryInfo, error) { return parseMemInfo(content) } +// VMStat reports data from /proc/vmstat on linux. +func (h *host) VMStat() (*types.VMStatInfo, error) { + content, err := ioutil.ReadFile(h.procFS.path("vmstat")) + if err != nil { + return nil, err + } + + return parseVMStat(content) +} + func (h *host) CPUTime() (types.CPUTimes, error) { stat, err := h.procFS.NewStat() if err != nil { diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/memory_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/memory_linux.go index 30357430627..758caaba982 100644 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/memory_linux.go +++ b/vendor/github.com/elastic/go-sysinfo/providers/linux/memory_linux.go @@ -18,9 +18,6 @@ package linux import ( - "bytes" - "strconv" - "github.com/pkg/errors" "github.com/elastic/go-sysinfo/types" @@ -73,28 +70,3 @@ func parseMemInfo(content []byte) (*types.HostMemoryInfo, error) { return memInfo, nil } - -func parseBytesOrNumber(data []byte) (uint64, error) { - parts := bytes.Fields(data) - - if len(parts) == 0 { - return 0, errors.New("empty value") - } - - num, err := strconv.ParseUint(string(parts[0]), 10, 64) - if err != nil { - return 0, errors.Wrap(err, "failed to parse value") - } - - var multiplier uint64 = 1 - if len(parts) >= 2 { - switch string(parts[1]) { - case "kB": - multiplier = 1024 - default: - return 0, errors.Errorf("unhandled unit %v", string(parts[1])) - } - } - - return num * multiplier, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/util.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/util.go index 066fef6aa30..0be3f6b06f7 100644 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/util.go +++ b/vendor/github.com/elastic/go-sysinfo/providers/linux/util.go @@ -84,3 +84,28 @@ func decodeBitMap(s string, lookupName func(int) string) ([]string, error) { return names, nil } + +func parseBytesOrNumber(data []byte) (uint64, error) { + parts := bytes.Fields(data) + + if len(parts) == 0 { + return 0, errors.New("empty value") + } + + num, err := strconv.ParseUint(string(parts[0]), 10, 64) + if err != nil { + return 0, errors.Wrap(err, "failed to parse value") + } + + var multiplier uint64 = 1 + if len(parts) >= 2 { + switch string(parts[1]) { + case "kB": + multiplier = 1024 + default: + return 0, errors.Errorf("unhandled unit %v", string(parts[1])) + } + } + + return num * multiplier, nil +} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/vmstat.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/vmstat.go new file mode 100644 index 00000000000..0a228678f88 --- /dev/null +++ b/vendor/github.com/elastic/go-sysinfo/providers/linux/vmstat.go @@ -0,0 +1,70 @@ +// 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 linux + +import ( + "reflect" + + "github.com/pkg/errors" + + "github.com/elastic/go-sysinfo/types" +) + +// vmstatTagToFieldIndex contains a mapping of json struct tags to struct field indices. +var vmstatTagToFieldIndex = make(map[string]int) + +func init() { + var vmstat types.VMStatInfo + val := reflect.ValueOf(vmstat) + typ := reflect.TypeOf(vmstat) + + for i := 0; i < val.NumField(); i++ { + field := typ.Field(i) + if tag := field.Tag.Get("json"); tag != "" { + vmstatTagToFieldIndex[tag] = i + } + } +} + +// parseVMStat parses the contents of /proc/vmstat. +func parseVMStat(content []byte) (*types.VMStatInfo, error) { + var vmStat types.VMStatInfo + refValues := reflect.ValueOf(&vmStat).Elem() + + err := parseKeyValue(content, " ", func(key, value []byte) error { + // turn our []byte value into an int + val, err := parseBytesOrNumber(value) + if err != nil { + return errors.Wrapf(err, "failed to parse %v value of %v", string(key), string(value)) + } + + idx, ok := vmstatTagToFieldIndex[string(key)] + if !ok { + return nil + } + + sval := refValues.Field(idx) + + if sval.CanSet() { + sval.SetUint(val) + } + return nil + }) + + return &vmStat, err +} diff --git a/vendor/github.com/elastic/go-sysinfo/types/errors.go b/vendor/github.com/elastic/go-sysinfo/types/errors.go index b4af40528eb..c7ec16936f4 100644 --- a/vendor/github.com/elastic/go-sysinfo/types/errors.go +++ b/vendor/github.com/elastic/go-sysinfo/types/errors.go @@ -19,4 +19,5 @@ package types import "github.com/pkg/errors" +// ErrNotImplemented represents an error for a function that is not implemented on a particular platform. var ErrNotImplemented = errors.New("unimplemented") diff --git a/vendor/github.com/elastic/go-sysinfo/types/go.go b/vendor/github.com/elastic/go-sysinfo/types/go.go index c195c9fff99..62377441f10 100644 --- a/vendor/github.com/elastic/go-sysinfo/types/go.go +++ b/vendor/github.com/elastic/go-sysinfo/types/go.go @@ -17,6 +17,7 @@ package types +// GoInfo contains info about the go runtime type GoInfo struct { OS string `json:"os"` Arch string `json:"arch"` diff --git a/vendor/github.com/elastic/go-sysinfo/types/host.go b/vendor/github.com/elastic/go-sysinfo/types/host.go index 32554dd9413..bf5b80cdcc0 100644 --- a/vendor/github.com/elastic/go-sysinfo/types/host.go +++ b/vendor/github.com/elastic/go-sysinfo/types/host.go @@ -19,12 +19,19 @@ package types import "time" +// Host is the interface that wraps methods for returning Host stats type Host interface { CPUTimer Info() HostInfo Memory() (*HostMemoryInfo, error) } +// VMStat is the interface wrapper for platforms that support /proc/vmstat. +type VMStat interface { + VMStat() (*VMStatInfo, error) +} + +// HostInfo contains basic host information. type HostInfo struct { Architecture string `json:"architecture"` // Hardware architecture (e.g. x86_64, arm, ppc, mips). BootTime time.Time `json:"boot_time"` // Host boot time. @@ -39,10 +46,12 @@ type HostInfo struct { UniqueID string `json:"id,omitempty"` // Unique ID of the host (optional). } +// Uptime returns the system uptime func (host HostInfo) Uptime() time.Duration { return time.Since(host.BootTime) } +// OSInfo contains basic OS information type OSInfo struct { Family string `json:"family"` // OS Family (e.g. redhat, debian, freebsd, windows). Platform string `json:"platform"` // OS platform (e.g. centos, ubuntu, windows). @@ -55,10 +64,13 @@ type OSInfo struct { Codename string `json:"codename,omitempty"` // OS codename (e.g. jessie). } +// LoadAverage is the interface that wraps the LoadAverage method. +// LoadAverage returns load info on the host type LoadAverage interface { LoadAverage() LoadAverageInfo } +// LoadAverageInfo contains load statistics type LoadAverageInfo struct { One float64 `json:"one_min"` Five float64 `json:"five_min"` @@ -76,3 +88,181 @@ type HostMemoryInfo struct { VirtualFree uint64 `json:"virtual_free_bytes"` // Virtual memory that is not used. Metrics map[string]uint64 `json:"raw,omitempty"` // Other memory related metrics. } + +// VMStatInfo contains parsed info from /proc/vmstat. +// This procfs file has expanded much over the years +// with different kernel versions. If we don't have a field in vmstat, +// the field in the struct will just be blank. The comments represent kernel versions. +type VMStatInfo struct { + NrFreePages uint64 `json:"nr_free_pages"` // (since Linux 2.6.31) + NrAllocBatch uint64 `json:"nr_alloc_batch"` // (since Linux 3.12) + NrInactiveAnon uint64 `json:"nr_inactive_anon"` // (since Linux 2.6.28) + NrActiveAnon uint64 `json:"nr_active_anon"` // (since Linux 2.6.28) + NrInactiveFile uint64 `json:"nr_inactive_file"` // (since Linux 2.6.28) + NrActiveFile uint64 `json:"nr_active_file"` // (since Linux 2.6.28) + NrUnevictable uint64 `json:"nr_unevictable"` // (since Linux 2.6.28) + NrMlock uint64 `json:"nr_mlock"` // (since Linux 2.6.28) + NrAnonPages uint64 `json:"nr_anon_pages"` // (since Linux 2.6.18) + NrMapped uint64 `json:"nr_mapped"` // (since Linux 2.6.0) + NrFilePages uint64 `json:"nr_file_pages"` // (since Linux 2.6.18) + NrDirty uint64 `json:"nr_dirty"` // (since Linux 2.6.0) + NrWriteback uint64 `json:"nr_writeback"` // (since Linux 2.6.0) + NrSlabReclaimable uint64 `json:"nr_slab_reclaimable"` // (since Linux 2.6.19) + NrSlabUnreclaimable uint64 `json:"nr_slab_unreclaimable"` // (since Linux 2.6.19) + NrPageTablePages uint64 `json:"nr_page_table_pages"` // (since Linux 2.6.0) + NrKernelStack uint64 `json:"nr_kernel_stack"` // (since Linux 2.6.32) Amount of memory allocated to kernel stacks. + NrUnstable uint64 `json:"nr_unstable"` // (since Linux 2.6.0) + NrBounce uint64 `json:"nr_bounce"` // (since Linux 2.6.12) + NrVmscanWrite uint64 `json:"nr_vmscan_write"` // (since Linux 2.6.19) + NrVmscanImmediateReclaim uint64 `json:"nr_vmscan_immediate_reclaim"` // (since Linux 3.2) + NrWritebackTemp uint64 `json:"nr_writeback_temp"` // (since Linux 2.6.26) + NrIsolatedAnon uint64 `json:"nr_isolated_anon"` // (since Linux 2.6.32) + NrIsolatedFile uint64 `json:"nr_isolated_file"` // (since Linux 2.6.32) + NrShmem uint64 `json:"nr_shmem"` // (since Linux 2.6.32) Pages used by shmem and tmpfs(5). + NrDirtied uint64 `json:"nr_dirtied"` // (since Linux 2.6.37) + NrWritten uint64 `json:"nr_written"` // (since Linux 2.6.37) + NrPagesScanned uint64 `json:"nr_pages_scanned"` // (since Linux 3.17) + NumaHit uint64 `json:"numa_hit"` // (since Linux 2.6.18) + NumaMiss uint64 `json:"numa_miss"` // (since Linux 2.6.18) + NumaForeign uint64 `json:"numa_foreign"` // (since Linux 2.6.18) + NumaInterleave uint64 `json:"numa_interleave"` // (since Linux 2.6.18) + NumaLocal uint64 `json:"numa_local"` // (since Linux 2.6.18) + NumaOther uint64 `json:"numa_other"` // (since Linux 2.6.18) + WorkingsetRefault uint64 `json:"workingset_refault"` // (since Linux 3.15) + WorkingsetActivate uint64 `json:"workingset_activate"` // (since Linux 3.15) + WorkingsetNodereclaim uint64 `json:"workingset_nodereclaim"` // (since Linux 3.15) + NrAnonTransparentHugepages uint64 `json:"nr_anon_transparent_hugepages"` // (since Linux 2.6.38) + NrFreeCma uint64 `json:"nr_free_cma"` // (since Linux 3.7) Number of free CMA (Contiguous Memory Allocator) pages. + NrDirtyThreshold uint64 `json:"nr_dirty_threshold"` // (since Linux 2.6.37) + NrDirtyBackgroundThreshold uint64 `json:"nr_dirty_background_threshold"` // (since Linux 2.6.37) + Pgpgin uint64 `json:"pgpgin"` // (since Linux 2.6.0) + Pgpgout uint64 `json:"pgpgout"` // (since Linux 2.6.0) + Pswpin uint64 `json:"pswpin"` // (since Linux 2.6.0) + Pswpout uint64 `json:"pswpout"` // (since Linux 2.6.0) + PgallocDma uint64 `json:"pgalloc_dma"` // (since Linux 2.6.5) + PgallocDma32 uint64 `json:"pgalloc_dma32"` // (since Linux 2.6.16) + PgallocNormal uint64 `json:"pgalloc_normal"` // (since Linux 2.6.5) + PgallocHigh uint64 `json:"pgalloc_high"` // (since Linux 2.6.5) + PgallocMovable uint64 `json:"pgalloc_movable"` // (since Linux 2.6.23) + Pgfree uint64 `json:"pgfree"` // (since Linux 2.6.0) + Pgactivate uint64 `json:"pgactivate"` // (since Linux 2.6.0) + Pgdeactivate uint64 `json:"pgdeactivate"` // (since Linux 2.6.0) + Pgfault uint64 `json:"pgfault"` // (since Linux 2.6.0) + Pgmajfault uint64 `json:"pgmajfault"` // (since Linux 2.6.0) + PgrefillDma uint64 `json:"pgrefill_dma"` // (since Linux 2.6.5) + PgrefillDma32 uint64 `json:"pgrefill_dma32"` // (since Linux 2.6.16) + PgrefillNormal uint64 `json:"pgrefill_normal"` // (since Linux 2.6.5) + PgrefillHigh uint64 `json:"pgrefill_high"` // (since Linux 2.6.5) + PgrefillMovable uint64 `json:"pgrefill_movable"` // (since Linux 2.6.23) + PgstealKswapdDma uint64 `json:"pgsteal_kswapd_dma"` // (since Linux 3.4) + PgstealKswapdDma32 uint64 `json:"pgsteal_kswapd_dma32"` // (since Linux 3.4) + PgstealKswapdNormal uint64 `json:"pgsteal_kswapd_normal"` // (since Linux 3.4) + PgstealKswapdHigh uint64 `json:"pgsteal_kswapd_high"` // (since Linux 3.4) + PgstealKswapdMovable uint64 `json:"pgsteal_kswapd_movable"` // (since Linux 3.4) + PgstealDirectDma uint64 `json:"pgsteal_direct_dma"` + PgstealDirectDma32 uint64 `json:"pgsteal_direct_dma32"` // (since Linux 3.4) + PgstealDirectNormal uint64 `json:"pgsteal_direct_normal"` // (since Linux 3.4) + PgstealDirectHigh uint64 `json:"pgsteal_direct_high"` // (since Linux 3.4) + PgstealDirectMovable uint64 `json:"pgsteal_direct_movable"` // (since Linux 2.6.23) + PgscanKswapdDma uint64 `json:"pgscan_kswapd_dma"` + PgscanKswapdDma32 uint64 `json:"pgscan_kswapd_dma32"` // (since Linux 2.6.16) + PgscanKswapdNormal uint64 `json:"pgscan_kswapd_normal"` // (since Linux 2.6.5) + PgscanKswapdHigh uint64 `json:"pgscan_kswapd_high"` + PgscanKswapdMovable uint64 `json:"pgscan_kswapd_movable"` // (since Linux 2.6.23) + PgscanDirectDma uint64 `json:"pgscan_direct_dma"` // + PgscanDirectDma32 uint64 `json:"pgscan_direct_dma32"` // (since Linux 2.6.16) + PgscanDirectNormal uint64 `json:"pgscan_direct_normal"` + PgscanDirectHigh uint64 `json:"pgscan_direct_high"` + PgscanDirectMovable uint64 `json:"pgscan_direct_movable"` // (since Linux 2.6.23) + PgscanDirectThrottle uint64 `json:"pgscan_direct_throttle"` // (since Linux 3.6) + ZoneReclaimFailed uint64 `json:"zone_reclaim_failed"` // (since linux 2.6.31) + Pginodesteal uint64 `json:"pginodesteal"` // (since linux 2.6.0) + SlabsScanned uint64 `json:"slabs_scanned"` // (since linux 2.6.5) + KswapdInodesteal uint64 `json:"kswapd_inodesteal"` // (since linux 2.6.0) + KswapdLowWmarkHitQuickly uint64 `json:"kswapd_low_wmark_hit_quickly"` // (since 2.6.33) + KswapdHighWmarkHitQuickly uint64 `json:"kswapd_high_wmark_hit_quickly"` // (since 2.6.33) + Pageoutrun uint64 `json:"pageoutrun"` // (since Linux 2.6.0) + Allocstall uint64 `json:"allocstall"` // (since Linux 2.6.0) + Pgrotated uint64 `json:"pgrotated"` // (since Linux 2.6.0) + DropPagecache uint64 `json:"drop_pagecache"` // (since Linux 3.15) + DropSlab uint64 `json:"drop_slab"` // (since Linux 3.15) + NumaPteUpdates uint64 `json:"numa_pte_updates"` // (since Linux 3.8) + NumaHugePteUpdates uint64 `json:"numa_huge_pte_updates"` // (since Linux 3.13) + NumaHintFaults uint64 `json:"numa_hint_faults"` // (since Linux 3.8) + NumaHintFaultsLocal uint64 `json:"numa_hint_faults_local"` // (since Linux 3.8) + NumaPagesMigrated uint64 `json:"numa_pages_migrated"` // (since Linux 3.8) + PgmigrateSuccess uint64 `json:"pgmigrate_success"` // (since Linux 3.8) + PgmigrateFail uint64 `json:"pgmigrate_fail"` // (since Linux 3.8) + CompactMigrateScanned uint64 `json:"compact_migrate_scanned"` // (since Linux 3.8) + CompactFreeScanned uint64 `json:"compact_free_scanned"` // (since Linux 3.8) + CompactIsolated uint64 `json:"compact_isolated"` // (since Linux 3.8) + CompactStall uint64 `json:"compact_stall"` // (since Linux 2.6.35) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + CompactFail uint64 `json:"compact_fail"` // (since Linux 2.6.35) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + CompactSuccess uint64 `json:"compact_success"` // (since Linux 2.6.35) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + HtlbBuddyAllocSuccess uint64 `json:"htlb_buddy_alloc_success"` // (since Linux 2.6.26) + HtlbBuddyAllocFail uint64 `json:"htlb_buddy_alloc_fail"` // (since Linux 2.6.26) + UnevictablePgsCulled uint64 `json:"unevictable_pgs_culled"` // (since Linux 2.6.28) + UnevictablePgsScanned uint64 `json:"unevictable_pgs_scanned"` // (since Linux 2.6.28) + UnevictablePgsRescued uint64 `json:"unevictable_pgs_rescued"` // (since Linux 2.6.28) + UnevictablePgsMlocked uint64 `json:"unevictable_pgs_mlocked"` // (since Linux 2.6.28) + UnevictablePgsMunlocked uint64 `json:"unevictable_pgs_munlocked"` // (since Linux 2.6.28) + UnevictablePgsCleared uint64 `json:"unevictable_pgs_cleared"` // (since Linux 2.6.28) + UnevictablePgsStranded uint64 `json:"unevictable_pgs_stranded"` // (since Linux 2.6.28) + ThpFaultAlloc uint64 `json:"thp_fault_alloc"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + ThpFaultFallback uint64 `json:"thp_fault_fallback"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + ThpCollapseAlloc uint64 `json:"thp_collapse_alloc"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + ThpCollapseAllocFailed uint64 `json:"thp_collapse_alloc_failed"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + ThpSplit uint64 `json:"thp_split"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + ThpZeroPageAlloc uint64 `json:"thp_zero_page_alloc"` // (since Linux 3.8) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + ThpZeroPageAllocFailed uint64 `json:"thp_zero_page_alloc_failed"` // (since Linux 3.8) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. + BalloonInflate uint64 `json:"balloon_inflate"` // (since Linux 3.18) + BalloonDeflate uint64 `json:"balloon_deflate"` // (since Linux 3.18) + BalloonMigrate uint64 `json:"balloon_migrate"` // (since Linux 3.18) + NrTlbRemoteFlush uint64 `json:"nr_tlb_remote_flush"` // (since Linux 3.12) + NrTlbRemoteFlushReceived uint64 `json:"nr_tlb_remote_flush_received"` // (since Linux 3.12) + NrTlbLocalFlushAll uint64 `json:"nr_tlb_local_flush_all"` // (since Linux 3.12) + NrTlbLocalFlushOne uint64 `json:"nr_tlb_local_flush_one"` // (since Linux 3.12) + VmacacheFindCalls uint64 `json:"vmacache_find_calls"` // (since Linux 3.16) + VmacacheFindHits uint64 `json:"vmacache_find_hits"` // (since Linux 3.16) + VmacacheFullFlushes uint64 `json:"vmacache_full_flushes"` // (since Linux 3.19) + // the following fields are not documented in `man 5 proc` as of 4.15 + NrZoneInactiveAnon uint64 `json:"nr_zone_inactive_anon"` + NrZoneActiveAnon uint64 `json:"nr_zone_active_anon"` + NrZoneInactiveFile uint64 `json:"nr_zone_inactive_file"` + NrZoneActiveFile uint64 `json:"nr_zone_active_file"` + NrZoneUnevictable uint64 `json:"nr_zone_unevictable"` + NrZoneWritePending uint64 `json:"nr_zone_write_pending"` + NrZspages uint64 `json:"nr_zspages"` + NrShmemHugepages uint64 `json:"nr_shmem_hugepages"` + NrShmemPmdmapped uint64 `json:"nr_shmem_pmdmapped"` + AllocstallDma uint64 `json:"allocstall_dma"` + AllocstallDma32 uint64 `json:"allocstall_dma32"` + AllocstallNormal uint64 `json:"allocstall_normal"` + AllocstallMovable uint64 `json:"allocstall_movable"` + PgskipDma uint64 `json:"pgskip_dma"` + PgskipDma32 uint64 `json:"pgskip_dma32"` + PgskipNormal uint64 `json:"pgskip_normal"` + PgskipMovable uint64 `json:"pgskip_movable"` + Pglazyfree uint64 `json:"pglazyfree"` + Pglazyfreed uint64 `json:"pglazyfreed"` + Pgrefill uint64 `json:"pgrefill"` + PgstealKswapd uint64 `json:"pgsteal_kswapd"` + PgstealDirect uint64 `json:"pgsteal_direct"` + PgscanKswapd uint64 `json:"pgscan_kswapd"` + PgscanDirect uint64 `json:"pgscan_direct"` + OomKill uint64 `json:"oom_kill"` + CompactDaemonWake uint64 `json:"compact_daemon_wake"` + CompactDaemonMigrateScanned uint64 `json:"compact_daemon_migrate_scanned"` + CompactDaemonFreeScanned uint64 `json:"compact_daemon_free_scanned"` + ThpFileAlloc uint64 `json:"thp_file_alloc"` + ThpFileMapped uint64 `json:"thp_file_mapped"` + ThpSplitPage uint64 `json:"thp_split_page"` + ThpSplitPageFailed uint64 `json:"thp_split_page_failed"` + ThpDeferredSplitPage uint64 `json:"thp_deferred_split_page"` + ThpSplitPmd uint64 `json:"thp_split_pmd"` + ThpSplitPud uint64 `json:"thp_split_pud"` + ThpSwpout uint64 `json:"thp_swpout"` + ThpSwpoutFallback uint64 `json:"thp_swpout_fallback"` + SwapRa uint64 `json:"swap_ra"` + SwapRaHit uint64 `json:"swap_ra_hit"` +} diff --git a/vendor/github.com/elastic/go-sysinfo/types/process.go b/vendor/github.com/elastic/go-sysinfo/types/process.go index 8dd2074ced4..20787b29988 100644 --- a/vendor/github.com/elastic/go-sysinfo/types/process.go +++ b/vendor/github.com/elastic/go-sysinfo/types/process.go @@ -19,6 +19,7 @@ package types import "time" +// Process is the main wrapper for gathering information on a process type Process interface { CPUTimer Info() (ProcessInfo, error) @@ -28,6 +29,7 @@ type Process interface { PID() int } +// ProcessInfo contains basic stats about a process type ProcessInfo struct { Name string `json:"name"` PID int `json:"pid"` @@ -70,20 +72,26 @@ type UserInfo struct { SGID string `json:"sgid"` } +// Environment is the interface that wraps the Environment method. +// Environment returns variables for a process type Environment interface { Environment() (map[string]string, error) } -// OpenHandleEnumerator lists the open file handles. +// OpenHandleEnumerator is the interface that wraps the OpenHandles method. +// OpenHandles lists the open file handles. type OpenHandleEnumerator interface { OpenHandles() ([]string, error) } -// OpenHandleCount returns the number the open file handles. +// OpenHandleCounter is the interface that wraps the OpenHandleCount method. +// OpenHandleCount returns the number of open file handles. type OpenHandleCounter interface { OpenHandleCount() (int, error) } +// CPUTimer is the interface that wraps the CPUTime method. +// CPUTime returns CPU time info type CPUTimer interface { // CPUTime returns a CPUTimes structure for // the host or some process. @@ -94,6 +102,7 @@ type CPUTimer interface { CPUTime() (CPUTimes, error) } +// CPUTimes contains CPU timing stats for a process type CPUTimes struct { User time.Duration `json:"user"` System time.Duration `json:"system"` @@ -105,22 +114,26 @@ type CPUTimes struct { Steal time.Duration `json:"steal,omitempty"` } +// Total returns the total CPU time func (cpu CPUTimes) Total() time.Duration { return cpu.User + cpu.System + cpu.Idle + cpu.IOWait + cpu.IRQ + cpu.Nice + cpu.SoftIRQ + cpu.Steal } +// MemoryInfo contains memory stats for a process type MemoryInfo struct { Resident uint64 `json:"resident_bytes"` Virtual uint64 `json:"virtual_bytes"` Metrics map[string]uint64 `json:"raw,omitempty"` // Other memory related metrics. } +// SeccompInfo contains seccomp info for a process type SeccompInfo struct { Mode string `json:"mode"` NoNewPrivs *bool `json:"no_new_privs,omitempty"` // Added in kernel 4.10. } +// CapabilityInfo contains capability set info. type CapabilityInfo struct { Inheritable []string `json:"inheritable"` Permitted []string `json:"permitted"` @@ -129,10 +142,14 @@ type CapabilityInfo struct { Ambient []string `json:"ambient"` } +// Capabilities is the interface that wraps the Capabilities method. +// Capabilities returns capabilities for a process type Capabilities interface { Capabilities() (*CapabilityInfo, error) } +// Seccomp is the interface that wraps the Seccomp method. +// Seccomp returns seccomp info on Linux type Seccomp interface { Seccomp() (*SeccompInfo, error) } diff --git a/vendor/vendor.json b/vendor/vendor.json index f26d1bc1114..b693af2bdd9 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1138,60 +1138,60 @@ "versionExact": "v0.0.6" }, { - "checksumSHA1": "u5pjOSlI10k6Q9LaRcF7OgBa2tU=", + "checksumSHA1": "rfr1yBSyYTHNU3p1NKftIyzr/eQ=", "path": "github.com/elastic/go-sysinfo", - "revision": "06c1f463545498d8f4b378d4dcf3171794c28537", - "revisionTime": "2019-07-09T16:49:53Z", - "version": "v1.0.2", - "versionExact": "v1.0.2" + "revision": "51d9d1362d77a4792dfb39a7a19f056cdf1b9840", + "revisionTime": "2019-08-22T16:44:40Z", + "version": "v1.1.0", + "versionExact": "v1.1.0" }, { "checksumSHA1": "GiZCjX17K265TtamGZZw4R2Jwbk=", "path": "github.com/elastic/go-sysinfo/internal/registry", - "revision": "06c1f463545498d8f4b378d4dcf3171794c28537", - "revisionTime": "2019-07-09T16:49:53Z", - "version": "v1.0.2", - "versionExact": "v1.0.2" + "revision": "51d9d1362d77a4792dfb39a7a19f056cdf1b9840", + "revisionTime": "2019-08-22T16:44:40Z", + "version": "v1.1.0", + "versionExact": "v1.1.0" }, { "checksumSHA1": "dVSTUnZHCLNd0tYIENqdj05RyI8=", "path": "github.com/elastic/go-sysinfo/providers/darwin", - "revision": "06c1f463545498d8f4b378d4dcf3171794c28537", - "revisionTime": "2019-07-09T16:49:53Z", - "version": "v1.0.2", - "versionExact": "v1.0.2" + "revision": "51d9d1362d77a4792dfb39a7a19f056cdf1b9840", + "revisionTime": "2019-08-22T16:44:40Z", + "version": "v1.1.0", + "versionExact": "v1.1.0" }, { - "checksumSHA1": "LWMXshdY44+JM7g09dA4tXMZ1rY=", + "checksumSHA1": "7Spkw81dzevqmPbUGZO1UM3K3oc=", "path": "github.com/elastic/go-sysinfo/providers/linux", - "revision": "06c1f463545498d8f4b378d4dcf3171794c28537", - "revisionTime": "2019-07-09T16:49:53Z", - "version": "v1.0.2", - "versionExact": "v1.0.2" + "revision": "51d9d1362d77a4792dfb39a7a19f056cdf1b9840", + "revisionTime": "2019-08-22T16:44:40Z", + "version": "v1.1.0", + "versionExact": "v1.1.0" }, { "checksumSHA1": "RWLvcP1w9ynKbuCqiW6prwd+EDU=", "path": "github.com/elastic/go-sysinfo/providers/shared", - "revision": "06c1f463545498d8f4b378d4dcf3171794c28537", - "revisionTime": "2019-07-09T16:49:53Z", - "version": "v1.0.2", - "versionExact": "v1.0.2" + "revision": "51d9d1362d77a4792dfb39a7a19f056cdf1b9840", + "revisionTime": "2019-08-22T16:44:40Z", + "version": "v1.1.0", + "versionExact": "v1.1.0" }, { "checksumSHA1": "E+yrwS/aZemnWUvwTvEhiczYuD8=", "path": "github.com/elastic/go-sysinfo/providers/windows", - "revision": "06c1f463545498d8f4b378d4dcf3171794c28537", - "revisionTime": "2019-07-09T16:49:53Z", - "version": "v1.0.2", - "versionExact": "v1.0.2" + "revision": "51d9d1362d77a4792dfb39a7a19f056cdf1b9840", + "revisionTime": "2019-08-22T16:44:40Z", + "version": "v1.1.0", + "versionExact": "v1.1.0" }, { - "checksumSHA1": "OHierbaoOHx79d73DuLrao43rIg=", + "checksumSHA1": "u2RbbYcB7B4uhi/eJ01qiiBa41E=", "path": "github.com/elastic/go-sysinfo/types", - "revision": "06c1f463545498d8f4b378d4dcf3171794c28537", - "revisionTime": "2019-07-09T16:49:53Z", - "version": "v1.0.2", - "versionExact": "v1.0.2" + "revision": "51d9d1362d77a4792dfb39a7a19f056cdf1b9840", + "revisionTime": "2019-08-22T16:44:40Z", + "version": "v1.1.0", + "versionExact": "v1.1.0" }, { "checksumSHA1": "bNf3GDGhZh86bfCIMM5c5AYfo3g=",