Module: check_mk
Branch: master
Commit: b8e739661f90c143e8f702951aadbf7e6101eb2c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b8e739661f90c1…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Sep 2 16:23:47 2014 +0200
#1393 FIX casa_cpu_temp, casa_cpu_util: Change service description to standard
The service description of these two checks has been changed to be compliant
with Check_MK standard. This is an incompatible change because you will
loose the connection to your previous performance data and alert history.
---
.werks/1393 | 11 +++++++++++
ChangeLog | 2 ++
checks/casa_cpu_temp | 9 ++++++---
checks/casa_cpu_util | 23 +++++++++++++----------
web/plugins/perfometer/check_mk.py | 6 ++++--
5 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/.werks/1393 b/.werks/1393
new file mode 100644
index 0000000..5606f52
--- /dev/null
+++ b/.werks/1393
@@ -0,0 +1,11 @@
+Title: casa_cpu_temp, casa_cpu_util: Change service description to standard
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.5i6
+Date: 1409667738
+Class: fix
+
+The service description of these two checks has been changed to be compliant
+with Check_MK standard. This is an incompatible change because you will
+loose the connection to your previous performance data and alert history.
diff --git a/ChangeLog b/ChangeLog
index 5220e10..3ac4fee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,8 @@
* 1102 FIX: esx_vsphere_counters: no longer raise false alarms because of invalid
data from ESX Host...
* 1149 FIX: check_mk-ibm_svc_systemstats.diskio, check_mk-ibm_svc_systemstats.iops:
fix exception in Perf-O-Meter
* 0651 FIX: f5_bigip_interfaces: indentation error and oid to determine the interface
state fixed...
+ * 1393 FIX: casa_cpu_temp, casa_cpu_util: Change service description to standard...
+ NOTE: Please refer to the migration notes!
Multisite:
* 1066 Implemented Dashboard Designer...
diff --git a/checks/casa_cpu_temp b/checks/casa_cpu_temp
index 9c3d689..5aa4f03 100644
--- a/checks/casa_cpu_temp
+++ b/checks/casa_cpu_temp
@@ -30,10 +30,13 @@ def parse_casa_info_temp(info):
temp_status = dict(map(lambda x: [int(x[0]), x[1]], info[2]))
temp_unit = dict(map(lambda x: [int(x[0]), x[1]], info[3]))
data = {}
- for idx, entry in enumerate(info[1]):
+ for entry in info[1]:
entry_nr = int(entry[0])
def beautify_module_text(text):
- return text.replace("temperature sensor", "")
+ text = text.replace("temperature sensor", "")
+ if text.startswith("Module "):
+ text = text.rsplit(None, 1)[0] # Drop trailing " CPU"
+ return text
data[beautify_module_text(entity_names[entry_nr])] = {
"temp_value" : temp_value.get(entry_nr),
"temp_status" : temp_status.get(entry_nr),
@@ -69,7 +72,7 @@ def check_casa_cpu_temp(item, params, info):
state = 1
error_text = "(!)"
perfdata.append( ("temp", value, warn, crit, 0, 100) )
- infotext = "%.1f°C %s%s" % (value, error_text, levels_text)
+ infotext = "Temperature is %.1f °C %s%s" % (value, error_text,
levels_text)
else:
state = 2
infotext = "Sensor failure!"
diff --git a/checks/casa_cpu_util b/checks/casa_cpu_util
index a72c8ce..a189f8f 100644
--- a/checks/casa_cpu_util
+++ b/checks/casa_cpu_util
@@ -27,11 +27,15 @@
def parse_casa_info_util(info):
entity_names = dict(map(lambda x: [int(x[0]), x[1]], info[0]))
data = {}
- for idx, entry in enumerate(info[1]):
+ for entry in info[1]:
entry_nr = int(entry[0])
- data[entity_names[entry_nr]] = {
- "cpu_util" : info[1][idx][1],
- }
+ name = entity_names[entry_nr] # e.g. "Module 1 QEM".
+ # Drop "QEM" in order to be consistent with other DTCS checks...
+ if name.startswith("Module "):
+ name = name.rsplit(None, 1)[0]
+ data[name] = {
+ "cpu_util" : entry[1],
+ }
return data
def inventory_casa_cpu_util(info):
@@ -44,7 +48,6 @@ def inventory_casa_cpu_util(info):
def check_casa_cpu_util(item, params, info):
data = parse_casa_info_util(info)
- perfdata = []
if item in data:
state = 0
value = int(data[item]["cpu_util"])
@@ -56,21 +59,21 @@ def check_casa_cpu_util(item, params, info):
levels_text = "(levels at %s%%/%s%%)" % (warn, crit)
if value > crit:
state = 2
- error_text = "(!!)"
elif value > warn:
state = 1
- error_text = "(!)"
+ else:
+ levels_text = ""
infotext = "%d%% %s%s" % (value, error_text, levels_text)
- perfdata.append( ("util", value, warn, crit, 0, 100) )
+ perfdata = [ ("util", value, warn, crit, 0, 100) ]
return (state, infotext, perfdata)
else:
- return (3, "%s not found in snmp output" % item, perfdata)
+ return 3, "%s not found in SNMP output" % item
check_info["casa_cpu_util"] = {
"check_function" : check_casa_cpu_util,
"inventory_function" : inventory_casa_cpu_util,
- "service_description" : "Utilization %s",
+ "service_description" : "CPU utilization %s",
"has_perfdata" : True,
"group" : "cpu_utilization_multiitem",
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
in
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 63a1f71..dff9aac 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -312,7 +312,7 @@ def perfometer_temperature(row, check_command, perf_data):
color = "#39f"
value = float(perf_data[0][1])
crit = savefloat(perf_data[0][4])
- return u"%d°C" % int(value), perfometer_logarithmic(value, 40, 1.2, color)
+ return u"%d °C" % int(value), perfometer_logarithmic(value, 40, 1.2,
color)
perfometers["check_mk-nvidia.temp"] = perfometer_temperature
perfometers["check_mk-cisco_temp_sensor"] = perfometer_temperature
@@ -343,6 +343,7 @@ perfometers["check_mk-qlogic_sanbox.temp"] =
perfometer_temperature
perfometers["check_mk-bintec_sensors.temp"] = perfometer_temperature
perfometers["check_mk-knuerr_rms_temp"] = perfometer_temperature
perfometers["check_mk-arris_cmts_temp"] = perfometer_temperature
+perfometers["check_mk-casa_cpu_temp"] = perfometer_temperature
perfometers["check_mk-rms200_temp"] = perfometer_temperature
def perfometer_temperature_multi(row, check_command, perf_data):
@@ -564,7 +565,7 @@ perfometers["check_mk-oracle_processes"] =
perfometer_oracle_sessions
def perfometer_cpu_utilization(row, check_command, perf_data):
util = float(perf_data[0][1]) # is already percentage
- color = "#60f020"
+ color = "#60c080"
return "%.0f %%" % util, perfometer_linear(util, color)
#perfometer_linear(perc, color)
@@ -583,6 +584,7 @@ perfometers["check_mk-juniper_trpz_cpu_util"] =
perfometer_cpu_utilization
perfometers["check_mk-ibm_svc_nodestats.cpu_util"] =
perfometer_cpu_utilization
perfometers["check_mk-ibm_svc_systemstats.cpu_util"] =
perfometer_cpu_utilization
perfometers["check_mk-sni_octopuse_cpu"] = perfometer_cpu_utilization
+perfometers["check_mk-casa_cpu_util"] = 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])