Module: check_mk
Branch: master
Commit: 292208dfb7c4e58838ce5b1e296b7d1946098e26
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=292208dfb7c4e5…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Nov 27 16:38:05 2013 +0100
juniper_cpu: New check for CPU utilization on Juniper switches
---
.werks/100 | 8 ++++
ChangeLog | 32 +-------------
checkman/juniper_cpu | 23 ++++++++++
checks/check_http | 2 +
checks/juniper_cpu | 85 ++++++++++++++++++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 1 +
6 files changed, 121 insertions(+), 30 deletions(-)
diff --git a/.werks/100 b/.werks/100
new file mode 100644
index 0000000..fd54f80
--- /dev/null
+++ b/.werks/100
@@ -0,0 +1,8 @@
+Title: juniper_cpu: New check for CPU utilization on Juniper switches
+Level: 1
+Component: checks
+Version: 1.2.3i7
+Date: 1385566659
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 62a453c..7a34945 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,9 +20,10 @@
* 0214 Logwatch: context lines can now be disabled using nocontext=1...
* 0038 casa_cpu_mem casa_cpu_temp casa_cpu_util casa_fan casa_power: New checks for
casa Cable Modem Termination Systems...
* 0097 arc_raid_status: New check for Areca RAID controllers
+ * 0070 cmciii_lcp_airin cmciii_lcp_airout cmciii_lcp_fans cmciii_lcp_waterflow
cmciii_lcp_waterin cmciii_lcp_waterout: new checks for the Rittal CMC-III LCP device
* 0098 apc_inrow_airflow, apc_inrow_fanspeed, apc_inrow_temp: New checks for APC
inrow devices
* 0099 apc_mod_pdu_modules: New check for APC Modular Power Distribution Unit
- * 0070 cmciii_lcp_airin cmciii_lcp_airout cmciii_lcp_fans cmciii_lcp_waterflow
cmciii_lcp_waterin cmciii_lcp_waterout: new checks for the Rittal CMC-III LCP device
+ * 0100 juniper_cpu: New check for CPU utilization on Juniper switches
* 0024 FIX: cisco_wlc: removed check configuration parameter ap_model...
* 0065 FIX: veeam_client: check behaviour improved when backup is in progress
* 0066 FIX: veeam_jobs: check behaviour improved when backup is in progress
@@ -92,35 +93,6 @@
* 0233 FIX: Fixed missing entries in log file and availability view...
- * 0235 table headers are now omitted if all fields are empty and no table action is
set
- * 0048 FIX: Fixed locking issue on host diagnose page
- * 0048 FIX: Tests on host diagnose page are executed parallel now...
- * 0033 FIX: Fixed problem when saving settings in WATOs host diagnostic page...
- * 0205 FIX: NagVis related permissions of roles can be edited again...
- * 0207 FIX: Explicit communities were not saved in all cases...
- * 0094 FIX: Hide SNMPv3 credentials in WATO...
- * 0212 FIX: Fixed broken site edit page in case a TCP socket has been configured...
- * 0095 FIX: Fixed problem with portnumber in Wato Distributed Monitoring dialog
- * 0213 FIX: LDAP: Various small improvements for handling the LDAP user connector...
- * 0039 FIX: Fixed exception on displaying WATO helptexts in the global settings...
- * 0219 FIX: Fixed display problems in WATO folders with long contact group names
- * 0220 FIX: Added HTML escaping to several global settings attributes...
- * 0234 FIX: Improved handling of interface inventory states / types...
-
- Notifications:
- * 0005 Added notification script for sending SMS via
mobilant.com...
- * 0032 FIX: Fixed problem when forwarding notification mails in windows...
- * 0218 FIX: Fixed rendering of HTML mails for Outlook (at least 2013)...
-
- Reporting & Availability:
- * 0051 Option for showing timeline directly in availability table...
- * 0052 Visual colorization of availability according to levels...
- * 0054 New labelling options for availability table...
- * 0055 Allow grouping by host, host group or service group...
- * 0056 New concept of service periods in availability reporting...
- * 0002 You can now annotate events in the availability reporting...
-
- Event Console:
<<<<<<< HEAD
* 0026 FIX: snmptd_mkevent.py: fixed crash on startup
* 0036 FIX: fixed bug in multisite command execution...
diff --git a/checkman/juniper_cpu b/checkman/juniper_cpu
new file mode 100644
index 0000000..a81fe8d
--- /dev/null
+++ b/checkman/juniper_cpu
@@ -0,0 +1,23 @@
+title: CPU utilization of the last 1/5/15 minutes
+agents: snmp
+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.
+
+perfdata:
+ util1: The CPU utilization of the last 1 minutes in percent.
+ util5: The CPU utilization of the last 5 minutes in percent.
+ util15: The CPU utilization of the last 15 minutes in percent.
+
+inventory:
+ One service for each Routing Engine will be creted
+
+[parameters]
+warning (int): The percentage of CPU utilization that triggers a warning level.
+critical (int): The percentage of CPU utilization that triggers a critical level.
+
+[configuration]
+juniper_cpu_default_levels (int, int): Default levels for waring and critical used
+ by inventorized checks. This is preset to {(80.0, 90.0)}
diff --git a/checks/check_http b/checks/check_http
index 7e8b422..bdbce5f 100644
--- a/checks/check_http
+++ b/checks/check_http
@@ -125,6 +125,8 @@ def check_http_arguments(params):
def check_http_desc(params):
if params[0].startswith("^"):
return params[0][1:]
+ if params[1].get("ssl"):
+ return "HTTPS %s" % params[0]
return "HTTP %s" % params[0]
active_check_info['http'] = {
diff --git a/checks/juniper_cpu b/checks/juniper_cpu
new file mode 100644
index 0000000..a389081
--- /dev/null
+++ b/checks/juniper_cpu
@@ -0,0 +1,85 @@
+#!/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_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") ]
+
+def check_juniper_cpu(item, params, info):
+ for line in info:
+ if line[0] == item:
+ util1, util5, util15 = map(int,line[1:])
+ 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%% 1min%s, %d%% 5min%s, %d%% 15min%s" % \
+ ( util1, label1, util5, label5, util15, label15 )
+ return state, message, perf
+ return 3, "Information not found in output"
+
+check_info["juniper_cpu"] = {
+ "check_function" : check_juniper_cpu,
+ "inventory_function" : inventory_juniper_cpu,
+ "service_description" : "CPU utilization %s",
+ "group" : "cpu_utilization",
+ "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
+ 20,
#jnxOperating1MinLoadAvg
+ 21,
#jnxOperating5MinLoadAvg
+ 22,
#jnxOperating15MinLoadAvg
+ ])
+
+
+}
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index d233e53..d6e482f 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -408,6 +408,7 @@ perfometers["check_mk-h3c_lanswitch_cpu"] =
perfometer_cpu_utilization
perfometers["check_mk-winperf_processor.util"] = perfometer_cpu_utilization
perfometers["check_mk-netapp_cpu"] = perfometer_cpu_utilization
perfometers["check_mk-cisco_cpu"] = perfometer_cpu_utilization
+perfometers["check_mk-juniper_cpu"] = perfometer_cpu_utilization
def perfometer_ps_perf(row, check_command, perf_data):
perf_dict = dict([(p[0], float(p[1])) for p in perf_data])