Skip to content

Instantly share code, notes, and snippets.

@SumitDasSAPBasis
Last active June 7, 2022 07:31
Show Gist options
  • Save SumitDasSAPBasis/a22e0cc9a25c5a8585938f4f37bfb0e8 to your computer and use it in GitHub Desktop.
Save SumitDasSAPBasis/a22e0cc9a25c5a8585938f4f37bfb0e8 to your computer and use it in GitHub Desktop.
SAP Monitoring
#!/bin/bash
# 2022 04 19
# NAME
# Monitoring SAP Systems
# 1. SM51 - sapcontrol
# 2. SM50 - sapcontrol
# 3. DB12 -
# 3.a. DCS3 - /<db>/<sid>/sapbackup/*.anf
# 3.b. FCI/SYB - localbackup
# 3.c. FCI/HANA - hdbsql
# 3.d. FCI/ORA - >
# 4. DB13
# 5. DB01 ?
# 6. SM12 - sapcontrol
# 7. ST22 - sapcontrol
# 8. SM13 - sapcontrol ?
# 9. SM21 - sapcontrol
SYSNR=$1
ASCSNR=$2
datestamp=$(date "+%Y.%m.%d-%H.%M.%S")
# 1. SM51 - sapcontrol
echo " SM51: All Instance Status"
sapcontrol -nr $SYSNR -function GetSystemInstanceList
echo ""
# 2. SM50 - sapcontrol
echo " SM50: Work process list"
sapcontrol -nr $SYSNR -function ABAPGetWPTable
echo ""
# 3. ST22 - sapcontrol
#echo " ST22: ABAP Dumps"
#sapcontrol -nr $SYSNR -function ABAPGetWPTable
#echo ""
# 4. SM21- sapcontrol
echo " SM21: System Log"
sapcontrol -nr $SYSNR -function ABAPReadSyslog | grep -e "2022 05 04"
echo ""
# 5. SM12- sapcontrol
echo " SM12: Table Locks"
sapcontrol -nr $ASCSNR -function EnqGetLockTable
echo ""
# 6. DB13 - read file
# Location:
# Update State: /oracle/SID/sapcheck/*.sta
# DB Check: /oracle/SID/sapcheck/*.chk
# Cleanup Logs: /oracle/SID/sapcheck/*.cln
# DB Verify: /oracle/SID/sapbackup/*.dbv
# DB Check
SID=`ps -ef | grep tns | grep -v grep | grep -v netns | awk '{print $(NF-1)}' | cut -d _ -f 2 | sort -u`
cd /oracle/$SID/sapcheck
DBcheck_File=`ls -ltr *.chk | tail -n 1 | awk '{print $9}'`
DBcheck_Status=`tail -n 1 $DBcheck_File`
DBcheck_Date=`tail -n 2 $DBcheck_File | head -n 1`
echo "DB Check for $SID : File: $DBcheck_File : $DBcheck_Status as on $DBcheck_Date"
# 7 Filesystem Check: CI
# 7 Filesystem Check: Sapdata
# 7 Filesystem Check: Sybase home
# 7 Filesystem Check: Sybarch
# 7 Filesystem Check: Archivepool
# 8 Check GW connections
# 9 Check CPU/Memory/SWAP
# 10 Check HOSTAGENT status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment