/hpux/plugins/get_sap.sh

https://github.com/vk2cot/cfg2html · Shell · 274 lines · 251 code · 11 blank · 12 comment · 35 complexity · a0e3122ff8055e1a3119ad3d1ce6758e MD5 · raw file

  1. #!/usr/bin/ksh
  2. # @(#) $Id: get_sap.sh,v 6.10.1.1 2013-09-12 16:13:15 ralph Exp $
  3. # ---------------------------------------------------------------------------
  4. # First Version: Roland Schoettler, HP Ratingen
  5. # Update: 23/08/99: Klaus Doemer, HP Ratingen
  6. # 11/10/00: Klaus Doemer / SG-Specials
  7. # / Saprouter-Config
  8. # / HP Somersault
  9. # 06/02/02: Klaus Doemer / Oracle 8.1.X/9.x
  10. # 19/03/02: Klaus Doemer / SAP Logfilesize Change
  11. # ---------------------------------------------------------------------------
  12. get_database()
  13. {
  14. database=""
  15. dbname=""
  16. if [ -d /oracle/$sid ]
  17. then
  18. database="oracle"
  19. dbname="Oracle"
  20. fi
  21. if [ -d /informix/$sid ]
  22. then
  23. database="informix"
  24. dbname="Informix"
  25. fi
  26. if [ -n "$database" ]
  27. then
  28. if [ -d /$database/$sid/sapcheck ]
  29. then
  30. filename=`ls -t /$database/$sid/sapcheck | grep -n .chk | grep "^1:" | awk ' BEGIN { FS=":"} {print $2} '`
  31. if [ -f "/$database/$sid/sapcheck/$filename" ]
  32. then
  33. echo "@@@@@@ START OF ${sid}_sapdba-check_($dbname)"
  34. echo ""
  35. cat /$database/$sid/sapcheck/$filename | grep -v "^\*\*\*"
  36. echo ""
  37. echo "###### END OF ${sid}_sapdba-check_($dbname)"
  38. echo ""
  39. fi
  40. fi
  41. fi
  42. }
  43. get_oracle_config()
  44. {
  45. if [ -r /oracle/$sid/saptrace/background/alert_${sid}.log ]
  46. then
  47. echo "@@@@@@ START OF ${sid}_OracleVersion"
  48. echo
  49. cat /oracle/$sid/saptrace/background/alert_${sid}.log | \
  50. grep Version | tail -1
  51. echo
  52. echo "###### END OF ${sid}_OracleVersion"
  53. echo
  54. fi
  55. transdir=/usr/sap/trans
  56. for i in $transdir/listener.ora $transdir/tnsnames.ora $transdir/sqlnet.ora \
  57. /etc/listener.ora /etc/tnsnames.ora /etc/sqlnet.ora
  58. do
  59. if [ -r "$i" ]
  60. then
  61. echo "@@@@@@ START OF ${i}"
  62. echo
  63. cat $i
  64. echo
  65. echo "###### END OF ${i}"
  66. echo
  67. fi
  68. done
  69. for o in /oracle/$sid /oracle/$sid/81?_??
  70. do
  71. if [ -d $o ]
  72. then
  73. oradir=$o/dbs
  74. ora1dir=$o/network/admin
  75. ora2dir=$o/net80/admin
  76. for i in $ora1dir/listener.ora $ora1dir/tnsnames.ora $ora1dir/sqlnet.ora \
  77. $ora2dir/listener.ora $ora2dir/tnsnames.ora $ora2dir/sqlnet.ora \
  78. $oradir/init${sid}.ora $oradir/init${sid}.sap $oradir/init${sid}.dba
  79. do
  80. if [ -r "$i" ]
  81. then
  82. echo "@@@@@@ START OF ${i}"
  83. echo
  84. cat $i
  85. echo
  86. echo "###### END OF ${i}"
  87. echo
  88. fi
  89. done
  90. fi
  91. done
  92. }
  93. get_profiles()
  94. {
  95. if [ -d /usr/sap/$sid/SYS/profile ]
  96. then
  97. hostname=`hostname`
  98. profile="`echo /usr/sap/$sid/SYS/profile/START_*_* | grep -v \*`"
  99. if [ -n "$profile" ]
  100. then
  101. for i in $profile
  102. do
  103. echo "@@@@@@ START OF $i"
  104. echo ""
  105. if [ -r "$i" ]
  106. then
  107. cat "$i"
  108. else
  109. echo "$i not readable"
  110. fi
  111. echo ""
  112. echo "###### END OF $i"
  113. echo ""
  114. done
  115. fi
  116. echo "@@@@@@ START OF /usr/sap/$sid/SYS/profile/DEFAULT.PFL"
  117. echo ""
  118. if [ -r /usr/sap/$sid/SYS/profile/DEFAULT.PFL ]
  119. then
  120. cat /usr/sap/$sid/SYS/profile/DEFAULT.PFL
  121. else
  122. echo "no DEFAULT.PFL configured"
  123. fi
  124. echo ""
  125. echo "###### END OF /usr/sap/$sid/SYS/profile/DEFAULT.PFL"
  126. echo ""
  127. profile="`echo /usr/sap/$sid/SYS/profile/${sid}_*_* | grep -v \*`"
  128. if [ -n "$profile" ]
  129. then
  130. for i in $profile
  131. do
  132. echo "@@@@@@ START OF $i"
  133. echo ""
  134. if [ -r "$i" ]
  135. then
  136. cat "$i"
  137. else
  138. echo "$i not readable"
  139. fi
  140. echo ""
  141. echo "###### END OF $i"
  142. echo ""
  143. done
  144. fi
  145. fi
  146. }
  147. get_tracefiles()
  148. {
  149. directories="`echo /usr/sap/$sid/D*/work | grep -v \*`"
  150. if [ -n "$directories" ]
  151. then
  152. for d in $directories
  153. do
  154. instance=`echo $d | awk -F/ '{ print $5 }'`
  155. cd "$d"
  156. files=`echo dev_w* dev_disp dev_ms`
  157. if [ -n "$files" ]
  158. then
  159. for i in $files
  160. do
  161. echo "@@@@@@ START OF ${sid}_${instance}_${i} first 40/last 40 lines"
  162. echo ""
  163. if [ -r "$i" ]
  164. then
  165. if [ `wc -l $i | awk ' { print $1} ' ` -lt 80 ]
  166. then
  167. cat $i
  168. else
  169. head -40 "$i"
  170. echo "............."
  171. tail -40 "$i"
  172. fi
  173. else
  174. echo "$i not readable"
  175. fi
  176. echo ""
  177. echo "###### END OF ${sid}_${instance}_${i}"
  178. echo ""
  179. done
  180. fi
  181. done
  182. fi
  183. }
  184. get_dispwork_version()
  185. {
  186. if [ -x /usr/sap/$sid/SYS/exe/run/disp+work ]
  187. then
  188. echo "@@@@@@ START OF ${sid}_what_disp+work"
  189. echo
  190. what /usr/sap/$sid/SYS/exe/run/disp+work
  191. echo
  192. echo "###### END OF ${sid}_what_disp+work"
  193. echo
  194. fi
  195. }
  196. get_transportconfig()
  197. {
  198. if [ -r /usr/sap/trans/bin/TPPARAM ]
  199. then
  200. echo "@@@@@@ START OF TPPARAM"
  201. echo
  202. cat /usr/sap/trans/bin/TPPARAM
  203. echo
  204. echo "###### END OF TPPARAM"
  205. echo
  206. fi
  207. }
  208. get_saproutconfig()
  209. {
  210. if [ -r /usr/sap/saprouter/saprouttab ]
  211. then
  212. echo "@@@@@@ START OF SAPROUTTAB"
  213. echo
  214. cat /usr/sap/saprouter/saprouttab
  215. echo
  216. echo "###### END OF SAPROUTTAB"
  217. echo
  218. fi
  219. }
  220. get_ss_config()
  221. {
  222. ssdir=/var/opt/hpsom/$sid
  223. if [ -d ${ssdir} ]
  224. then
  225. for i in /home/${sid}adm/.SS_machines $ssdir/settings_custom \
  226. $ssdir/enq_config $ssdir/${sid}_*_hpsom_srv \
  227. $ssdir/SS_comp_file $ssdir/Status/*_status_* \
  228. $ssdir/Trace/ENQ* $ssdir/Trace/*hpsom*_trc_*
  229. do
  230. if [ -r "$i" ]
  231. then
  232. echo "@@@@@@ START OF ${i}"
  233. echo
  234. cat $i
  235. echo
  236. echo "###### END OF ${i}"
  237. echo
  238. fi
  239. done
  240. fi
  241. }
  242. ################ MAIN #############
  243. if [ -d /usr/sap ]
  244. then
  245. cd /usr/sap
  246. sids=`ls | grep -v "put|tmp|trans|archive|ccms"`
  247. for sid in $sids
  248. do
  249. get_database;
  250. if [ "$database" = "oracle" ]
  251. then
  252. get_oracle_config;
  253. fi
  254. get_profiles;
  255. get_tracefiles;
  256. get_dispwork_version;
  257. get_ss_config;
  258. done
  259. get_transportconfig;
  260. get_saproutconfig;
  261. else
  262. echo "No SAP-System installed or detected"
  263. fi