From 997a8fbb7f9e88ef64f4e227b0b9a7d4791f4eaf Mon Sep 17 00:00:00 2001 From: "Wisniewski, Krzysztof2" Date: Wed, 23 Dec 2020 13:49:21 +0100 Subject: [PATCH] Add zoneinfo collector Signed-off-by: Wisniewski, Krzysztof2 --- collector/fixtures/e2e-output.txt | 172 +++++++++++++++++++ collector/fixtures/proc/zoneinfo | 265 ++++++++++++++++++++++++++++++ collector/zoneinfo_linux.go | 240 +++++++++++++++++++++++++++ end-to-end-test.sh | 1 + 4 files changed, 678 insertions(+) create mode 100644 collector/fixtures/proc/zoneinfo create mode 100644 collector/zoneinfo_linux.go diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index ef501f04..e8c27d00 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -2687,6 +2687,7 @@ node_scrape_collector_success{collector="vmstat"} 1 node_scrape_collector_success{collector="wifi"} 1 node_scrape_collector_success{collector="xfs"} 1 node_scrape_collector_success{collector="zfs"} 1 +node_scrape_collector_success{collector="zoneinfo"} 1 # HELP node_sockstat_FRAG6_inuse Number of FRAG6 sockets in state inuse. # TYPE node_sockstat_FRAG6_inuse gauge node_sockstat_FRAG6_inuse 0 @@ -3799,6 +3800,177 @@ node_zfs_zpool_wtime{zpool="poolz1"} 9.673715628e+09 # TYPE node_zfs_zpool_wupdate untyped node_zfs_zpool_wupdate{zpool="pool1"} 7.9210489694949e+13 node_zfs_zpool_wupdate{zpool="poolz1"} 1.10734831833266e+14 +# HELP node_zoneinfo_high_pages Zone watermark pages_high +# TYPE node_zoneinfo_high_pages gauge +node_zoneinfo_high_pages{node="0",zone=""} 14 +node_zoneinfo_high_pages{node="0",zone="DMA32"} 2122 +node_zoneinfo_high_pages{node="0",zone="Device"} 0 +node_zoneinfo_high_pages{node="0",zone="Movable"} 0 +node_zoneinfo_high_pages{node="0",zone="Normal"} 31113 +# HELP node_zoneinfo_low_pages Zone watermark pages_low +# TYPE node_zoneinfo_low_pages gauge +node_zoneinfo_low_pages{node="0",zone=""} 11 +node_zoneinfo_low_pages{node="0",zone="DMA32"} 1600 +node_zoneinfo_low_pages{node="0",zone="Device"} 0 +node_zoneinfo_low_pages{node="0",zone="Movable"} 0 +node_zoneinfo_low_pages{node="0",zone="Normal"} 23461 +# HELP node_zoneinfo_managed_pages Present pages managed by the buddy system +# TYPE node_zoneinfo_managed_pages gauge +node_zoneinfo_managed_pages{node="0",zone=""} 3973 +node_zoneinfo_managed_pages{node="0",zone="DMA32"} 530339 +node_zoneinfo_managed_pages{node="0",zone="Device"} 0 +node_zoneinfo_managed_pages{node="0",zone="Movable"} 0 +node_zoneinfo_managed_pages{node="0",zone="Normal"} 7.654794e+06 +# HELP node_zoneinfo_min_pages Zone watermark pages_min +# TYPE node_zoneinfo_min_pages gauge +node_zoneinfo_min_pages{node="0",zone=""} 8 +node_zoneinfo_min_pages{node="0",zone="DMA32"} 1078 +node_zoneinfo_min_pages{node="0",zone="Device"} 0 +node_zoneinfo_min_pages{node="0",zone="Movable"} 0 +node_zoneinfo_min_pages{node="0",zone="Normal"} 15809 +# HELP node_zoneinfo_nr_active_anon_pages Number of anonymous pages recently more used +# TYPE node_zoneinfo_nr_active_anon_pages gauge +node_zoneinfo_nr_active_anon_pages{node="0",zone=""} 1.175853e+06 +# HELP node_zoneinfo_nr_active_file_pages Number of active pages with file-backing +# TYPE node_zoneinfo_nr_active_file_pages gauge +node_zoneinfo_nr_active_file_pages{node="0",zone=""} 688810 +# HELP node_zoneinfo_nr_anon_pages Number of anonymous pages currently used by the system +# TYPE node_zoneinfo_nr_anon_pages gauge +node_zoneinfo_nr_anon_pages{node="0",zone=""} 1.156608e+06 +# HELP node_zoneinfo_nr_anon_transparent_hugepages Number of anonymous transparent huge pages currently used by the system +# TYPE node_zoneinfo_nr_anon_transparent_hugepages gauge +node_zoneinfo_nr_anon_transparent_hugepages{node="0",zone=""} 0 +# HELP node_zoneinfo_nr_dirtied_total Page dirtyings since bootup +# TYPE node_zoneinfo_nr_dirtied_total counter +node_zoneinfo_nr_dirtied_total{node="0",zone=""} 1.189097e+06 +# HELP node_zoneinfo_nr_dirty_pages Number of dirty pages +# TYPE node_zoneinfo_nr_dirty_pages gauge +node_zoneinfo_nr_dirty_pages{node="0",zone=""} 103 +# HELP node_zoneinfo_nr_file_pages Number of file pages +# TYPE node_zoneinfo_nr_file_pages gauge +node_zoneinfo_nr_file_pages{node="0",zone=""} 1.740118e+06 +# HELP node_zoneinfo_nr_free_pages Total number of free pages in the zone +# TYPE node_zoneinfo_nr_free_pages gauge +node_zoneinfo_nr_free_pages{node="0",zone=""} 2949 +node_zoneinfo_nr_free_pages{node="0",zone="DMA32"} 528427 +node_zoneinfo_nr_free_pages{node="0",zone="Normal"} 4.539739e+06 +# HELP node_zoneinfo_nr_inactive_anon_pages Number of anonymous pages recently less used +# TYPE node_zoneinfo_nr_inactive_anon_pages gauge +node_zoneinfo_nr_inactive_anon_pages{node="0",zone=""} 95612 +# HELP node_zoneinfo_nr_inactive_file_pages Number of inactive pages with file-backing +# TYPE node_zoneinfo_nr_inactive_file_pages gauge +node_zoneinfo_nr_inactive_file_pages{node="0",zone=""} 723339 +# HELP node_zoneinfo_nr_isolated_anon_pages Temporary isolated pages from anon lru +# TYPE node_zoneinfo_nr_isolated_anon_pages gauge +node_zoneinfo_nr_isolated_anon_pages{node="0",zone=""} 0 +# HELP node_zoneinfo_nr_isolated_file_pages Temporary isolated pages from file lru +# TYPE node_zoneinfo_nr_isolated_file_pages gauge +node_zoneinfo_nr_isolated_file_pages{node="0",zone=""} 0 +# HELP node_zoneinfo_nr_kernel_stacks Number of kernel stacks +# TYPE node_zoneinfo_nr_kernel_stacks gauge +node_zoneinfo_nr_kernel_stacks{node="0",zone=""} 0 +node_zoneinfo_nr_kernel_stacks{node="0",zone="DMA32"} 0 +node_zoneinfo_nr_kernel_stacks{node="0",zone="Normal"} 18864 +# HELP node_zoneinfo_nr_mapped_pages Number of mapped pages +# TYPE node_zoneinfo_nr_mapped_pages gauge +node_zoneinfo_nr_mapped_pages{node="0",zone=""} 423143 +# HELP node_zoneinfo_nr_shmem_pages Number of shmem pages (included tmpfs/GEM pages) +# TYPE node_zoneinfo_nr_shmem_pages gauge +node_zoneinfo_nr_shmem_pages{node="0",zone=""} 330517 +# HELP node_zoneinfo_nr_slab_reclaimable_pages Number of reclaimable slab pages +# TYPE node_zoneinfo_nr_slab_reclaimable_pages gauge +node_zoneinfo_nr_slab_reclaimable_pages{node="0",zone=""} 121763 +# HELP node_zoneinfo_nr_slab_unreclaimable_pages Number of unreclaimable slab pages +# TYPE node_zoneinfo_nr_slab_unreclaimable_pages gauge +node_zoneinfo_nr_slab_unreclaimable_pages{node="0",zone=""} 56182 +# HELP node_zoneinfo_nr_unevictable_pages Number of unevictable pages +# TYPE node_zoneinfo_nr_unevictable_pages gauge +node_zoneinfo_nr_unevictable_pages{node="0",zone=""} 213111 +# HELP node_zoneinfo_nr_writeback_pages Number of writeback pages +# TYPE node_zoneinfo_nr_writeback_pages gauge +node_zoneinfo_nr_writeback_pages{node="0",zone=""} 0 +# HELP node_zoneinfo_nr_written_total Page writings since bootup +# TYPE node_zoneinfo_nr_written_total counter +node_zoneinfo_nr_written_total{node="0",zone=""} 1.181554e+06 +# HELP node_zoneinfo_numa_foreign_total Was intended here, hit elsewhere +# TYPE node_zoneinfo_numa_foreign_total counter +node_zoneinfo_numa_foreign_total{node="0",zone=""} 0 +node_zoneinfo_numa_foreign_total{node="0",zone="DMA32"} 0 +node_zoneinfo_numa_foreign_total{node="0",zone="Normal"} 0 +# HELP node_zoneinfo_numa_hit_total Allocated in intended node +# TYPE node_zoneinfo_numa_hit_total counter +node_zoneinfo_numa_hit_total{node="0",zone=""} 1 +node_zoneinfo_numa_hit_total{node="0",zone="DMA32"} 13 +node_zoneinfo_numa_hit_total{node="0",zone="Normal"} 6.2836441e+07 +# HELP node_zoneinfo_numa_interleave_total Interleaver preferred this zone +# TYPE node_zoneinfo_numa_interleave_total counter +node_zoneinfo_numa_interleave_total{node="0",zone=""} 1 +node_zoneinfo_numa_interleave_total{node="0",zone="DMA32"} 1 +node_zoneinfo_numa_interleave_total{node="0",zone="Normal"} 23174 +# HELP node_zoneinfo_numa_local_total Allocation from local node +# TYPE node_zoneinfo_numa_local_total counter +node_zoneinfo_numa_local_total{node="0",zone=""} 1 +node_zoneinfo_numa_local_total{node="0",zone="DMA32"} 13 +node_zoneinfo_numa_local_total{node="0",zone="Normal"} 6.2836441e+07 +# HELP node_zoneinfo_numa_miss_total Allocated in non intended node +# TYPE node_zoneinfo_numa_miss_total counter +node_zoneinfo_numa_miss_total{node="0",zone=""} 0 +node_zoneinfo_numa_miss_total{node="0",zone="DMA32"} 0 +node_zoneinfo_numa_miss_total{node="0",zone="Normal"} 0 +# HELP node_zoneinfo_numa_other_total Allocation from other node +# TYPE node_zoneinfo_numa_other_total counter +node_zoneinfo_numa_other_total{node="0",zone=""} 0 +node_zoneinfo_numa_other_total{node="0",zone="DMA32"} 0 +node_zoneinfo_numa_other_total{node="0",zone="Normal"} 0 +# HELP node_zoneinfo_present_pages Physical pages existing within the zone +# TYPE node_zoneinfo_present_pages gauge +node_zoneinfo_present_pages{node="0",zone=""} 3997 +node_zoneinfo_present_pages{node="0",zone="DMA32"} 546847 +node_zoneinfo_present_pages{node="0",zone="Device"} 0 +node_zoneinfo_present_pages{node="0",zone="Movable"} 0 +node_zoneinfo_present_pages{node="0",zone="Normal"} 7.806976e+06 +# HELP node_zoneinfo_protection_0 Protection array 0. field +# TYPE node_zoneinfo_protection_0 gauge +node_zoneinfo_protection_0{node="0",zone=""} 0 +node_zoneinfo_protection_0{node="0",zone="DMA32"} 0 +node_zoneinfo_protection_0{node="0",zone="Device"} 0 +node_zoneinfo_protection_0{node="0",zone="Movable"} 0 +node_zoneinfo_protection_0{node="0",zone="Normal"} 0 +# HELP node_zoneinfo_protection_1 Protection array 1. field +# TYPE node_zoneinfo_protection_1 gauge +node_zoneinfo_protection_1{node="0",zone=""} 2039 +node_zoneinfo_protection_1{node="0",zone="DMA32"} 0 +node_zoneinfo_protection_1{node="0",zone="Device"} 0 +node_zoneinfo_protection_1{node="0",zone="Movable"} 0 +node_zoneinfo_protection_1{node="0",zone="Normal"} 0 +# HELP node_zoneinfo_protection_2 Protection array 2. field +# TYPE node_zoneinfo_protection_2 gauge +node_zoneinfo_protection_2{node="0",zone=""} 31932 +node_zoneinfo_protection_2{node="0",zone="DMA32"} 29893 +node_zoneinfo_protection_2{node="0",zone="Device"} 0 +node_zoneinfo_protection_2{node="0",zone="Movable"} 0 +node_zoneinfo_protection_2{node="0",zone="Normal"} 0 +# HELP node_zoneinfo_protection_3 Protection array 3. field +# TYPE node_zoneinfo_protection_3 gauge +node_zoneinfo_protection_3{node="0",zone=""} 31932 +node_zoneinfo_protection_3{node="0",zone="DMA32"} 29893 +node_zoneinfo_protection_3{node="0",zone="Device"} 0 +node_zoneinfo_protection_3{node="0",zone="Movable"} 0 +node_zoneinfo_protection_3{node="0",zone="Normal"} 0 +# HELP node_zoneinfo_protection_4 Protection array 4. field +# TYPE node_zoneinfo_protection_4 gauge +node_zoneinfo_protection_4{node="0",zone=""} 31932 +node_zoneinfo_protection_4{node="0",zone="DMA32"} 29893 +node_zoneinfo_protection_4{node="0",zone="Device"} 0 +node_zoneinfo_protection_4{node="0",zone="Movable"} 0 +node_zoneinfo_protection_4{node="0",zone="Normal"} 0 +# HELP node_zoneinfo_spanned_pages Total pages spanned by the zone, including holes +# TYPE node_zoneinfo_spanned_pages gauge +node_zoneinfo_spanned_pages{node="0",zone=""} 4095 +node_zoneinfo_spanned_pages{node="0",zone="DMA32"} 1.04448e+06 +node_zoneinfo_spanned_pages{node="0",zone="Device"} 0 +node_zoneinfo_spanned_pages{node="0",zone="Movable"} 0 +node_zoneinfo_spanned_pages{node="0",zone="Normal"} 7.806976e+06 # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. # TYPE process_cpu_seconds_total counter # HELP process_max_fds Maximum number of open file descriptors. diff --git a/collector/fixtures/proc/zoneinfo b/collector/fixtures/proc/zoneinfo new file mode 100644 index 00000000..82ff3d63 --- /dev/null +++ b/collector/fixtures/proc/zoneinfo @@ -0,0 +1,265 @@ +Node 0, zone DMA + per-node stats + nr_inactive_anon 95612 + nr_active_anon 1175853 + nr_inactive_file 723339 + nr_active_file 688810 + nr_unevictable 213111 + nr_slab_reclaimable 121763 + nr_slab_unreclaimable 56182 + nr_isolated_anon 0 + nr_isolated_file 0 + workingset_nodes 0 + workingset_refault 0 + workingset_activate 0 + workingset_restore 0 + workingset_nodereclaim 0 + nr_anon_pages 1156608 + nr_mapped 423143 + nr_file_pages 1740118 + nr_dirty 103 + nr_writeback 0 + nr_writeback_temp 0 + nr_shmem 330517 + nr_shmem_hugepages 0 + nr_shmem_pmdmapped 0 + nr_file_hugepages 0 + nr_file_pmdmapped 0 + nr_anon_transparent_hugepages 0 + nr_vmscan_write 0 + nr_vmscan_immediate_reclaim 0 + nr_dirtied 1189097 + nr_written 1181554 + nr_kernel_misc_reclaimable 0 + nr_foll_pin_acquired 3 + nr_foll_pin_released 3 + pages free 2949 + min 8 + low 11 + high 14 + spanned 4095 + present 3997 + managed 3973 + protection: (0, 2039, 31932, 31932, 31932) + nr_free_pages 2949 + nr_zone_inactive_anon 0 + nr_zone_active_anon 0 + nr_zone_inactive_file 0 + nr_zone_active_file 0 + nr_zone_unevictable 0 + nr_zone_write_pending 0 + nr_mlock 0 + nr_page_table_pages 0 + nr_kernel_stack 0 + nr_bounce 0 + nr_zspages 0 + nr_free_cma 0 + numa_hit 1 + numa_miss 0 + numa_foreign 0 + numa_interleave 1 + numa_local 1 + numa_other 0 + pagesets + cpu: 0 + count: 0 + high: 0 + batch: 1 + vm stats threshold: 8 + cpu: 1 + count: 0 + high: 0 + batch: 1 + vm stats threshold: 8 + cpu: 2 + count: 0 + high: 0 + batch: 1 + vm stats threshold: 8 + cpu: 3 + count: 0 + high: 0 + batch: 1 + vm stats threshold: 8 + cpu: 4 + count: 0 + high: 0 + batch: 1 + vm stats threshold: 8 + cpu: 5 + count: 0 + high: 0 + batch: 1 + vm stats threshold: 8 + cpu: 6 + count: 0 + high: 0 + batch: 1 + vm stats threshold: 8 + cpu: 7 + count: 0 + high: 0 + batch: 1 + vm stats threshold: 8 + node_unreclaimable: 0 + start_pfn: 1 +Node 0, zone DMA32 + pages free 528427 + min 1078 + low 1600 + high 2122 + spanned 1044480 + present 546847 + managed 530339 + protection: (0, 0, 29893, 29893, 29893) + nr_free_pages 528427 + nr_zone_inactive_anon 0 + nr_zone_active_anon 0 + nr_zone_inactive_file 0 + nr_zone_active_file 0 + nr_zone_unevictable 0 + nr_zone_write_pending 0 + nr_mlock 0 + nr_page_table_pages 0 + nr_kernel_stack 0 + nr_bounce 0 + nr_zspages 0 + nr_free_cma 0 + numa_hit 13 + numa_miss 0 + numa_foreign 0 + numa_interleave 1 + numa_local 13 + numa_other 0 + pagesets + cpu: 0 + count: 357 + high: 378 + batch: 63 + vm stats threshold: 48 + cpu: 1 + count: 0 + high: 378 + batch: 63 + vm stats threshold: 48 + cpu: 2 + count: 338 + high: 378 + batch: 63 + vm stats threshold: 48 + cpu: 3 + count: 0 + high: 378 + batch: 63 + vm stats threshold: 48 + cpu: 4 + count: 62 + high: 378 + batch: 63 + vm stats threshold: 48 + cpu: 5 + count: 63 + high: 378 + batch: 63 + vm stats threshold: 48 + cpu: 6 + count: 0 + high: 378 + batch: 63 + vm stats threshold: 48 + cpu: 7 + count: 63 + high: 378 + batch: 63 + vm stats threshold: 48 + node_unreclaimable: 0 + start_pfn: 4096 +Node 0, zone Normal + pages free 4539739 + min 15809 + low 23461 + high 31113 + spanned 7806976 + present 7806976 + managed 7654794 + protection: (0, 0, 0, 0, 0) + nr_free_pages 4539739 + nr_zone_inactive_anon 95612 + nr_zone_active_anon 1175853 + nr_zone_inactive_file 723339 + nr_zone_active_file 688810 + nr_zone_unevictable 213111 + nr_zone_write_pending 103 + nr_mlock 12 + nr_page_table_pages 13921 + nr_kernel_stack 18864 + nr_bounce 0 + nr_zspages 0 + nr_free_cma 0 + numa_hit 62836441 + numa_miss 0 + numa_foreign 0 + numa_interleave 23174 + numa_local 62836441 + numa_other 0 + pagesets + cpu: 0 + count: 351 + high: 378 + batch: 63 + vm stats threshold: 72 + cpu: 1 + count: 112 + high: 378 + batch: 63 + vm stats threshold: 72 + cpu: 2 + count: 368 + high: 378 + batch: 63 + vm stats threshold: 72 + cpu: 3 + count: 358 + high: 378 + batch: 63 + vm stats threshold: 72 + cpu: 4 + count: 304 + high: 378 + batch: 63 + vm stats threshold: 72 + cpu: 5 + count: 112 + high: 378 + batch: 63 + vm stats threshold: 72 + cpu: 6 + count: 488 + high: 378 + batch: 63 + vm stats threshold: 72 + cpu: 7 + count: 342 + high: 378 + batch: 63 + vm stats threshold: 72 + node_unreclaimable: 0 + start_pfn: 1048576 +Node 0, zone Movable + pages free 0 + min 0 + low 0 + high 0 + spanned 0 + present 0 + managed 0 + protection: (0, 0, 0, 0, 0) +Node 0, zone Device + pages free 0 + min 0 + low 0 + high 0 + spanned 0 + present 0 + managed 0 + protection: (0, 0, 0, 0, 0) \ No newline at end of file diff --git a/collector/zoneinfo_linux.go b/collector/zoneinfo_linux.go new file mode 100644 index 00000000..66929d60 --- /dev/null +++ b/collector/zoneinfo_linux.go @@ -0,0 +1,240 @@ +// Copyright 2020 The Prometheus Authors +// 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. + +package collector + +import ( + "fmt" + "reflect" + + "github.com/go-kit/kit/log" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/procfs" +) + +const zoneinfoSubsystem = "zoneinfo" + +type zoneinfoCollector struct { + gaugeMetricDescs map[string]*prometheus.Desc + counterMetricDescs map[string]*prometheus.Desc + logger log.Logger + fs procfs.FS +} + +func init() { + registerCollector("zoneinfo", defaultDisabled, NewZoneinfoCollector) +} + +// NewZoneinfoCollector returns a new Collector exposing zone stats. +func NewZoneinfoCollector(logger log.Logger) (Collector, error) { + fs, err := procfs.NewFS(*procPath) + if err != nil { + return nil, fmt.Errorf("failed to open procfs: %w", err) + } + return &zoneinfoCollector{ + gaugeMetricDescs: createGaugeMetricDescriptions(), + counterMetricDescs: createCounterMetricDescriptions(), + logger: logger, + fs: fs, + }, nil +} + +func (c *zoneinfoCollector) Update(ch chan<- prometheus.Metric) error { + metrics, err := c.fs.Zoneinfo() + if err != nil { + return fmt.Errorf("couldn't get zoneinfo: %w", err) + } + for _, metric := range metrics { + node := metric.Node + zone := metric.Zone + metricStruct := reflect.ValueOf(metric) + typeOfMetricStruct := metricStruct.Type() + for i := 0; i < metricStruct.NumField(); i++ { + value := reflect.Indirect(metricStruct.Field(i)) + if value.Kind() != reflect.Int64 { + continue + } + metricName := typeOfMetricStruct.Field(i).Name + desc, ok := c.gaugeMetricDescs[metricName] + metricType := prometheus.GaugeValue + if !ok { + desc = c.counterMetricDescs[metricName] + metricType = prometheus.CounterValue + } + ch <- prometheus.MustNewConstMetric(desc, metricType, + float64(reflect.Indirect(metricStruct.Field(i)).Int()), + node, zone) + } + for i, value := range metric.Protection { + metricName := fmt.Sprintf("protection_%d", i) + desc, ok := c.gaugeMetricDescs[metricName] + if !ok { + desc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, metricName), + fmt.Sprintf("Protection array %d. field", i), + []string{"node", "zone"}, nil) + c.gaugeMetricDescs[metricName] = desc + } + ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, + float64(*value), node, zone) + } + + } + return nil +} +func createGaugeMetricDescriptions() map[string]*prometheus.Desc { + return map[string]*prometheus.Desc{ + "NrFreePages": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_free_pages"), + "Total number of free pages in the zone", + []string{"node", "zone"}, nil), + "Min": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "min_pages"), + "Zone watermark pages_min", + []string{"node", "zone"}, nil), + "Low": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "low_pages"), + "Zone watermark pages_low", + []string{"node", "zone"}, nil), + "High": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "high_pages"), + "Zone watermark pages_high", + []string{"node", "zone"}, nil), + "Scanned": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "scanned_pages"), + "Pages scanned since last reclaim", + []string{"node", "zone"}, nil), + "Spanned": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "spanned_pages"), + "Total pages spanned by the zone, including holes", + []string{"node", "zone"}, nil), + "Present": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "present_pages"), + "Physical pages existing within the zone", + []string{"node", "zone"}, nil), + "Managed": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "managed_pages"), + "Present pages managed by the buddy system", + []string{"node", "zone"}, nil), + "NrActiveAnon": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_active_anon_pages"), + "Number of anonymous pages recently more used", + []string{"node", "zone"}, nil), + "NrInactiveAnon": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_inactive_anon_pages"), + "Number of anonymous pages recently less used", + []string{"node", "zone"}, nil), + "NrIsolatedAnon": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_isolated_anon_pages"), + "Temporary isolated pages from anon lru", + []string{"node", "zone"}, nil), + "NrAnonPages": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_anon_pages"), + "Number of anonymous pages currently used by the system", + []string{"node", "zone"}, nil), + "NrAnonTransparentHugepages": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_anon_transparent_hugepages"), + "Number of anonymous transparent huge pages currently used by the system", + []string{"node", "zone"}, nil), + "NrActiveFile": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_active_file_pages"), + "Number of active pages with file-backing", + []string{"node", "zone"}, nil), + "NrInactiveFile": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_inactive_file_pages"), + "Number of inactive pages with file-backing", + []string{"node", "zone"}, nil), + "NrIsolatedFile": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_isolated_file_pages"), + "Temporary isolated pages from file lru", + []string{"node", "zone"}, nil), + "NrFilePages": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_file_pages"), + "Number of file pages", + []string{"node", "zone"}, nil), + "NrSlabReclaimable": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_slab_reclaimable_pages"), + "Number of reclaimable slab pages", + []string{"node", "zone"}, nil), + "NrSlabUnreclaimable": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_slab_unreclaimable_pages"), + "Number of unreclaimable slab pages", + []string{"node", "zone"}, nil), + "NrMlockStack": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_mlock_stack_pages"), + "mlock()ed pages found and moved off LRU", + []string{"node", "zone"}, nil), + "NrKernelStack": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_kernel_stacks"), + "Number of kernel stacks", + []string{"node", "zone"}, nil), + "NrMapped": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_mapped_pages"), + "Number of mapped pages", + []string{"node", "zone"}, nil), + "NrDirty": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_dirty_pages"), + "Number of dirty pages", + []string{"node", "zone"}, nil), + "NrWriteback": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_writeback_pages"), + "Number of writeback pages", + []string{"node", "zone"}, nil), + "NrUnevictable": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_unevictable_pages"), + "Number of unevictable pages", + []string{"node", "zone"}, nil), + "NrShmem": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_shmem_pages"), + "Number of shmem pages (included tmpfs/GEM pages)", + []string{"node", "zone"}, nil), + } + +} +func createCounterMetricDescriptions() map[string]*prometheus.Desc { + return map[string]*prometheus.Desc{ + "NrDirtied": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_dirtied_total"), + "Page dirtyings since bootup", + []string{"node", "zone"}, nil), + "NrWritten": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "nr_written_total"), + "Page writings since bootup", + []string{"node", "zone"}, nil), + "NumaHit": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "numa_hit_total"), + "Allocated in intended node", + []string{"node", "zone"}, nil), + "NumaMiss": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "numa_miss_total"), + "Allocated in non intended node", + []string{"node", "zone"}, nil), + "NumaForeign": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "numa_foreign_total"), + "Was intended here, hit elsewhere", + []string{"node", "zone"}, nil), + "NumaInterleave": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "numa_interleave_total"), + "Interleaver preferred this zone", + []string{"node", "zone"}, nil), + "NumaLocal": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "numa_local_total"), + "Allocation from local node", + []string{"node", "zone"}, nil), + "NumaOther": prometheus.NewDesc( + prometheus.BuildFQName(namespace, zoneinfoSubsystem, "numa_other_total"), + "Allocation from other node", + []string{"node", "zone"}, nil), + } +} diff --git a/end-to-end-test.sh b/end-to-end-test.sh index 24060611..fce59f61 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -44,6 +44,7 @@ enabled_collectors=$(cat << COLLECTORS xfs zfs processes + zoneinfo COLLECTORS ) disabled_collectors=$(cat << COLLECTORS