Module: check_mk
Branch: master
Commit: 44dec50075fe2f78fb48afbf5b65821c5486b5ee
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=44dec50075fe2f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 18 15:13:17 2014 +0100
#1503 FIX Fixed monitoring of multiple SAP instances with one mk_sap plugin
When monitoring multiple SAP instances from one host by configuring
multiple instances in the sap.cfg, the monitoring of all following
instances was skipped when one single instance had connection
problems.
---
.werks/1503 | 14 ++++++++++++++
ChangeLog | 1 +
agents/plugins/mk_sap | 21 ++++++++++-----------
3 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/.werks/1503 b/.werks/1503
new file mode 100644
index 0000000..061ba8d
--- /dev/null
+++ b/.werks/1503
@@ -0,0 +1,14 @@
+Title: Fixed monitoring of multiple SAP instances with one mk_sap plugin
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.5i7
+Date: 1416319927
+
+When monitoring multiple SAP instances from one host by configuring
+multiple instances in the sap.cfg, the monitoring of all following
+instances was skipped when one single instance had connection
+problems.
+
diff --git a/ChangeLog b/ChangeLog
index c55d9c4..cd635e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@
* 1437 FIX: veeam_jobs: fixed incorrect state for BackupSync job...
* 1511 FIX: oracle_jobs: avoid broken checks, make compatible with old version...
* 1513 FIX: Handle broken SNMP bulk walk implementation of Mikrotik Router firmware
RouterOS v6.22...
+ * 1503 FIX: Fixed monitoring of multiple SAP instances with one mk_sap plugin...
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/agents/plugins/mk_sap b/agents/plugins/mk_sap
index 0ce9546..8f867df 100755
--- a/agents/plugins/mk_sap
+++ b/agents/plugins/mk_sap
@@ -221,7 +221,7 @@ def logout():
'INTERFACE': 'XAL',
})
-def mon_list( cfg ):
+def mon_list(cfg):
f = query("BAPI_SYSTEM_MON_GETLIST", {
'EXTERNAL_USER_NAME': cfg['user'],
})
@@ -355,21 +355,16 @@ def process_alerts(cfg, logs, ms_name, mon_name, node, alerts):
-def connect(cfg):
+def check(cfg):
global conn
- try:
- conn = sapnwrfc.base.rfc_connect(cfg)
- except sapnwrfc.RFCCommunicationError, e:
- sys.stderr.write('ERROR: Unable to connect (%s)\n' % e)
- return
-
+ conn = sapnwrfc.base.rfc_connect(cfg)
login()
logs = {}
sap_data = {}
# This loop is used to collect all information from SAP
- for ms_name, mon_name in mon_list( cfg ):
+ for ms_name, mon_name in mon_list(cfg):
path = ms_name + SEPARATOR + mon_name
if not to_be_monitored(path, True):
continue
@@ -455,10 +450,14 @@ def connect(cfg):
logout()
conn.close()
+# It is possible to configure multiple SAP instances to monitor. Loop them all, but
+# do not terminate when one connection failed
for entry in cfg:
try:
- connect(entry)
+ check(entry)
+ except sapnwrfc.RFCCommunicationError, e:
+ sys.stderr.write('ERROR: Unable to connect (%s)\n' % e)
except:
- pass # Make sure that other entries are executed anyway
+ sys.stderr.write('ERROR: Unhandled exception (%s)\n' % e)
sys.exit(0)