2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 # Example output from agent:
29 # 32702464 memory pages
30 # 31736528 lruable pages
33 # 6821312 pinned pages
34 # 80.0 maxpin percentage
35 # 3.0 minperm percentage
36 # 90.0 maxperm percentage
37 # 8.8 numperm percentage
39 # 0.0 compressed percentage
41 # 8.8 numclient percentage
42 # 90.0 maxclient percentage
43 # 2808524 client pages
44 # 0 remote pageouts scheduled
45 # 354 pending disk I/Os blocked with no pbuf
46 # 860832 paging space I/Os blocked with no psbuf
47 # 2228 filesystem I/Os blocked with no fsbuf
48 # 508 client filesystem I/Os blocked with no fsbuf
49 # 1372 external pager filesystem I/Os blocked with no fsbuf
50 # 88.8 percentage of memory used for computational pages
51 # allocated = 8257536 blocks used = 1820821 blocks free = 6436715 blocks
53 # The first part is the output of vmstat -v, the last line is the output
54 # of swap -s and show the swap space usage
57 # Parse AIX vmstat output into something compatible with the Linux
58 # output from /proc/meminfo. AIX speaks of 4k pages while Linux of kilobytes.
59 def parse_aix_memory(info
):
61 # In case that the system dont have swap configured
62 parsed
["SwapTotal"] = 0
63 parsed
["SwapFree"] = 0
65 if line
[0] == "allocated": # Swap space
66 parsed
["SwapTotal"] = int(line
[2]) * 4
67 parsed
["SwapFree"] = int(line
[10]) * 4
69 varname
= " ".join(line
[1:])
70 if varname
== "memory pages":
71 parsed
["MemTotal"] = int(line
[0]) * 4
72 elif varname
== "free pages":
73 parsed
["MemFree"] = int(line
[0]) * 4
74 elif varname
== "file pages":
75 parsed
["Cached"] = int(line
[0]) * 4
79 def check_aix_memory(_no_item
, params
, info
):
80 meminfo
= parse_aix_memory(info
)
81 return check_memory(params
, meminfo
)
84 def inventory_aix_memory(info
):
85 meminfo
= parse_aix_memory(info
)
86 if "MemFree" in meminfo
:
90 check_info
['aix_memory'] = {
91 "check_function": check_aix_memory
,
92 "inventory_function": inventory_aix_memory
,
93 "service_description": "Memory used",
96 "default_levels_variable": "memory_default_levels",
97 "includes": ["mem.include"],