commit
1729558e11
@ -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) |
@ -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), |
||||
} |
||||
} |
Loading…
Reference in new issue