Module: check_mk
Branch: master
Commit: dd805e53cc2e7dfda36c3478e780ce5667da54ea
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dd805e53cc2e7d…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Feb 1 11:29:24 2016 +0100
#2942 FIX juniper_cpu_util: new check replaces juniper_cpu which was reporting incorrect
values
The juniper_cpu check was reporting cpu load as utilization. The load readings from the
juniper device can't be used as the number of cpu cores is unknown.
juniper_cpu has been obsoleted, will no longer report data and will disappear upon
re-discovery.
juniper_cpu_util takes its place and reports the actual utilization.
---
.werks/2942 | 14 ++++++++++++
ChangeLog | 2 ++
checkman/juniper_cpu | 6 +++--
checkman/juniper_cpu_util | 11 +++++++++
checks/juniper_cpu | 42 +++++-----------------------------
checks/juniper_cpu_util | 56 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 93 insertions(+), 38 deletions(-)
diff --git a/.werks/2942 b/.werks/2942
new file mode 100644
index 0000000..4ce0eea
--- /dev/null
+++ b/.werks/2942
@@ -0,0 +1,14 @@
+Title: juniper_cpu_util: new check replaces juniper_cpu which was reporting incorrect
values
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i4
+Date: 1454322353
+Class: fix
+
+The juniper_cpu check was reporting cpu load as utilization. The load readings from the
+juniper device can't be used as the number of cpu cores is unknown.
+
+juniper_cpu has been obsoleted, will no longer report data and will disappear upon
+re-discovery.
+juniper_cpu_util takes its place and reports the actual utilization.
diff --git a/ChangeLog b/ChangeLog
index 66b8167..81f2c89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -234,6 +234,8 @@
* 2972 FIX: df: Filesystem trends: Outputting less senseless time left in case of
nearly 0 growth
* 3034 FIX: cups_queues: Fixed bug when no user name available for a print job
* 2940 FIX: dell_om_disks: non-raid state is no longer treated as a critical
problem...
+ * 2942 FIX: juniper_cpu_util: new check replaces juniper_cpu which was reporting
incorrect values...
+ NOTE: Please refer to the migration notes!
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checkman/juniper_cpu b/checkman/juniper_cpu
index 2cf0690..783f1cc 100644
--- a/checkman/juniper_cpu
+++ b/checkman/juniper_cpu
@@ -4,7 +4,9 @@ catalog: hw/network/juniper
license: GPL
distribution: check_mk
description:
- Check CPU utilization of the last 1/5/15 minutes in percent on Juniper devices.
+ This check is obsoleted by juniper_cpu_util!
+ The check was reporting load readings, not utilization! Those load readings
+ aren't actualy usable as the number of cores processing that load isn't known.
perfdata:
util1: The CPU utilization of the last 1 minutes in percent.
@@ -12,7 +14,7 @@ perfdata:
util15: The CPU utilization of the last 15 minutes in percent.
inventory:
- One service for each Routing Engine will be creted
+ Since this check is obsolete, no items are discovered
[parameters]
warning (int): The percentage of CPU utilization that triggers a warning level.
diff --git a/checkman/juniper_cpu_util b/checkman/juniper_cpu_util
new file mode 100644
index 0000000..2176029
--- /dev/null
+++ b/checkman/juniper_cpu_util
@@ -0,0 +1,11 @@
+title: CPU utilization of juniper devices
+agents: snmp
+catalog: hw/network/juniper
+license: GPL
+distribution: check_mk
+description:
+ Check CPU utilizationin percent on Juniper devices.
+ This check replaces the older and broken juniper_cpu check.
+
+inventory:
+ One service for each Routing Engine will be creted
diff --git a/checks/juniper_cpu b/checks/juniper_cpu
index cf05d91..daa1d45 100644
--- a/checks/juniper_cpu
+++ b/checks/juniper_cpu
@@ -27,46 +27,16 @@
juniper_cpu_default_levels = ( 80.0, 90.0 )
def inventory_juniper_cpu(info):
- return [ (x[0], "juniper_cpu_default_levels" ) for x in info if
x[0].startswith("Routing Engine") ]
+ return []
def check_juniper_cpu(item, params, info):
for line in info:
if line[0] == item:
- try:
- util1, util5, util15 = map(int, line[1:])
- except ValueError:
- return 3, "CPU information not provided by device"
-
- warn, crit = params
- label1, label5, label15 = "", "", ""
- state = 0
- if util1 >= crit:
- state = 2
- label1 = "(!!)"
- elif util1 >= warn:
- state = 1
- label1 = "(!)"
- if util5 >= crit:
- state = 2
- label5 = "(!!)"
- elif util5 >= warn:
- state = max(state,1)
- label5 = "(!)"
- if util15 >= crit:
- state = 2
- label15 = "(!!)"
- elif util15 >= warn:
- state = max(state,1)
- label15 = "(!)"
-
- perf = [( "util1", util1, warn, crit ),
- ( "util5", util5, warn, crit ),
- ( "util15", util15, warn, crit )]
-
-
- message = "%d%% 1 min%s, %d%% 5 min%s, %d%% 15 min%s" % \
- ( util1, label1, util5, label5, util15, label15 )
- return state, message, perf
+ # this check was using cpu load readings falsely reporting them
+ # as utilization. Since the device doesn't seem to report the number
+ # of available cpu cores, load monitoring isn't properly doable
+ return 3, "This check is obsolete and has been replaced, " \
+ "please re-discover service on this host"
check_info["juniper_cpu"] = {
"check_function" : check_juniper_cpu,
diff --git a/checks/juniper_cpu_util b/checks/juniper_cpu_util
new file mode 100644
index 0000000..8f43e5e
--- /dev/null
+++ b/checks/juniper_cpu_util
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2016 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.
+
+
+factory_settings['juniper_cpu_util_default_levels'] = {
+ 'levels': (80.0, 90.0)
+}
+
+
+def inventory_juniper_cpu_util(info):
+ for line in info:
+ if line[0].startswith("Routing Engine"):
+ yield line[0], {}
+
+def check_juniper_cpu_util(item, params, info):
+ for name, util in info:
+ if name == item:
+ return check_cpu_util(int(util), params)
+
+
+check_info['juniper_cpu_util'] = {
+ 'check_function' : check_juniper_cpu_util,
+ 'inventory_function' : inventory_juniper_cpu_util,
+ 'service_description' : "CPU utilization %s",
+ '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.2636.1.1.1.2"),
+ 'snmp_info' : (".1.3.6.1.4.1.2636.3.1.13.1",[
+ 5, #jnxOperatingDescr
+ 8, #jnxOperatingCPU
+ ]),
+ 'includes' : "cpu_util.include",
+ 'default_levels_variable' : "juniper_cpu_util_default_levels"
+}