Module: check_mk
Branch: master
Commit: 746ceacce80a773bd1c2cd39974e21cfe7b8790e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=746ceacce80a77…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Aug 26 12:45:13 2015 +0200
#2422 winperf_mem: new check to monitor memory pages per second
To use this check you need to activate the output of Memory information in
{check_mk.ini}. You can do this by adding {counters = 4:mem} to the section {[winperf]}.
or through the agent bakery rule "Windows Performance-Counter objects".
---
.werks/2422 | 12 +++++
ChangeLog | 1 +
checkman/winperf_mem | 19 +++++++
checks/winperf_mem | 97 ++++++++++++++++++++++++++++++++++
web/plugins/metrics/check_mk.py | 14 +++++
web/plugins/wato/check_parameters.py | 21 ++++++++
6 files changed, 164 insertions(+)
diff --git a/.werks/2422 b/.werks/2422
new file mode 100644
index 0000000..ac6189a
--- /dev/null
+++ b/.werks/2422
@@ -0,0 +1,12 @@
+Title: winperf_mem: new check to monitor memory pages per second
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1440585785
+Class: feature
+
+To use this check you need to activate the output of Memory information in
+{check_mk.ini}. You can do this by adding {counters = 4:mem} to the section {[winperf]}.
+or through the agent bakery rule "Windows Performance-Counter objects".
+
diff --git a/ChangeLog b/ChangeLog
index 1eaa80a..aa38f76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -62,6 +62,7 @@
* 2521 new check juniper_trpz_aps_sessions: shows the radio data and sessions per
online access point...
* 2511 siemens_plc: Special agent can now be configured to fetch other memory areas
than DB...
* 2421 winperf_phydisk: now able to monitor the average read/write duration for each
disk...
+ * 2422 winperf_mem: new check to monitor memory pages per second...
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checkman/winperf_mem b/checkman/winperf_mem
new file mode 100644
index 0000000..f695aca
--- /dev/null
+++ b/checkman/winperf_mem
@@ -0,0 +1,19 @@
+title: Windows memory statistics
+agents: windows
+catalog: os/networking
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the number of memory pages per second.
+ To use this check you need to activate the output of Memory information in
+ {check_mk.ini}. You can do this by adding {counters = 4:mem} to the section
{[winperf]}.
+ This {check_mk.ini} configuration can also be done via WATO in the agent bakery rules.
+ You can configure levels for the number of pages per second.
+
+perfdata:
+ The number of pages per second
+
+inventory:
+ If the windows agents has the section {<<<winperf_mem>>>}, then one
check
+ will be created
+
diff --git a/checks/winperf_mem b/checks/winperf_mem
new file mode 100644
index 0000000..680f424
--- /dev/null
+++ b/checks/winperf_mem
@@ -0,0 +1,97 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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:
+# <<<winperf_mem>>>
+# 1440580801.44 4 3579545
+# 24 5203433 counter
+# 20 643575808 large_rawcount
+# 22 291414016 large_rawcount
+# 26 6212497408 large_rawcount
+# 28 17614 counter
+# 30 1012830 counter
+# 32 3988745 counter
+# 34 456907 counter
+# 36 2011463 counter -----> Pages Counter
+# 818 2007095 counter
+# 38 141612 counter
+# 44 4368 counter
+# 52 35241984 large_rawcount
+# 54 6586368 large_rawcount
+# 46 273 counter
+# 56 41033 rawcount
+# 60 33522 rawcount
+# 674 3545 rawcount
+# 814 114274304 large_rawcount
+# 816 155688960 large_rawcount
+# 62 35016704 large_rawcount
+# 64 1003520 large_rawcount
+# 66 131072 large_rawcount
+# 68 2777088 large_rawcount
+# 70 1777664 large_rawcount
+# 72 77348864 large_rawcount
+# 1402 71146 raw_fraction
+# 1402 1516723 raw_base
+# 1376 628492 large_rawcount
+# 1378 613 large_rawcount
+
+
+def inventory_winperf_mem(info):
+ if len(info) > 1:
+ return [ (None, {}) ]
+
+def check_winperf_mem(_unused, params, info):
+ init_line = info[0]
+ this_time = float(init_line[0])
+
+ lines = iter(info)
+ try:
+ while True:
+ line = lines.next()
+ if line[0] == "36":
+ page_counter = int(line[1])
+ break
+ except StopIteration:
+ pass
+
+ pages_per_sec = get_rate(None, this_time, page_counter)
+ state = 0
+ if "pages_per_second" in params:
+ warn, crit = params["pages_per_second"]
+ if pages_per_sec >= crit:
+ state = 2
+ elif pages_per_sec >= warn:
+ state = 1
+
+ yield state, "Pages/s: %d" % pages_per_sec, [("mem_pages_rate",
pages_per_sec)]
+
+check_info["winperf_mem"] = {
+ 'check_function': check_winperf_mem,
+ 'inventory_function': inventory_winperf_mem,
+ 'service_description': 'Memory Pages',
+ 'group': 'mem_pages',
+ 'has_perfdata': True
+}
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 1a01079..4931c0f 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -446,6 +446,12 @@ metric_info["caches"] = {
"color" : "51/a",
}
+metric_info["mem_pages_rate"] = {
+ "title" : _("Memory Pages"),
+ "unit" : "1/s",
+ "color": "34/a",
+}
+
metric_info["mem_lnx_cached"] = {
"title" : _("File contents"),
"color": "#91cceb",
@@ -4151,6 +4157,13 @@ perfometer_info.append({
"exponent" : 2,
})
+perfometer_info.append({
+ "type" : "logarithmic",
+ "metric" : "mem_pages_rate",
+ "half_value" : 5000,
+ "exponent" : 2,
+})
+
#.
# .--Graphs--------------------------------------------------------------.
# | ____ _ |
@@ -4328,6 +4341,7 @@ graph_info.append({
],
})
+
graph_info.append({
"title" : _("Cache hit ratio"),
"metrics" : [
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 580202c..a4342e9 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3357,6 +3357,27 @@ register_check_parameters(
register_check_parameters(
subgroup_os,
+ "mem_pages",
+ _("Memory Pages Statistics"),
+ Dictionary(
+ elements = [
+ ("pages_per_second",
+ Tuple(
+ title = _("Pages per second"),
+ elements = [
+ Integer(title = _("Warning at"), unit =
_("pages/s") ),
+ Integer(title = _("Critical at"), unit =
_("pages/s") ),
+ ]
+ ),
+ )
+ ]
+ ),
+ None,
+ "dict"
+)
+
+register_check_parameters(
+ subgroup_os,
"statgrab_mem",
_("Statgrab Memory Usage"),
Alternative(