Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / system / hugepages @ d0216f00

Historique | Voir | Annoter | Télécharger (2,89 ko)

1 f9000cdc Stefan Seidel
#!/usr/bin/gawk --exec
2 5be6eb72 Stefan Seidel
#
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 4a7a0de1 Kenyon Ralph
35
36
#%# family=auto
37
#%# capabilities=autoconf
38
39 f9000cdc Stefan Seidel
BEGIN {
40
  if (ARGC > 1 && ARGV[1] == "config") {
41 4a7a0de1 Kenyon Ralph
    print "graph_args --base 1000 -l 0"
42 f9000cdc Stefan Seidel
    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 5d778955 Tomas Zvala
    print "graph_order Total Rsvd Free Surp Anon"
46 4a7a0de1 Kenyon Ralph
    print "Total.label total"
47 f9000cdc Stefan Seidel
    print "Total.draw AREA"
48 4a7a0de1 Kenyon Ralph
    print "Total.info Size of pool of hugepages ('nr_hugepages')"
49 f9000cdc Stefan Seidel
    print "Rsvd.label reserved"
50 4a7a0de1 Kenyon Ralph
    print "Rsvd.draw AREA"
51 f9000cdc Stefan Seidel
    print "Rsvd.info Huge Pages that have been reserved but are not used."
52 4a7a0de1 Kenyon Ralph
    print "Free.label free"
53
    print "Free.draw STACK"
54
    print "Free.info Unallocated Huge Page Memory."
55 f9000cdc Stefan Seidel
    print "Surp.label surplus"
56
    print "Surp.draw STACK"
57 4a7a0de1 Kenyon Ralph
    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 5d778955 Tomas Zvala
    print "Anon.label Transparent"
59
    print "Anon.draw STACK"
60
    print "Anon.info Huge Pages that are in use by the transparent Huge Page allocator khugepaged."
61 f9000cdc Stefan Seidel
    CONF=1
62
  }
63 4a7a0de1 Kenyon Ralph
  if (ARGC > 1 && ARGV[1] == "autoconf") {
64
    CONF=2
65
  }
66 f9000cdc Stefan Seidel
  ARGV[1] = "/proc/meminfo"
67
  ARGC = 2
68
  FS = "[: ]+"
69
  OFS = ""
70
  IGNORECASE = 1
71
}
72
73
CONF == 1 {
74
  if (/Hugepagesize/) {
75 5d778955 Tomas Zvala
    print "Anon.cdef Anon,",$2,",/"
76 4a7a0de1 Kenyon Ralph
    print "graph_vlabel Pages (",$2,"KB/page)"
77
  }
78
}
79
80
CONF == 2 {
81
  if (/HugePages_Total/) {
82
    if ($2 > 0) {
83
      print "yes"
84
    } else {
85
      print "no"
86
    }
87 f9000cdc Stefan Seidel
  }
88
}
89
90 4a7a0de1 Kenyon Ralph
(CONF != 1 && CONF != 2) {
91 f9000cdc Stefan Seidel
  if (match($0,"(anon)?hugepages(_([^:]+))?[^i]",mats))
92
    print mats[1],mats[3],".value ",$2
93
}