Module: check_mk
Branch: master
Commit: f1d759c24c669c3111dfba9d2e662587e8d2898a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f1d759c24c669c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 17 09:28:06 2014 +0100
mem.used: Add information about shared memory (on Linux hosts)
---
.werks/450 | 8 ++++++++
ChangeLog | 1 +
checkman/mem.used | 13 +++----------
checks/mem.include | 15 +++++++--------
pnp-templates/check_mk-mem.used.php | 8 ++++++++
5 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/.werks/450 b/.werks/450
new file mode 100644
index 0000000..ca8cc1e
--- /dev/null
+++ b/.werks/450
@@ -0,0 +1,8 @@
+Title: mem.used: Add information about shared memory (on Linux hosts)
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1389947271
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 895103a..e8ec71a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,7 @@
* 0568 f5_big_ip_conns: check now supports predictive monitoring and both connections
types are merged in one check
* 0257 windows_agent: now reports extended process information (obsoletes psperf.bat
plugin)...
* 0457 hitachi_hnas_volume: New check for Usage and Status of Volumes in Hitachi HNAS
storage systems
+ * 0450 mem.used: Add information about shared memory (on Linux hosts)
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/mem.used b/checkman/mem.used
index 0852218..c9eeeb0 100644
--- a/checkman/mem.used
+++ b/checkman/mem.used
@@ -64,8 +64,9 @@ perfdata:
stacks swap usage on top of RAM usage und thus shows
the amount of virtual RAM that is used by processes.
- If {mem_extended_perfdata} is set to {True}, then
- additional performance data is output (see below).
+ On Linux some additional performance values are output,
+ for example the size of the page tables and the shared
+ memory.
If averaging is turned on, then a value {memusedavg} is added.
@@ -88,11 +89,3 @@ parameters (dict): The check previous used a pair of
[configuration]
memused_default_levels (float, float): Levels used by
all checks that are created by inventory.
-
-mem_extended_perfdata (boolean): If this variable is set
- to {True}, then the checks outputs additional performance
- data, if the agent provides that information. On Linux
- the amount of mapped and committed memory is output
- (see {Mapped} and {Committed_AS} in {/proc/meminfo}) and
- also the size used for page tables {Pagetables}.
-
diff --git a/checks/mem.include b/checks/mem.include
index 3234dcb..d8e4d9e 100644
--- a/checks/mem.include
+++ b/checks/mem.include
@@ -109,18 +109,17 @@ def check_memory(params, meminfo):
# Add additional metrics, provided by Linux.
mapped = meminfo.get('Mapped')
if mapped:
- mapped_mb = int(mapped) / 1024
- committed_as = meminfo.get('Committed_AS')
- if committed_as:
- committed_as_mb = int(committed_as) / 1024
- else:
- committed_as = 0
+ mapped_mb = int(mapped) / 1024
+ committed_as_mb = int(meminfo.get('Committed_AS', 0)) / 1024
+ shared_mb = int(meminfo.get('Shmem', 0)) / 1024
+
perfdata += [
('mapped', str(mapped_mb) + 'MB'),
('committed_as', str(committed_as_mb) + 'MB'),
('pagetables', str(pagetables_mb) + 'MB'),
+ ('shared', str(shared_mb) + 'MB'),
]
- infotext += ", %.1f mapped, %.1f committed" % \
- (mapped_mb / 1024.0, committed_as_mb / 1024.0)
+ infotext += ", %.1f mapped, %.1f committed, %.1f shared" % \
+ (mapped_mb / 1024.0, committed_as_mb / 1024.0, shared_mb / 1024.0)
return state, infotext, perfdata
diff --git a/pnp-templates/check_mk-mem.used.php b/pnp-templates/check_mk-mem.used.php
index 394a45f..9098382 100644
--- a/pnp-templates/check_mk-mem.used.php
+++ b/pnp-templates/check_mk-mem.used.php
@@ -106,4 +106,12 @@ if (isset($RRD['committed_as'])) {
. "GPRINT:committed:MAX:\"%6.0lf MB max\\n\" " ;
}
+/* Shared memory is part of RAM. So simply overlay it */
+if (isset($RRD['shared'])) {
+ $def[1] .= "DEF:shared=$RRD[shared] "
+ . "AREA:shared#44ccff:\"Shared Memory \" "
+ . "GPRINT:shared:LAST:\"%6.0lf MB last\" "
+ . "GPRINT:shared:AVERAGE:\"%6.0lf MB avg\" "
+ . "GPRINT:shared:MAX:\"%6.0lf MB max\\n\" " ;
+}
?>