root / plugins / system / hugepages @ 81e9ffca
Historique | Voir | Annoter | Télécharger (2,69 ko)
| 1 |
#!/usr/bin/gawk --exec |
|---|---|
| 2 |
# |
| 3 |
# HugePages monitoring plugin for munin |
| 4 |
# |
| 5 |
# This plugin monitors the usage of the Linux kernel HugePages, on some |
| 6 |
# architectures also called Large Pages. It will show both pre-reserved |
| 7 |
# pages (via /prc/sys/vm/nr_hugepages), their usage and reserved size, as |
| 8 |
# well as HugePages allocated by the khugepaged (activated by the |
| 9 |
# transparent_hugepages kernel command line parameter). All values are |
| 10 |
# shown in (KiBi/MeBi/GiBi)Bytes. |
| 11 |
# |
| 12 |
# This plugin is used like many other munin plugins: put it in |
| 13 |
# /usr/share/munin/plugins (or another appropriate location) |
| 14 |
# and create a symlink in /etc/munin/plugins: |
| 15 |
# > ln -s /usr/share/munin/plugins/hugepages /etc/munin/plugins |
| 16 |
# Then restart munin-node. |
| 17 |
# |
| 18 |
# |
| 19 |
# -- |
| 20 |
# Copyright 2012 Stefan Seidel <munin@stefanseidel.info> |
| 21 |
# |
| 22 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 23 |
# you may not use this file except in compliance with the License. |
| 24 |
# You may obtain a copy of the License at |
| 25 |
# |
| 26 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 27 |
# |
| 28 |
# Unless required by applicable law or agreed to in writing, software |
| 29 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 30 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 31 |
# See the License for the specific language governing permissions and |
| 32 |
# limitations under the License. |
| 33 |
# -- |
| 34 |
|
| 35 |
|
| 36 |
#%# family=auto |
| 37 |
#%# capabilities=autoconf |
| 38 |
|
| 39 |
BEGIN {
|
| 40 |
if (ARGC > 1 && ARGV[1] == "config") {
|
| 41 |
print "graph_args --base 1000 -l 0" |
| 42 |
print "graph_title HugePages usage" |
| 43 |
print "graph_category system" |
| 44 |
print "graph_info This graph shows the usage of the kernel Huge Pages." |
| 45 |
print "graph_order Total Rsvd Free Surp" |
| 46 |
print "Total.label total" |
| 47 |
print "Total.draw AREA" |
| 48 |
print "Total.info Size of pool of hugepages ('nr_hugepages')"
|
| 49 |
print "Rsvd.label reserved" |
| 50 |
print "Rsvd.draw AREA" |
| 51 |
print "Rsvd.info Huge Pages that have been reserved but are not used." |
| 52 |
print "Free.label free" |
| 53 |
print "Free.draw STACK" |
| 54 |
print "Free.info Unallocated Huge Page Memory." |
| 55 |
print "Surp.label surplus" |
| 56 |
print "Surp.draw STACK" |
| 57 |
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." |
| 58 |
CONF=1 |
| 59 |
} |
| 60 |
if (ARGC > 1 && ARGV[1] == "autoconf") {
|
| 61 |
CONF=2 |
| 62 |
} |
| 63 |
ARGV[1] = "/proc/meminfo" |
| 64 |
ARGC = 2 |
| 65 |
FS = "[: ]+" |
| 66 |
OFS = "" |
| 67 |
IGNORECASE = 1 |
| 68 |
} |
| 69 |
|
| 70 |
CONF == 1 {
|
| 71 |
if (/Hugepagesize/) {
|
| 72 |
print "graph_vlabel Pages (",$2,"KB/page)"
|
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
CONF == 2 {
|
| 77 |
if (/HugePages_Total/) {
|
| 78 |
if ($2 > 0) {
|
| 79 |
print "yes" |
| 80 |
} else {
|
| 81 |
print "no" |
| 82 |
} |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
(CONF != 1 && CONF != 2) {
|
| 87 |
if (match($0,"(anon)?hugepages(_([^:]+))?[^i]",mats)) |
| 88 |
print mats[1],mats[3],".value ",$2 |
| 89 |
} |
