2012-09-12 10:26:59 +02:00
#!/usr/bin/gawk --exec
2012-09-13 08:03:19 +02:00
#
# 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 <munin@stefanseidel.info>
#
# 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.
# --
2013-06-02 23:12:44 +02:00
#%# family=auto
#%# capabilities=autoconf
2012-09-12 10:26:59 +02:00
BEGIN {
if (ARGC > 1 && ARGV[1] == "config") {
2013-06-02 23:12:44 +02:00
print "graph_args --base 1000 -l 0"
2012-09-12 10:26:59 +02:00
print "graph_title HugePages usage"
print "graph_category system"
print "graph_info This graph shows the usage of the kernel Huge Pages."
2013-06-02 23:12:44 +02:00
print "graph_order Total Rsvd Free Surp"
print "Total.label total"
2012-09-12 10:26:59 +02:00
print "Total.draw AREA"
2013-06-02 23:12:44 +02:00
print "Total.info Size of pool of hugepages ('nr_hugepages')"
2012-09-12 10:26:59 +02:00
print "Rsvd.label reserved"
2013-06-02 23:12:44 +02:00
print "Rsvd.draw AREA"
2012-09-12 10:26:59 +02:00
print "Rsvd.info Huge Pages that have been reserved but are not used."
2013-06-02 23:12:44 +02:00
print "Free.label free"
print "Free.draw STACK"
print "Free.info Unallocated Huge Page Memory."
2012-09-12 10:26:59 +02:00
print "Surp.label surplus"
print "Surp.draw STACK"
2013-06-02 23:12:44 +02:00
print "Surp.info Number of hugepages > nr_hugepages, as decided by nr_overcommit_hugepages or when the amount of Huge Pages is reduced while they are in use."
2012-09-12 10:26:59 +02:00
CONF=1
}
2013-06-02 23:12:44 +02:00
if (ARGC > 1 && ARGV[1] == "autoconf") {
CONF=2
}
2012-09-12 10:26:59 +02:00
ARGV[1] = "/proc/meminfo"
ARGC = 2
FS = "[: ]+"
OFS = ""
IGNORECASE = 1
}
CONF == 1 {
if (/Hugepagesize/) {
2013-06-02 23:12:44 +02:00
print "graph_vlabel Pages (",$2,"KB/page)"
}
}
CONF == 2 {
if (/HugePages_Total/) {
if ($2 > 0) {
print "yes"
} else {
print "no"
}
2012-09-12 10:26:59 +02:00
}
}
2013-06-02 23:12:44 +02:00
(CONF != 1 && CONF != 2) {
2012-09-12 10:26:59 +02:00
if (match($0,"(anon)?hugepages(_([^:]+))?[^i]",mats))
print mats[1],mats[3],".value ",$2
}