Module: check_mk
Branch: master
Commit: f66d3d636cf71a80d8c8366ebdb5c5dac18adc90
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f66d3d636cf71a…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Mon Mar 23 17:28:17 2015 +0100
#2106 aix_sap_processlist: new check and agent plugin to monitor the process list of SAP
Application Server Instances on AIX systems
---
.werks/2106 | 9 +++++
ChangeLog | 1 +
agents/plugins/mk_sap.aix | 56 +++++++++++++++++++++++++++++
checkman/aix_sap_processlist | 15 ++++++++
checks/aix_sap_processlist | 81 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 162 insertions(+)
diff --git a/.werks/2106 b/.werks/2106
new file mode 100644
index 0000000..e188710
--- /dev/null
+++ b/.werks/2106
@@ -0,0 +1,9 @@
+Title: aix_sap_processlist: new check and agent plugin to monitor the process list of SAP
Application Server Instances on AIX systems
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1427128023
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 94a7a9c..0716df1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -139,6 +139,7 @@
* 2063 winperf_if: now also able to detect the interface port state
'lowerLayerDown'...
* 2154 Interface-Checks: Separate traffic thresholds for in and out are now
possible...
* 2155 siemens_plc_counter: added new check for monitoring increasing counter values
+ * 2106 aix_sap_processlist: new check and agent plugin to monitor the process list of
SAP Application Server Instances on AIX systems
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/agents/plugins/mk_sap.aix b/agents/plugins/mk_sap.aix
new file mode 100755
index 0000000..fb49227
--- /dev/null
+++ b/agents/plugins/mk_sap.aix
@@ -0,0 +1,56 @@
+#!/bin/bash
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+sapservices="/usr/sap/sapservices"
+
+if [ -r "$sapservices" ]; then
+ echo "<<<aix_sap_processlist>>>"
+ # loop over ids
+ cat $sapservices | while read LINE
+ do
+ command=$(echo $LINE | grep "^LIBPATH=/usr/sap/" | grep -v
"^LIBPATH=/usr/sap/D" | awk -F" " '{print $5}')
+ if [ -n "$command" ]; then
+ id2=$(echo $command | awk -F"/" '{print $4}')
+ path=$(echo "/sapmnt/$id2/exe")
+ id=$(LIBPATH=$LIBPATH:$path $path/sappfpar SAPSYSTEM $command)
+ echo -n "[$id]"
+ LIBPATH=$LIBPATH:$path $path/sapcontrol -nr $id -function GetProcessList
+ fi
+ done
+fi
+
+
+# 16.02.2015 16:39:40
+# GetProcessList
+# OK
+# name, description, dispstatus, textstatus, starttime, elapsedtime, pid
+# msg_server, MessageServer, GREEN, Running, 2015 02 16 16:30:39, 0:09:01, 26345666
+# enserver, EnqueueServer, GREEN, Running, 2015 02 16 16:30:39, 0:09:01, 27787298
+
+# 16.03.2015 16:23:24
+# GetProcessList
+# FAIL: NIECONN_REFUSED (Connection refused), NiRawConnect failed in plugin_fopen()
+
+
diff --git a/checkman/aix_sap_processlist b/checkman/aix_sap_processlist
new file mode 100644
index 0000000..5cab3d7
--- /dev/null
+++ b/checkman/aix_sap_processlist
@@ -0,0 +1,15 @@
+title: SAP Process List on AIX
+agents: aix
+catalog: app/sap
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the SAP process list of instances running on a SAP
+ Application Server on AIX systems. The check requires the mk_sap.aix
+ agent plugin to be installed on your AIX system.
+
+item:
+ The description and instance number of each process.
+
+inventory:
+ One service is created for each discovered process on each instance.
diff --git a/checks/aix_sap_processlist b/checks/aix_sap_processlist
new file mode 100644
index 0000000..9c12159
--- /dev/null
+++ b/checks/aix_sap_processlist
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2015 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.
+
+# Example output from agent:
+# <<<aix_sap_processlist:sep(44)>>>
+# [01]
+# 23.03.2015 13:49:27
+# GetProcessList
+# OK
+# name, description, dispstatus, textstatus, starttime, elapsedtime, pid
+# msg_server, MessageServer, GREEN, Running, 2015 03 23 05:03:45, 8:45:42, 17563666
+# disp+work, Dispatcher, GREEN, Running, Message Server connection ok, Dialog Queue time:
0.00 sec, 2015 03 23 05:03:45, 8:45:42, 15335532
+# igswd_mt, IGS Watchdog, GREEN, Running, 2015 03 23 05:03:45, 8:45:42, 31326312
+#
+# <<<aix_sap_processlist:sep(44)>>>
+# [02]
+# 23.03.2015 13:59:27
+# GetProcessList
+# FAIL: NIECONN_REFUSED (Connection refused), NiRawConnect failed in plugin_fopen()
+
+
+def parse_aix_sap_processlist(info):
+ instance = None
+ new_info = []
+ for line in info:
+ if line[0].startswith('['):
+ instance = line[0][1:-1]
+ elif instance and line[0].startswith("FAIL:"):
+ instance = None
+ elif instance and len(line) >= 7 and line[-1] != " pid":
+ description, status, textstatus = map(lambda x: re.sub("^
","",x), line[1:4])
+ new_info.append([instance, description, status, textstatus])
+ return new_info
+
+def inventory_aix_sap_processlist(info):
+ for line in info:
+ item = "%s on Instance %s" % (line[1], line[0])
+ yield item, None
+
+def check_aix_sap_processlist(item, _no_params, info):
+ for line in info:
+ if item == "%s on Instance %s" % (line[1], line[0]):
+ infotext = line[3]
+ if line[2] == "GREEN":
+ state = 0
+ elif line[2] == "YELLOW":
+ state = 1
+ else:
+ state = 2
+ return state, infotext
+
+
+check_info["aix_sap_processlist"] = {
+ 'inventory_function' : inventory_aix_sap_processlist,
+ 'check_function' : check_aix_sap_processlist,
+ 'parse_function' : parse_aix_sap_processlist,
+ 'service_description' : 'SAP Process %s',
+}