#!/bin/bash # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | # | | |___| | | | __/ (__| < | | | | . \ | # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | # | | # | Copyright Mathias Kettner 2014 mk@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- # tails. 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. # cat sapservices ##!/bin/sh #LIBPATH=/usr/sap/C01/DVEBMGS25/exe:$LIBPATH; export LIBPATH; /usr/sap/C01/DVEBMGS25/exe/sapstartsrv pf=/usr/sap/C01/SYS/profile/START_DVEBMGS25_sap10c1 -D -u c01adm #LIBPATH=/usr/sap/DC1/SMDA98/exe:$LIBPATH; export LIBPATH; /usr/sap/DC1/SMDA98/exe/sapstartsrv pf=/usr/sap/DC1/SYS/profile/DC1_SMDA98_sap10c1 -D -u dc1adm #LIBPATH=/usr/sap/C02/DVEBMGS37/exe:$LIBPATH; export LIBPATH; /usr/sap/C02/DVEBMGS37/exe/sapstartsrv pf=/usr/sap/C02/SYS/profile/START_DVEBMGS37_sap10c1 -D -u c02adm #LIBPATH=/usr/sap/DAA/SMDA97/exe:$LIBPATH; export LIBPATH; /usr/sap/DAA/SMDA97/exe/sapstartsrv pf=/usr/sap/DAA/SYS/profile/DAA_SMDA97_sap10c1 -D -u daaadm #LIBPATH=/usr/sap/DDB/SMDA96/exe:$LIBPATH; export LIBPATH; /usr/sap/DDB/SMDA96/exe/sapstartsrv pf=/usr/sap/DDB/SYS/profile/DDB_SMDA96_sap10c1d -D -u ddbadm # <<>> # [69] # 05.06.2015 05:44:36 # GetProcessList # OK # name, description, dispstatus, textstatus, starttime, elapsedtime, pid # msg_server, MessageServer, GREEN, Running, 2015 06 01 02:28:51, 99:15:45, 17563810 # enserver, EnqueueServer, GREEN, Running, 2015 06 01 02:28:51, 99:15:45, 15466710 # gwrd, Gateway, GREEN, Running, 2015 06 01 02:28:51, 99:15:45, 25428046 # [68] # 05.06.2015 05:44:36 # GetProcessList # OK # name, description, dispstatus, textstatus, starttime, elapsedtime, pid # jstart, J2EE Server, GREEN, All processes running, 2015 06 01 02:29:06, 99:15:30, 18087996 # igswd_mt, IGS Watchdog, GREEN, Running, 2015 06 01 02:29:06, 99:15:30, 9765042 # # <<>> # GetProcessList # FAIL: NIECONN_REFUSED (Connection refused), NiRawConnect failed in plugin_fopen() sapservices="/usr/sap/sapservices" if [ -r "$sapservices" ]; then echo "<<>>" # 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") sappfpar=$(find $path -name sappfpar | head -1) sapcontrol=$(find $path -name sapcontrol | head -1) libpath=$(find $path -name libicuuc\*.a | head -1 | sed -e 's,/[^ /]*$,,') id=$(LIBPATH=$LIBPATH:$libpath $sappfpar SAPSYSTEM $command) echo -n "[$id]" LIBPATH=$LIBPATH:$libpath $sapcontrol -nr $id -function GetProcessList fi done fi