Module: check_mk
Branch: master
Commit: 6c3c210261c5660be6706d99b9394c4d639d1dde
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6c3c210261c566…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Feb 22 16:00:48 2018 +0100
5742 windows_tasks: show the hexadecimal representation of the status code
schtasks.exe used by the check plugin windows_tasks.ps1 returns a signed
integer value as the last result of a task. However, the status codes
(e.g. on MSDN) are usually represented as a hexadecimal value. To make
it easier to lookup a status code the hexadecimal value is now shown by
the check plugin.
Change-Id: I591eb397c172446e7312cf43ed077227ae47cd47
---
.werks/5742 | 14 ++++++++++++++
checks/windows_tasks | 12 ++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/.werks/5742 b/.werks/5742
new file mode 100644
index 0000000..11ee6cd
--- /dev/null
+++ b/.werks/5742
@@ -0,0 +1,14 @@
+Title: windows_tasks: show the hexadecimal representation of the status code
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1519374443
+Class: feature
+
+schtasks.exe used by the check plugin windows_tasks.ps1 returns a signed
+integer value as the last result of a task. However, the status codes
+(e.g. on MSDN) are usually represented as a hexadecimal value. To make
+it easier to lookup a status code the hexadecimal value is now shown by
+the check plugin.
diff --git a/checks/windows_tasks b/checks/windows_tasks
index 20fb62f..29f5137 100644
--- a/checks/windows_tasks
+++ b/checks/windows_tasks
@@ -82,6 +82,8 @@ def check_windows_tasks(item, _no_params, parsed):
return
map_codes = {
+ "0": "operation completed successfully",
+ "1": "task containing a popup action",
"267009": "currently running",
"267014": "terminated by user",
"267045": "queued",
@@ -91,10 +93,16 @@ def check_windows_tasks(item, _no_params, parsed):
data = parsed[item]
last_result = data['Last Result']
+ # schtasks.exe (used by the check plugin) returns a signed integer
+ # e.g. -2147024629. However, error codes are unsigned integers.
+ # To make it easier for the user to lookup the error code (e.g. on
+ # MSDN) we convert the negative numbers to the hexadecimal
+ # representation.
+ last_result_hex = hex(int(last_result) & 0xffffffff)
if last_result in map_codes:
- infotext = "Service Status: %s (%s)" % (map_codes[last_result], last_result)
+ infotext = "Service Status: %s (%s)" % (map_codes[last_result], last_result_hex)
else:
- infotext = "Service status: %s" % last_result
+ infotext = "Service status: Got exit code %s" % last_result_hex
state = 0
if last_result not in [
Module: check_mk
Branch: master
Commit: 5351cf3c4b12e0c24883693027ddf655d5e23454
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5351cf3c4b12e0…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Mar 21 11:23:45 2018 +0100
5777 FIX ucs_bladecenter_fans.temp: Made item name unique
The check plugins {{ucs_bladecenter_fans.temp}} and
{{ucs_bladecenter_psu.chassis_temp}} created same
item names and both use the WATO ruleset {{Temperature}}.
That means that if a rule applied to a service generated
by one of these check plugins, this rule automatically
applied to the related one, too. No distinction was possible.
You have to perform a rediscovery on the affected hosts.
Performance data will be preserved.
Example:
ucs_bladecenter_fans.temp generated the services
- Temperature Ambient Chassis 1 FAN
- Temperature Ambient Chassis 2 FAN
and ucs_bladecenter_psu.chassis_temp generated the services
- Temperature Ambient Chassis 1
- Temperature Ambient Chassis 2
the item names were {{Ambient Chassis 1}} and {{Ambient Chassis 2}}
in both cases. The temperature rule matching the sensor ID
{{Ambient Chassis.*}} automatically applied to all four services.
Now the item names for
ucs_bladecenter_fans.temp look like
- {{Ambient Chassis 1 FAN}}
- {{Ambient Chassis 2 FAN}}
and for ucs_bladecenter_psu.chassis_temp
- {{Ambient Chassis 1}}
- {{Ambient Chassis 2}}
Independent rules may be created in the following order:
- {{Ambient Chassis.*FAN}}
- {{Ambient Chassis.*}}
Change-Id: I9aaa7a23f9d09b08c3b6ef6526ac5e09185ff584
---
.werks/5777 | 44 ++++++++++++++++++++++++++++++++++++++++++++
checks/ucs_bladecenter_fans | 6 +++---
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/.werks/5777 b/.werks/5777
new file mode 100644
index 0000000..d38479d
--- /dev/null
+++ b/.werks/5777
@@ -0,0 +1,44 @@
+Title: ucs_bladecenter_fans.temp: Made item name unique
+Level: 1
+Component: checks
+Compatible: incomp
+Edition: cre
+Version: 1.5.0i4
+Date: 1521625999
+Class: fix
+
+The check plugins {{ucs_bladecenter_fans.temp}} and
+{{ucs_bladecenter_psu.chassis_temp}} created same
+item names and both use the WATO ruleset {{Temperature}}.
+That means that if a rule applied to a service generated
+by one of these check plugins, this rule automatically
+applied to the related one, too. No distinction was possible.
+
+You have to perform a rediscovery on the affected hosts.
+Performance data will be preserved.
+
+Example:
+ucs_bladecenter_fans.temp generated the services
+- Temperature Ambient Chassis 1 FAN
+- Temperature Ambient Chassis 2 FAN
+
+and ucs_bladecenter_psu.chassis_temp generated the services
+- Temperature Ambient Chassis 1
+- Temperature Ambient Chassis 2
+
+the item names were {{Ambient Chassis 1}} and {{Ambient Chassis 2}}
+in both cases. The temperature rule matching the sensor ID
+{{Ambient Chassis.*}} automatically applied to all four services.
+
+Now the item names for
+ucs_bladecenter_fans.temp look like
+- {{Ambient Chassis 1 FAN}}
+- {{Ambient Chassis 2 FAN}}
+
+and for ucs_bladecenter_psu.chassis_temp
+- {{Ambient Chassis 1}}
+- {{Ambient Chassis 2}}
+
+Independent rules may be created in the following order:
+- {{Ambient Chassis.*FAN}}
+- {{Ambient Chassis.*}}
diff --git a/checks/ucs_bladecenter_fans b/checks/ucs_bladecenter_fans
index e512bd4..fc56348 100644
--- a/checks/ucs_bladecenter_fans
+++ b/checks/ucs_bladecenter_fans
@@ -114,11 +114,11 @@ factory_settings["ucs_bladecenter_fans_temp_default_levels"] = {
def inventory_ucs_bladecenter_fans_temp(parsed):
for key, values in parsed.items():
if "AmbientTemp" in values:
- yield "Ambient " + " ".join(key.split()[:2]), {}
+ yield "Ambient %s FAN" % " ".join(key.split()[:2]), {}
def check_ucs_bladecenter_fans_temp(item, params, parsed):
- sensor_item = item[8:] # drop "Ambient "
+ sensor_item = item[8:-4] # drop "Ambient " and " FAN"
sensor_list = []
for key, values in parsed.items():
if key.startswith(sensor_item) and "AmbientTemp" in values:
@@ -133,7 +133,7 @@ def check_ucs_bladecenter_fans_temp(item, params, parsed):
check_info["ucs_bladecenter_fans.temp"] = {
'inventory_function' : inventory_ucs_bladecenter_fans_temp,
'check_function' : check_ucs_bladecenter_fans_temp,
- 'service_description' : 'Temperature %s FAN',
+ 'service_description' : 'Temperature %s',
'group' : 'temperature',
'has_perfdata' : True,
'includes' : [ 'ucs_bladecenter.include', 'temperature.include' ],