Module: check_mk
Branch: master
Commit: ffc2b309c3e9cb09a1cc32003357ee2aae01edbc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ffc2b309c3e9cb…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Dec 20 15:29:59 2017 +0100
Added some informational states to check plugin salesforce_instances
Change-Id: I25cd024739c571793621d772964cc59f1a152adc
---
checks/salesforce_instances | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/checks/salesforce_instances b/checks/salesforce_instances
index 89dac3e..84518b0 100644
--- a/checks/salesforce_instances
+++ b/checks/salesforce_instances
@@ -44,13 +44,23 @@ def inventory_salesforce_instances(parsed):
def check_salesforce_instances(item, params, parsed):
+ map_states = {
+ "OK": (0, "OK"),
+ "MAJOR_INCIDENT_CORE": (0, "major incident core"),
+ "MINOR_INCIDENT_CORE": (0, "minor incident core"),
+ "MAINTENANCE_CORE": (0, "maintenance core"),
+ "INFORMATIONAL_CORE": (0, "informational core"),
+ "MAJOR_INCIDENT_NONCORE": (0, "major incident noncore"),
+ "MINOR_INCIDENT_NONCORE": (0, "minor incident noncore"),
+ "MAINTENANCE_NONCORE": (0, "maintenance noncore"),
+ "INFORMATIONAL_NONCORE": (0, "informational noncore"),
+ }
+
for entry in parsed:
if entry.get("key") == item:
- if entry.get("status") != "OK":
- yield 2, "Status: %s" % entry.get("status", "not
OK")
- else:
- yield 0, "Status: OK"
-
+ status = entry.get("status")
+ state, state_readable = map_states.get(status, (3, "unknown[%s]" %
status))
+ yield state, "Status: %s" % state_readable
if entry.get("environment"):
yield 0, "Environment: %s" % entry["environment"]
release_info = []