diff --git a/plugins/inputs/all/all.go b/plugins/inputs/all/all.go index 95106f209fcf1..220ca04a9427f 100644 --- a/plugins/inputs/all/all.go +++ b/plugins/inputs/all/all.go @@ -67,6 +67,7 @@ import ( _ "github.com/influxdata/telegraf/plugins/inputs/http_listener_v2" _ "github.com/influxdata/telegraf/plugins/inputs/http_response" _ "github.com/influxdata/telegraf/plugins/inputs/httpjson" + _ "github.com/influxdata/telegraf/plugins/inputs/hugepages" _ "github.com/influxdata/telegraf/plugins/inputs/icinga2" _ "github.com/influxdata/telegraf/plugins/inputs/infiniband" _ "github.com/influxdata/telegraf/plugins/inputs/influxdb" diff --git a/plugins/inputs/hugepages/README.md b/plugins/inputs/hugepages/README.md new file mode 100644 index 0000000000000..c08360f76a41e --- /dev/null +++ b/plugins/inputs/hugepages/README.md @@ -0,0 +1,67 @@ +# Hugepages Input Plugin + +Transparent Huge Pages (THP) is a Linux memory management system that reduces the overhead of +Translation Lookaside Buffer (TLB) lookups on machines with large amounts of memory by using larger +memory pages. + +Consult for more details. + +## Configuration + +```toml +# Gathers huge pages measurements. +[[inputs.hugepages]] + ## Supported huge page types: + ## - "root" - based on root huge page control directory: /sys/kernel/mm/hugepages + ## - "per_node" - based on per NUMA node directories: /sys/devices/system/node/node[0-9]*/hugepages + ## - "meminfo" - based on /proc/meminfo file + # types = ["root", "per_node"] +``` + +## Measurements + +**The following measurements are supported by Hugepages plugin:** + +- hugepages_root (gathered from root huge page control directory: `/sys/kernel/mm/hugepages`) + - tags: + - size_kb (integer, kB) + - fields: + - free (integer) + - mempolicy (integer) + - overcommit (integer) + - reserved (integer) + - surplus (integer) + - total (integer) +- hugepages_per_node (gathered from per NUMA node directories: `/sys/devices/system/node/node[0-9]*/hugepages`) + - tags: + - size_kb (integer, kB) + - node (integer) + - fields: + - free (integer) + - surplus (integer) + - total (integer) +- hugepages_meminfo (gathered from `/proc/meminfo` file) + - The fields `total`, `free`, `reserved`, and `surplus` are counts of pages of default size. Fields with suffix `_kb` are in kilobytes. + - fields: + - anonymous_kb (integer, kB) + - file_kb (integer, kB) + - free (integer) + - reserved (integer) + - shared_kb (integer, kB) + - size_kb (integer, kB) + - surplus (integer) + - tlb_kb (integer, kB) + - total (integer) + +## Example Output + +```text +$ ./telegraf -config telegraf.conf -input-filter hugepages -test +> hugepages_root,host=ubuntu,size_kb=1048576 free=0i,mempolicy=8i,overcommit=0i,reserved=0i,surplus=0i,total=8i 1646258020000000000 +> hugepages_root,host=ubuntu,size_kb=2048 free=883i,mempolicy=2048i,overcommit=0i,reserved=0i,surplus=0i,total=2048i 1646258020000000000 +> hugepages_per_node,host=ubuntu,size_kb=1048576,node=0 free=0i,surplus=0i,total=4i 1646258020000000000 +> hugepages_per_node,host=ubuntu,size_kb=2048,node=0 free=434i,surplus=0i,total=1024i 1646258020000000000 +> hugepages_per_node,host=ubuntu,size_kb=1048576,node=1 free=0i,surplus=0i,total=4i 1646258020000000000 +> hugepages_per_node,host=ubuntu,size_kb=2048,node=1 free=449i,surplus=0i,total=1024i 1646258020000000000 +> hugepages_meminfo,host=ubuntu anonymous_kb=0i,file_kb=0i,free=883i,reserved=0i,shared_kb=0i,size_kb=2048i,surplus=0i,tlb_kb=12582912i,total=2048i 1646258020000000000 +``` diff --git a/plugins/inputs/hugepages/hugepages.go b/plugins/inputs/hugepages/hugepages.go new file mode 100644 index 0000000000000..aeef3b7b8b5e3 --- /dev/null +++ b/plugins/inputs/hugepages/hugepages.go @@ -0,0 +1,287 @@ +//go:build linux +// +build linux + +package hugepages + +import ( + "bytes" + "fmt" + "io/ioutil" + "path/filepath" + "strconv" + "strings" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/plugins/inputs" +) + +const ( + // path to root huge page control directory + rootHugepagePath = "/sys/kernel/mm/hugepages" + // path where per NUMA node statistics are kept + numaNodePath = "/sys/devices/system/node" + // path to the meminfo file + meminfoPath = "/proc/meminfo" + + rootHugepages = "root" + perNodeHugepages = "per_node" + meminfoHugepages = "meminfo" + + hugepagesSampleConfig = ` + ## Supported huge page types: + ## - "root" - based on root huge page control directory: /sys/kernel/mm/hugepages + ## - "per_node" - based on per NUMA node directories: /sys/devices/system/node/node[0-9]*/hugepages + ## - "meminfo" - based on /proc/meminfo file + # types = ["root", "per_node"] +` +) + +var ( + newlineByte = []byte("\n") + colonByte = []byte(":") + + hugepagesMetricsRoot = map[string]string{ + "free_hugepages": "free", + "nr_hugepages": "total", + "nr_hugepages_mempolicy": "mempolicy", + "nr_overcommit_hugepages": "overcommit", + "resv_hugepages": "reserved", + "surplus_hugepages": "surplus", + } + + hugepagesMetricsPerNUMANode = map[string]string{ + "free_hugepages": "free", + "nr_hugepages": "total", + "surplus_hugepages": "surplus", + } + + hugepagesMetricsFromMeminfo = map[string]string{ + "HugePages_Total": "total", + "HugePages_Free": "free", + "HugePages_Rsvd": "reserved", + "HugePages_Surp": "surplus", + "Hugepagesize": "size_kb", + "Hugetlb": "tlb_kb", + "AnonHugePages": "anonymous_kb", + "ShmemHugePages": "shared_kb", + "FileHugePages": "file_kb", + } +) + +type Hugepages struct { + Types []string `toml:"types"` + + gatherRoot bool + gatherPerNode bool + gatherMeminfo bool + + rootHugepagePath string + numaNodePath string + meminfoPath string +} + +func (h *Hugepages) Description() string { + return "Gathers huge pages measurements." +} + +func (h *Hugepages) SampleConfig() string { + return hugepagesSampleConfig +} + +func (h *Hugepages) Init() error { + err := h.parseHugepagesConfig() + if err != nil { + return err + } + + h.rootHugepagePath = rootHugepagePath + h.numaNodePath = numaNodePath + h.meminfoPath = meminfoPath + + return nil +} + +func (h *Hugepages) Gather(acc telegraf.Accumulator) error { + if h.gatherRoot { + if err := h.gatherRootStats(acc); err != nil { + return fmt.Errorf("gathering root stats failed: %v", err) + } + } + + if h.gatherPerNode { + if err := h.gatherStatsPerNode(acc); err != nil { + return fmt.Errorf("gathering per node stats failed: %v", err) + } + } + + if h.gatherMeminfo { + if err := h.gatherStatsFromMeminfo(acc); err != nil { + return fmt.Errorf("gathering meminfo stats failed: %v", err) + } + } + + return nil +} + +// gatherStatsPerNode collects root hugepages statistics +func (h *Hugepages) gatherRootStats(acc telegraf.Accumulator) error { + return h.gatherFromHugepagePath(acc, "hugepages_"+rootHugepages, h.rootHugepagePath, hugepagesMetricsRoot, nil) +} + +// gatherStatsPerNode collects hugepages statistics per NUMA node +func (h *Hugepages) gatherStatsPerNode(acc telegraf.Accumulator) error { + nodeDirs, err := ioutil.ReadDir(h.numaNodePath) + if err != nil { + return err + } + + // read metrics from: node*/hugepages/hugepages-*/* + for _, nodeDir := range nodeDirs { + if !nodeDir.IsDir() || !strings.HasPrefix(nodeDir.Name(), "node") { + continue + } + + nodeNumber := strings.TrimPrefix(nodeDir.Name(), "node") + _, err := strconv.Atoi(nodeNumber) + if err != nil { + continue + } + + perNodeTags := map[string]string{ + "node": nodeNumber, + } + hugepagesPath := filepath.Join(h.numaNodePath, nodeDir.Name(), "hugepages") + err = h.gatherFromHugepagePath(acc, "hugepages_"+perNodeHugepages, hugepagesPath, hugepagesMetricsPerNUMANode, perNodeTags) + if err != nil { + return err + } + } + return nil +} + +func (h *Hugepages) gatherFromHugepagePath(acc telegraf.Accumulator, measurement, path string, fileFilter map[string]string, defaultTags map[string]string) error { + // read metrics from: hugepages/hugepages-*/* + hugepagesDirs, err := ioutil.ReadDir(path) + if err != nil { + return fmt.Errorf("reading root dir failed: %v", err) + } + + for _, hugepagesDir := range hugepagesDirs { + if !hugepagesDir.IsDir() || !strings.HasPrefix(hugepagesDir.Name(), "hugepages-") { + continue + } + + hugepagesSize := strings.TrimPrefix(strings.TrimSuffix(hugepagesDir.Name(), "kB"), "hugepages-") + _, err := strconv.Atoi(hugepagesSize) + if err != nil { + continue + } + + metricsPath := filepath.Join(path, hugepagesDir.Name()) + metricFiles, err := ioutil.ReadDir(metricsPath) + if err != nil { + return fmt.Errorf("reading metric dir failed: %v", err) + } + + metrics := make(map[string]interface{}) + for _, metricFile := range metricFiles { + metricName, ok := fileFilter[metricFile.Name()] + if mode := metricFile.Mode(); !mode.IsRegular() || !ok { + continue + } + + metricFullPath := filepath.Join(metricsPath, metricFile.Name()) + metricBytes, err := ioutil.ReadFile(metricFullPath) + if err != nil { + return err + } + + metricValue, err := strconv.Atoi(string(bytes.TrimSuffix(metricBytes, newlineByte))) + if err != nil { + return fmt.Errorf("failed to convert content of '%s': %v", metricFullPath, err) + } + + metrics[metricName] = metricValue + } + + if len(metrics) == 0 { + continue + } + + tags := make(map[string]string) + for key, value := range defaultTags { + tags[key] = value + } + tags["size_kb"] = hugepagesSize + + acc.AddFields(measurement, metrics, tags) + } + return nil +} + +// gatherStatsFromMeminfo collects hugepages statistics from meminfo file +func (h *Hugepages) gatherStatsFromMeminfo(acc telegraf.Accumulator) error { + meminfo, err := ioutil.ReadFile(h.meminfoPath) + if err != nil { + return err + } + + metrics := make(map[string]interface{}) + lines := bytes.Split(meminfo, newlineByte) + for _, line := range lines { + fields := bytes.Fields(line) + if len(fields) < 2 { + continue + } + fieldName := string(bytes.TrimSuffix(fields[0], colonByte)) + metricName, ok := hugepagesMetricsFromMeminfo[fieldName] + if !ok { + continue + } + + fieldValue, err := strconv.Atoi(string(fields[1])) + if err != nil { + return fmt.Errorf("failed to convert content of '%s': %v", fieldName, err) + } + + metrics[metricName] = fieldValue + } + + acc.AddFields("hugepages_"+meminfoHugepages, metrics, map[string]string{}) + return nil +} + +func (h *Hugepages) parseHugepagesConfig() error { + // default + if h.Types == nil { + h.gatherRoot = true + h.gatherMeminfo = true + return nil + } + + // empty array + if len(h.Types) == 0 { + return fmt.Errorf("plugin was configured with nothing to read") + } + + for _, hugepagesType := range h.Types { + switch hugepagesType { + case rootHugepages: + h.gatherRoot = true + case perNodeHugepages: + h.gatherPerNode = true + case meminfoHugepages: + h.gatherMeminfo = true + default: + return fmt.Errorf("provided hugepages type `%s` is not valid", hugepagesType) + } + } + + return nil +} + +func init() { + inputs.Add("hugepages", func() telegraf.Input { + return &Hugepages{} + }) +} diff --git a/plugins/inputs/hugepages/hugepages_notlinux.go b/plugins/inputs/hugepages/hugepages_notlinux.go new file mode 100644 index 0000000000000..c2bd4f5c625f2 --- /dev/null +++ b/plugins/inputs/hugepages/hugepages_notlinux.go @@ -0,0 +1,4 @@ +//go:build !linux +// +build !linux + +package hugepages diff --git a/plugins/inputs/hugepages/hugepages_test.go b/plugins/inputs/hugepages/hugepages_test.go new file mode 100644 index 0000000000000..fa67ea7d6ca64 --- /dev/null +++ b/plugins/inputs/hugepages/hugepages_test.go @@ -0,0 +1,228 @@ +//go:build linux +// +build linux + +package hugepages + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/influxdata/telegraf/testutil" +) + +func TestInit(t *testing.T) { + t.Run("when no config is provided then all fields should be set to default values", func(t *testing.T) { + h := Hugepages{} + err := h.Init() + + require.NoError(t, err) + require.True(t, h.gatherRoot) + require.False(t, h.gatherPerNode) + require.True(t, h.gatherMeminfo) + require.Equal(t, rootHugepagePath, h.rootHugepagePath) + require.Equal(t, numaNodePath, h.numaNodePath) + require.Equal(t, meminfoPath, h.meminfoPath) + }) + + t.Run("when empty hugepages types is provided then plugin should fail to initialize", func(t *testing.T) { + h := Hugepages{Types: []string{}} + err := h.Init() + + require.Error(t, err) + require.Contains(t, err.Error(), "plugin was configured with nothing to read") + }) + + t.Run("when valid hugepages types is provided then proper flags should be set", func(t *testing.T) { + h := Hugepages{Types: []string{"root", "per_node", "meminfo"}} + err := h.Init() + + require.NoError(t, err) + require.True(t, h.gatherRoot) + require.True(t, h.gatherPerNode) + require.True(t, h.gatherMeminfo) + }) + + t.Run("when hugepages types contains not supported value then plugin should fail to initialize", func(t *testing.T) { + h := Hugepages{Types: []string{"root", "per_node", "linux_hdd", "meminfo"}} + err := h.Init() + + require.Error(t, err) + require.Contains(t, err.Error(), "provided hugepages type") + }) +} + +func TestGather(t *testing.T) { + t.Run("when root hugepages type is enabled then gather all root metrics successfully", func(t *testing.T) { + h := Hugepages{ + rootHugepagePath: "./testdata/valid/mm/hugepages", + gatherRoot: true, + } + + acc := &testutil.Accumulator{} + require.NoError(t, h.Gather(acc)) + + expectedFields := map[string]interface{}{ + "free": 883, + "reserved": 0, + "surplus": 0, + "mempolicy": 2048, + "total": 2048, + "overcommit": 0, + } + acc.AssertContainsTaggedFields(t, "hugepages_root", expectedFields, map[string]string{"size_kb": "2048"}) + + expectedFields = map[string]interface{}{ + "free": 0, + "reserved": 0, + "surplus": 0, + "mempolicy": 8, + "total": 8, + "overcommit": 0, + } + acc.AssertContainsTaggedFields(t, "hugepages_root", expectedFields, map[string]string{"size_kb": "1048576"}) + }) + + t.Run("when per node hugepages type is enabled then gather all per node metrics successfully", func(t *testing.T) { + h := Hugepages{ + numaNodePath: "./testdata/valid/node", + gatherPerNode: true, + } + + acc := &testutil.Accumulator{} + require.NoError(t, h.Gather(acc)) + + expectedFields := map[string]interface{}{ + "free": 434, + "surplus": 0, + "total": 1024, + } + acc.AssertContainsTaggedFields(t, "hugepages_per_node", expectedFields, map[string]string{"size_kb": "2048", "node": "0"}) + + expectedFields = map[string]interface{}{ + "free": 449, + "surplus": 0, + "total": 1024, + } + acc.AssertContainsTaggedFields(t, "hugepages_per_node", expectedFields, map[string]string{"size_kb": "2048", "node": "1"}) + + expectedFields = map[string]interface{}{ + "free": 0, + "surplus": 0, + "total": 4, + } + acc.AssertContainsTaggedFields(t, "hugepages_per_node", expectedFields, map[string]string{"size_kb": "1048576", "node": "0"}) + + expectedFields = map[string]interface{}{ + "free": 0, + "surplus": 0, + "total": 4, + } + acc.AssertContainsTaggedFields(t, "hugepages_per_node", expectedFields, map[string]string{"size_kb": "1048576", "node": "1"}) + }) + + t.Run("when meminfo hugepages type is enabled then gather all meminfo metrics successfully", func(t *testing.T) { + h := Hugepages{ + meminfoPath: "./testdata/valid/meminfo", + gatherMeminfo: true, + } + + acc := &testutil.Accumulator{} + require.NoError(t, h.Gather(acc)) + + expectedFields := map[string]interface{}{ + "anonymous_kb": 0, + "shared_kb": 0, + "file_kb": 0, + "total": 2048, + "free": 883, + "reserved": 0, + "surplus": 0, + "size_kb": 2048, + "tlb_kb": 12582912, + } + acc.AssertContainsFields(t, "hugepages_meminfo", expectedFields) + }) + + t.Run("when root hugepages type is enabled but path is invalid then return error", func(t *testing.T) { + h := Hugepages{ + rootHugepagePath: "./testdata/not_existing_path", + gatherRoot: true, + } + + acc := &testutil.Accumulator{} + require.Error(t, h.Gather(acc)) + }) + + t.Run("when root hugepages type is enabled but files/directories don't have proper naming then gather no metrics", func(t *testing.T) { + h := Hugepages{ + rootHugepagePath: "./testdata/invalid/1/node0/hugepages", + gatherRoot: true, + } + + acc := &testutil.Accumulator{} + require.NoError(t, h.Gather(acc)) + require.Nil(t, acc.Metrics) + }) + + t.Run("when root hugepages type is enabled but metric file doesn't contain number then return error", func(t *testing.T) { + h := Hugepages{ + rootHugepagePath: "./testdata/invalid/2/node1/hugepages", + gatherRoot: true, + } + + acc := &testutil.Accumulator{} + require.Error(t, h.Gather(acc)) + }) + + t.Run("when per node hugepages type is enabled but path is invalid then return error", func(t *testing.T) { + h := Hugepages{ + numaNodePath: "./testdata/not_existing_path", + gatherPerNode: true, + } + + acc := &testutil.Accumulator{} + require.Error(t, h.Gather(acc)) + }) + + t.Run("when per node hugepages type is enabled but files/directories don't have proper naming then gather no metrics", func(t *testing.T) { + h := Hugepages{ + numaNodePath: "./testdata/invalid/1", + gatherPerNode: true, + } + + acc := &testutil.Accumulator{} + require.NoError(t, h.Gather(acc)) + require.Nil(t, acc.Metrics) + }) + + t.Run("when per node hugepages type is enabled but metric file doesn't contain number then return error", func(t *testing.T) { + h := Hugepages{ + numaNodePath: "./testdata/invalid/2/", + gatherPerNode: true, + } + + acc := &testutil.Accumulator{} + require.Error(t, h.Gather(acc)) + }) + + t.Run("when meminfo hugepages type is enabled but path is invalid then return error", func(t *testing.T) { + h := Hugepages{ + meminfoPath: "./testdata/not_existing_path", + gatherMeminfo: true, + } + + acc := &testutil.Accumulator{} + require.Error(t, h.Gather(acc)) + }) + + t.Run("when per node hugepages type is enabled but any metric doesn't contain number then return error", func(t *testing.T) { + h := Hugepages{ + meminfoPath: "./testdata/invalid/meminfo", + gatherMeminfo: true, + } + + acc := &testutil.Accumulator{} + require.Error(t, h.Gather(acc)) + }) +} diff --git a/plugins/inputs/hugepages/testdata/invalid/1/anode3/dir_lock b/plugins/inputs/hugepages/testdata/invalid/1/anode3/dir_lock new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-1048576kB/free_hugepages/dir_lock b/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-1048576kB/free_hugepages/dir_lock new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-1048576kB/nry_hugepages b/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-1048576kB/nry_hugepages new file mode 100644 index 0000000000000..eb08bc0b0bc3a --- /dev/null +++ b/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-1048576kB/nry_hugepages @@ -0,0 +1 @@ +240 diff --git a/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-2048kB b/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-2048kB new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-aaaa1048576kB/free_hugepages b/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-aaaa1048576kB/free_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages-aaaa1048576kB/free_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages1048576kB/free_hugepages b/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages1048576kB/free_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/invalid/1/node0/hugepages/hugepages1048576kB/free_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/invalid/1/node1 b/plugins/inputs/hugepages/testdata/invalid/1/node1 new file mode 100644 index 0000000000000..896266208f3cf --- /dev/null +++ b/plugins/inputs/hugepages/testdata/invalid/1/node1 @@ -0,0 +1 @@ +whatever \ No newline at end of file diff --git a/plugins/inputs/hugepages/testdata/invalid/1/node4b/dir_lock b/plugins/inputs/hugepages/testdata/invalid/1/node4b/dir_lock new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/plugins/inputs/hugepages/testdata/invalid/2/node1/hugepages/hugepages-1048576kB/nr_hugepages b/plugins/inputs/hugepages/testdata/invalid/2/node1/hugepages/hugepages-1048576kB/nr_hugepages new file mode 100644 index 0000000000000..4ae3c5803c087 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/invalid/2/node1/hugepages/hugepages-1048576kB/nr_hugepages @@ -0,0 +1 @@ +fourty two \ No newline at end of file diff --git a/plugins/inputs/hugepages/testdata/invalid/meminfo b/plugins/inputs/hugepages/testdata/invalid/meminfo new file mode 100644 index 0000000000000..2133623930633 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/invalid/meminfo @@ -0,0 +1,8 @@ +AnonHugePages: 0 kB +ShmemHugePages: 0 kB +HugePages_Total: 2048 +HugePages_Free: sixtynine +HugePages_Rsvd: 0 +HugePages_Surp: 0 +Hugepagesize: 2048 kB +Hugetlb: 12582912 kB diff --git a/plugins/inputs/hugepages/testdata/valid/meminfo b/plugins/inputs/hugepages/testdata/valid/meminfo new file mode 100644 index 0000000000000..16395b60bc116 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/meminfo @@ -0,0 +1,51 @@ +MemTotal: 264026876 kB +MemFree: 260102944 kB +MemAvailable: 260015468 kB +Buffers: 115268 kB +Cached: 1203416 kB +SwapCached: 0 kB +Active: 599752 kB +Inactive: 950072 kB +Active(anon): 2740 kB +Inactive(anon): 224176 kB +Active(file): 597012 kB +Inactive(file): 725896 kB +Unevictable: 0 kB +Mlocked: 0 kB +SwapTotal: 8388604 kB +SwapFree: 8388604 kB +Dirty: 0 kB +Writeback: 0 kB +AnonPages: 231220 kB +Mapped: 317748 kB +Shmem: 5848 kB +KReclaimable: 170796 kB +Slab: 347860 kB +SReclaimable: 170796 kB +SUnreclaim: 177064 kB +KernelStack: 13776 kB +PageTables: 10756 kB +NFS_Unstable: 0 kB +Bounce: 0 kB +WritebackTmp: 0 kB +CommitLimit: 140139896 kB +Committed_AS: 2661568 kB +VmallocTotal: 34359738367 kB +VmallocUsed: 264276 kB +VmallocChunk: 0 kB +Percpu: 40896 kB +HardwareCorrupted: 0 kB +AnonHugePages: 0 kB +ShmemHugePages: 0 kB +ShmemPmdMapped: 0 kB +FileHugePages: 0 kB +FilePmdMapped: 0 kB +HugePages_Total: 2048 +HugePages_Free: 883 +HugePages_Rsvd: 0 +HugePages_Surp: 0 +Hugepagesize: 2048 kB +Hugetlb: 12582912 kB +DirectMap4k: 312056 kB +DirectMap2M: 6930432 kB +DirectMap1G: 263192576 kB diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/free_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/free_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/free_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_hugepages new file mode 100644 index 0000000000000..45a4fb75db864 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_hugepages @@ -0,0 +1 @@ +8 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_hugepages_mempolicy b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_hugepages_mempolicy new file mode 100644 index 0000000000000..45a4fb75db864 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_hugepages_mempolicy @@ -0,0 +1 @@ +8 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_overcommit_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_overcommit_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/nr_overcommit_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/resv_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/resv_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/resv_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/surplus_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/surplus_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-1048576kB/surplus_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/free_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/free_hugepages new file mode 100644 index 0000000000000..d1935688f8d64 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/free_hugepages @@ -0,0 +1 @@ +883 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_hugepages new file mode 100644 index 0000000000000..c873496a2275b --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_hugepages @@ -0,0 +1 @@ +2048 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_hugepages_mempolicy b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_hugepages_mempolicy new file mode 100644 index 0000000000000..c873496a2275b --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_hugepages_mempolicy @@ -0,0 +1 @@ +2048 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/nr_overcommit_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/resv_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/resv_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/resv_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/surplus_hugepages b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/surplus_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/mm/hugepages/hugepages-2048kB/surplus_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/free_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/free_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/free_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/nr_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/nr_hugepages new file mode 100644 index 0000000000000..b8626c4cff284 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/nr_hugepages @@ -0,0 +1 @@ +4 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/surplus_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/surplus_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-1048576kB/surplus_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/free_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/free_hugepages new file mode 100644 index 0000000000000..e828e5d06015c --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/free_hugepages @@ -0,0 +1 @@ +434 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/nr_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/nr_hugepages new file mode 100644 index 0000000000000..d7b1c440c0f3f --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/nr_hugepages @@ -0,0 +1 @@ +1024 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/surplus_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/surplus_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node0/hugepages/hugepages-2048kB/surplus_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/free_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/free_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/free_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/nr_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/nr_hugepages new file mode 100644 index 0000000000000..b8626c4cff284 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/nr_hugepages @@ -0,0 +1 @@ +4 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/surplus_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/surplus_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-1048576kB/surplus_hugepages @@ -0,0 +1 @@ +0 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/free_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/free_hugepages new file mode 100644 index 0000000000000..2b20fd09737d6 --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/free_hugepages @@ -0,0 +1 @@ +449 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/nr_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/nr_hugepages new file mode 100644 index 0000000000000..d7b1c440c0f3f --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/nr_hugepages @@ -0,0 +1 @@ +1024 diff --git a/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/surplus_hugepages b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/surplus_hugepages new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/plugins/inputs/hugepages/testdata/valid/node/node1/hugepages/hugepages-2048kB/surplus_hugepages @@ -0,0 +1 @@ +0