Module: check_mk
Branch: master
Commit: fb3b2c2575a33c6217f0fa03195aa67689105302
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb3b2c2575a33c…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Mar 26 15:55:06 2014 +0100
juniper_trpz_mem: New check to monitor memory usage on juniper switches
---
.werks/772 | 8 +++++
ChangeLog | 1 +
checkman/juniper_trpz_mem | 18 +++++++++++
checks/juniper_trpz_mem | 60 ++++++++++++++++++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 1 +
5 files changed, 88 insertions(+)
diff --git a/.werks/772 b/.werks/772
new file mode 100644
index 0000000..70de81a
--- /dev/null
+++ b/.werks/772
@@ -0,0 +1,8 @@
+Title: juniper_trpz_mem: New check to monitor memory usage on juniper switches
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1395845671
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index c7e0714..565fc35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -134,6 +134,7 @@
* 0769 juniper_trpz_cpu_util, juniper_trpz_flash, juniper_trpz_info,
juniper_trpz_power: new Checks for juniper trapeze switches
* 0770 innovaphone_licenses: New check to monitor licenses on innovaphone
devices"
* 0771 juniper_trpz_aps: Show the number of connected access points on juniper wlan
controllers
+ * 0772 juniper_trpz_mem: New check to monitor memory usage on juniper switches
* 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/juniper_trpz_mem b/checkman/juniper_trpz_mem
new file mode 100644
index 0000000..0c61a50
--- /dev/null
+++ b/checkman/juniper_trpz_mem
@@ -0,0 +1,18 @@
+title: Juniper/Trapeze: Memory Usage
+agents: snmp
+catalog: hw/network/juniper
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the current usage of the internal memory.
+
+inventory:
+ One service will be created
+
+perfdata:
+ usage: The current usage in Byte
+
+[parameters]
+warning (int): The percentage of memory usage that triggers a warning level.
+critical (int): The percentage of memory usage that triggers a critical level.
+
diff --git a/checks/juniper_trpz_mem b/checks/juniper_trpz_mem
new file mode 100644
index 0000000..3773b02
--- /dev/null
+++ b/checks/juniper_trpz_mem
@@ -0,0 +1,60 @@
+#!/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.
+
+juniper_trpz_mem_default_levels = ( 80.0, 90.0 )
+
+def inventory_juniper_trpz_mem(info):
+ return [ ( None, "juniper_trpz_mem_default_levels" ) ]
+
+def check_juniper_trpz_mem(_no_item, params, info):
+ usage, mem_size = map( savefloat, info[0] )
+ usage_perc = (usage / mem_size) * 100
+
+ warn, crit = params
+ warn_a = (mem_size / 100) * warn
+ crit_a = (mem_size / 100) * crit
+ perf = [( "usage", usage*1024, warn_a*1024, crit_a*1024, 0, mem_size )]
+ message = "Used: %s/%s (%.0f%%)" % \
+ ( get_bytes_human_readable(usage*1024), get_bytes_human_readable(mem_size*1024),
usage_perc )
+ levels = " ( Warning/Critical at %0.f%%/%.0f%%)" % ( warn, crit )
+ if usage_perc >= crit:
+ return 2, message + levels, perf
+ elif usage_perc >= warn:
+ return 1, message + levels, perf
+ return 0, message, perf
+
+check_info["juniper_trpz_mem"] = {
+ 'check_function': check_juniper_trpz_mem,
+ 'inventory_function': inventory_juniper_trpz_mem,
+ 'service_description': 'Memory used',
+ 'has_perfdata': True,
+ "snmp_scan_function": lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.14525.3.1.6"),
+ # see:
http://www.observium.org/svn/observer/trunk/mibs/trapeze/trpz-system-mib.my
+ "snmp_info": (".1.3.6.1.4.1.14525.4.8.1.1", [
+ "12.1", #
trpzSysCpuMemoryInstantUsage
+ "6", #
trpzSysCpuMemorySize
+ ])
+}
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 5fcb5e0..8e8468b 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -174,6 +174,7 @@ def perfometer_check_mk_mem_win(row, check_command, perf_data):
return "%d%%" % perc, perfometer_linear(perc, color)
perfometers["check_mk-mem.win"] = perfometer_check_mk_mem_win
+perfometers["check_mk-juniper_trpz_mem"] = perfometer_check_mk_mem_win
def perfometer_check_mk_cpu_threads(row, check_command, perf_data):
color = { 0: "#a4f", 1: "#ff2", 2: "#f22", 3:
"#fa2" }[row["service_state"]]