Module: check_mk
Branch: master
Commit: 1ae3f62efd6dcfd04c1f4ae20fc6f78fd725c046
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1ae3f62efd6dcf…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jul 2 16:04:34 2014 +0200
aix_memory: new check for RAM and SWAP on AIX
---
.werks/1041 | 8 +++
ChangeLog | 5 +-
agents/check_mk_agent.aix | 3 +-
checkman/aix_memory | 39 ++++++++++++++
checkman/mem.used | 2 +-
checks/aix_memory | 94 +++++++++++++++++++++++++++++++++
pnp-templates/check_mk-aix_memory.php | 1 +
web/plugins/perfometer/check_mk.py | 1 +
8 files changed, 149 insertions(+), 4 deletions(-)
diff --git a/.werks/1041 b/.werks/1041
new file mode 100644
index 0000000..6cc46cd
--- /dev/null
+++ b/.werks/1041
@@ -0,0 +1,8 @@
+Title: aix_memory: new check for RAM and SWAP on AIX
+Level: 2
+Component: checks
+Version: 1.2.5i5
+Date: 1404309861
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index dfa3ed5..561e058 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,7 +4,7 @@
NOTE: Please refer to the migration notes!
* 1038 Massive speedup of cmk --snmptranslate
* 1035 FIX: Do not fail on errors in *.mk files anymore - except in interactive
mode...
- * 0174 FIX: FIX: Fixed appending of --keepalive-fd parameters to checkhelps...
+ * 0174 FIX: Fixed appending of --keepalive-fd parameters to checkhelpers...
Checks & Agents:
* 0168 f5_bigip_pool: Added Wato configuration...
@@ -12,9 +12,10 @@
* 0169 websphere_mq_channels,ebsphere_mq_queues: New Checks to monitor IBM Websphere
MQ Queues and Channels...
* 1034 Always provide also 64 bit version of Windows agent
* 0170 hp_proliant_power: New check to monitor the Power Meter on Prolaint Servers
and iLO Boards
- * 0997 New checks and an special agent for ALLNET IP Sensoric devices...
* 0172 zfsget: Check is now usable in cluster_mode...
* 1039 aix_diskiod: new check for disk IO on AIX
+ * 0997 New checks and an special agent for ALLNET IP Sensoric devices...
+ * 1041 aix_memory: new check for RAM and SWAP on AIX
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output
of if checks...
diff --git a/agents/check_mk_agent.aix b/agents/check_mk_agent.aix
index 401b858..b6f97ca 100755
--- a/agents/check_mk_agent.aix
+++ b/agents/check_mk_agent.aix
@@ -74,7 +74,8 @@ echo '<<<aix_diskiod>>>'
iostat -d | tr -s ' ' | grep hdisk
echo '<<<aix_memory>>>'
-vmstat -v | tr -s ' ' | cut -d " " -f 2
+vmstat -v | tr -s ' '
+swap -s
echo '<<<mpstat_aix>>>'
mpstat -a | tail -n1
diff --git a/checkman/aix_memory b/checkman/aix_memory
new file mode 100644
index 0000000..6297d00
--- /dev/null
+++ b/checkman/aix_memory
@@ -0,0 +1,39 @@
+title: Usage of physical and virtual RAM
+agents: aix
+catalog: os/kernel
+license: GPL
+distribution: check_mk
+description:
+ This check measures the current usage of physical RAM and
+ virtual memory used by processes on AIX. You can define a warning
+ and critical level for the usage of virtual memory,
+ {not} for the usage of RAM.
+
+ This check uses the same logic as {mem.used} - the memory check
+ for Linux. Please see details there.
+
+inventory:
+ One check is created if a non-empty {<<<aix_memory>>>} section is
+ present in the agent output.
+
+perfdata:
+ Three variables are stored: the physical RAM,
+ the used swap space and the sum of both. Maximum
+ values for both variables are also transmitted, so that
+ they can be visualized. All values are in Megabytes (1024 * 1024 bytes).
+
+ The template for PNP4Nagios that is shipped with Check_MK
+ stacks swap usage on top of RAM usage und thus shows
+ the amount of virtual RAM that is used by processes.
+
+[parameters]
+parameters (dict):
+ {"levels"}: A pair of two int or float values: if these are
+ float it means the the percentage of virtual memory used
+ by processes at which WARNING/CRIT state is triggered. If the
+ two numbers are defined as an integer value then they are interpreted
+ as an absolute value in megabytes.
+
+ {"average"}: This key is optional. If set (integer), it means
+ a number of minutes. The levels are then applied to the
+ averaged value over that time horizon.
diff --git a/checkman/mem.used b/checkman/mem.used
index 9d469fd..0284cc5 100644
--- a/checkman/mem.used
+++ b/checkman/mem.used
@@ -71,7 +71,7 @@ perfdata:
If averaging is turned on, then a value {memusedavg} is added.
[parameters]
-parameters (dict): The check previous used a pair of
+parameters (dict): The check previously used a pair of
two numbers as a parameter. While this is internally still
supported, the new format is a dictionary with the following
keys:
diff --git a/checks/aix_memory b/checks/aix_memory
new file mode 100644
index 0000000..78e8412
--- /dev/null
+++ b/checks/aix_memory
@@ -0,0 +1,94 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA
+
+# Example output from agent:
+# <<<aix_memory>>>
+# 32702464 memory pages
+# 31736528 lruable pages
+# 858141 free pages
+# 4 memory pools
+# 6821312 pinned pages
+# 80.0 maxpin percentage
+# 3.0 minperm percentage
+# 90.0 maxperm percentage
+# 8.8 numperm percentage
+# 2808524 file pages
+# 0.0 compressed percentage
+# 0 compressed pages
+# 8.8 numclient percentage
+# 90.0 maxclient percentage
+# 2808524 client pages
+# 0 remote pageouts scheduled
+# 354 pending disk I/Os blocked with no pbuf
+# 860832 paging space I/Os blocked with no psbuf
+# 2228 filesystem I/Os blocked with no fsbuf
+# 508 client filesystem I/Os blocked with no fsbuf
+# 1372 external pager filesystem I/Os blocked with no fsbuf
+# 88.8 percentage of memory used for computational pages
+# allocated = 8257536 blocks used = 1820821 blocks free = 6436715 blocks
+#
+# The first part is the output of vmstat -v, the last line is the output
+# of swap -s and show the swap space usage
+
+# Parse AIX vmstat output into something compatible with the Linux
+# output from /proc/meminfo. AIX speaks of 4k pages while Linux of kilobytes.
+def parse_aix_memory(info):
+ parsed = {}
+ for line in info:
+ if line[0] == "allocated": # Swap space
+ parsed["SwapTotal"] = int(line[2]) * 4
+ parsed["SwapFree"] = int(line[10]) * 4
+ else:
+ varname = " ".join(line[1:])
+ if varname == "memory pages":
+ parsed["MemTotal"] = int(line[0]) * 4
+ elif varname == "free pages":
+ parsed["MemFree"] = int(line[0]) * 4
+ elif varname == "file pages":
+ parsed["Cached"] = int(line[0]) * 4
+ return parsed
+
+
+def check_aix_memory(_no_item, params, info):
+ meminfo = parse_aix_memory(info)
+ return check_memory(params, meminfo)
+
+
+def inventory_aix_memory(info):
+ meminfo = parse_aix_memory(info)
+ if "MemFree" in meminfo:
+ return [(None, {})]
+
+
+check_info['aix_memory'] = {
+ "check_function" : check_aix_memory,
+ "inventory_function" : inventory_aix_memory,
+ "service_description" : "Memory used",
+ "has_perfdata" : True,
+ "group" : "memory",
+ "default_levels_variable" : "memory_default_levels",
+ "includes" : [ "mem.include" ],
+}
diff --git a/pnp-templates/check_mk-aix_memory.php
b/pnp-templates/check_mk-aix_memory.php
new file mode 120000
index 0000000..0a74994
--- /dev/null
+++ b/pnp-templates/check_mk-aix_memory.php
@@ -0,0 +1 @@
+check_mk-mem.used.php
\ No newline at end of file
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 549eaa2..ce4958c 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -206,6 +206,7 @@ def perfometer_check_mk_mem_used(row, check_command, perf_data):
return "%d%%" % (100 * (virt_used / ram_total)), h
perfometers["check_mk-mem.used"] = perfometer_check_mk_mem_used
+perfometers["check_mk-aix_memory"] = perfometer_check_mk_mem_used
perfometers["check_mk-hr_mem"] = perfometer_check_mk_mem_used
def perfometer_check_mk_mem_win(row, check_command, perf_data):