From f9000cdc7a400519b128f8efc80ff765812658c7 Mon Sep 17 00:00:00 2001 From: Stefan Seidel Date: Wed, 12 Sep 2012 10:26:59 +0200 Subject: [PATCH 1/2] new plugin to monitor HugePages (or Large Pages) usage under Linux --- plugins/system/hugepages | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 plugins/system/hugepages diff --git a/plugins/system/hugepages b/plugins/system/hugepages new file mode 100755 index 00000000..de4fab6b --- /dev/null +++ b/plugins/system/hugepages @@ -0,0 +1,47 @@ +#!/usr/bin/gawk --exec +BEGIN { + if (ARGC > 1 && ARGV[1] == "config") { + print "graph_args --base 1024 -l 0" + print "graph_vlabel Bytes" + print "graph_title HugePages usage" + print "graph_category system" + print "graph_info This graph shows the usage of the kernel Huge Pages." + print "graph_order Total Rsvd Free Surp Anon" + print "Total.label used" + print "Total.draw AREA" + print "Total.info In-use Huge Page Memory" + print "Free.label free" + print "Free.draw STACK" + print "Free.info Unused Huge Page Memory." + print "Rsvd.label reserved" + print "Rsvd.draw STACK" + print "Rsvd.info Huge Pages that have been reserved but are not used." + print "Surp.label surplus" + print "Surp.draw STACK" + print "Surp.info Huge Pages that are in excess of the reserved amount, usually only greater than zero when the amount of Huge Pages is reduced while they are in use." + print "Anon.label anonymous" + print "Anon.draw STACK" + print "Anon.info Huge Pages that are in use by the transparent Huge Page allocator khugepaged." + CONF=1 + } + ARGV[1] = "/proc/meminfo" + ARGC = 2 + FS = "[: ]+" + OFS = "" + IGNORECASE = 1 +} + +CONF == 1 { + if (/Hugepagesize/) { + print "Total.cdef Total,Free,-,1024,",$2,",*,*" + print "Free.cdef Free,1024,",$2,",*,*,Rsvd,-" + print "Rsvd.cdef Rsvd,1024,",$2,",*,*" + print "Surp.cdef Surp,1024,",$2,",*,*" + print "Anon.cdef Anon,1024,*" + } +} + +(CONF != 1) { + if (match($0,"(anon)?hugepages(_([^:]+))?[^i]",mats)) + print mats[1],mats[3],".value ",$2 +} From 5be6eb7253a8e33d39863837a4969062371b83ff Mon Sep 17 00:00:00 2001 From: Stefan Seidel Date: Thu, 13 Sep 2012 08:03:19 +0200 Subject: [PATCH 2/2] add basic information and license header --- plugins/system/hugepages | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/plugins/system/hugepages b/plugins/system/hugepages index de4fab6b..2b3eed4f 100755 --- a/plugins/system/hugepages +++ b/plugins/system/hugepages @@ -1,4 +1,37 @@ #!/usr/bin/gawk --exec +# +# HugePages monitoring plugin for munin +# +# This plugin monitors the usage of the Linux kernel HugePages, on some +# architectures also called Large Pages. It will show both pre-reserved +# pages (via /prc/sys/vm/nr_hugepages), their usage and reserved size, as +# well as HugePages allocated by the khugepaged (activated by the +# transparent_hugepages kernel command line parameter). All values are +# shown in (KiBi/MeBi/GiBi)Bytes. +# +# This plugin is used like many other munin plugins: put it in +# /usr/share/munin/plugins (or another appropriate location) +# and create a symlink in /etc/munin/plugins: +# > ln -s /usr/share/munin/plugins/hugepages /etc/munin/plugins +# Then restart munin-node. +# +# +# -- +# Copyright 2012 Stefan Seidel +# +# 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. +# -- +# BEGIN { if (ARGC > 1 && ARGV[1] == "config") { print "graph_args --base 1024 -l 0"