ct_cpuq.sh 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. #!/bin/sh
  2. SCRIPT_VERSION="19.1"
  3. SCRIPT_NAME=${0}
  4. ################################################################################
  5. #
  6. # this script is used to gather Operating System information for use by the
  7. # Oracle team
  8. #
  9. ################################################################################
  10. ################################################################################
  11. #
  12. #********************Hardware Identification and Detection**********************
  13. #
  14. ################################################################################
  15. ################################################################################
  16. #
  17. # time stamp
  18. #
  19. setTime() {
  20. # set time
  21. NOW="`date '+%m/%d/%Y %H:%M %Z'`"
  22. }
  23. ##############################################################
  24. # make echo more portable
  25. #
  26. echo_print() {
  27. #IFS=" " command
  28. eval 'printf "%b\n" "$*"'
  29. }
  30. ################################################################################
  31. #
  32. # expand debug output
  33. #
  34. echo_debug() {
  35. if [ "$DEBUG" = "true" ] ; then
  36. $ECHO "$*"
  37. $ECHO "$*" >> $ORA_DEBUG_FILE
  38. fi
  39. }
  40. setOutputFiles() {
  41. FILE_EXT=${$}
  42. # set tmp directory and files we will use in the script
  43. if [ "$tmp_dir" != "" ];then
  44. TMPDIR="$tmp_dir"
  45. else
  46. TMPDIR="/tmp"
  47. fi
  48. ORA_IPADDR_FILE="$TMPDIR"/oraipaddrs.$FILE_EXT
  49. ORA_MSG_FILE="$TMPDIR"/oramsgfile.$FILE_EXT
  50. touch ${ORA_MSG_FILE}
  51. # this wil allow us to pass the ORA_MACHINE_INFO file name
  52. # from a calling shell script
  53. ORA_MACHINFO_FILE="$TMPDIR"/${MACHINE_NAME}-ct_cpuq.txt
  54. ORA_PROCESSOR_FILE="$TMPDIR"/$MACHINE_NAME-proc.txt
  55. # debug and error files
  56. ORA_DEBUG_FILE="$TMPDIR"/oradebugfile.$FILE_EXT
  57. UNIXCMDERR="${TMPDIR}"/unixcmderrs.$FILE_EXT
  58. $ECHO_DEBUG "\ndebug.function.setOutputFiles"
  59. }
  60. ################################################################################
  61. #
  62. # set parameters based on user and hardware
  63. #
  64. setOSSystemInfo() {
  65. # debug
  66. $ECHO_DEBUG "\ndebug.function.setOSSystemInfo"
  67. SCRIPT_SHELL=$SHELL
  68. if [ "$OS_NAME" = "Linux" ] ; then
  69. set -xv
  70. cat /proc/cpuinfo
  71. set +xv
  72. if [ "$SCRIPT_USER" = "ROOT" ] ; then
  73. VERSION=`/usr/sbin/dmidecode 2>/dev/null | grep "# dmidecode" | cut -d ' ' -f3`
  74. MAJOR=`echo $VERSION | cut -d'.' -f1`
  75. MINOR=`echo $VERSION | cut -d'.' -f2`
  76. case "${MAJOR}" in
  77. 2)
  78. if [ ${MINOR} -le 6 ] ; then
  79. set -xv
  80. /usr/sbin/dmidecode
  81. set +xv
  82. else
  83. set -xv
  84. /usr/sbin/dmidecode --type processor
  85. /usr/sbin/dmidecode --type system | egrep -i 'system information|manufacturer|product'
  86. set +xv
  87. fi
  88. ;;
  89. *)
  90. set -xv
  91. /usr/sbin/dmidecode --type processor
  92. /usr/sbin/dmidecode --type system | egrep -i 'system information|manufacturer|product'
  93. set +xv
  94. ;;
  95. esac
  96. UUID=`dmidecode --string system-uuid`
  97. $ECHO "UUID="$UUID
  98. /usr/sbin/dmidecode 2>/dev/null | egrep -i 'vmware' >/dev/null 2>&1
  99. if [ $? -eq 0 ] ; then
  100. $ECHO "CPUQ: CT-01104: WARNING: VMWare virtual machine"
  101. fi
  102. /usr/sbin/dmidecode 2>/dev/null | egrep -i 'virtualbox' >/dev/null 2>&1
  103. if [ $? -eq 0 ] ; then
  104. $ECHO "CPUQ: CT-01104: WARNING: Oracle VirtualBox machine"
  105. fi
  106. else
  107. $ECHO "CPUQ: CT-01101: WARNING: /usr/sbin/dmidecode command not executed - $SCRIPT_USER insufficient privileges"
  108. fi
  109. ## Check for Linux LPAR config file
  110. if [ -s /proc/ppc64/lparcfg ]; then
  111. ## file exists so cat it
  112. cat /proc/ppc64/lparcfg
  113. fi
  114. ## Oracle VM for x86
  115. if [ -s /OVS/Repositories ] || [ -s /OVS/running_pool ]; then
  116. for CFGFILE in `find /OVS/Repositories/*/VirtualMachines /OVS/running_pool/*/ -name vm.cfg -print`
  117. do
  118. $ECHO
  119. $ECHO "#### BEGIN OVM Config File: $CFGFILE ####"
  120. $ECHO OVM Config File: $CFGFILE
  121. ls -l $CFGFILE
  122. cat $CFGFILE
  123. $ECHO "#### END OVM Config File: $CFGFILE ####"
  124. done
  125. if [ -x /usr/sbin/xm ];
  126. then
  127. set -xv
  128. /usr/sbin/xm info
  129. set +xv
  130. $ECHO
  131. if [ -x /usr/sbin/xenpm ];
  132. then
  133. set -xv
  134. /usr/sbin/xenpm get-cpu-topology
  135. set +xv
  136. fi
  137. $ECHO
  138. set -xv
  139. /usr/sbin/xm vcpu-list
  140. set +xv
  141. fi
  142. if [ -x /usr/sbin/ovs-agent-db ];
  143. then
  144. # get server pool name if one exists
  145. $ECHO
  146. $ECHO "#### OVM Server Pool Info ####"
  147. set -xv
  148. /usr/sbin/ovs-agent-db dump_db -c server_pool
  149. set +xv
  150. $ECHO
  151. set -xv
  152. # get a list of severs in the sever pool
  153. /usr/sbin/ovs-agent-db dump_db -c server_pool_servers
  154. set +xv
  155. fi
  156. if [ -s /var/log/ovs-agent.log ]; then
  157. ## file exists so cat it
  158. grep "migrate_vm" /var/log/ovs-agent.log
  159. grep "'cpus'" /var/log/ovs-agent.log
  160. fi
  161. fi
  162. if [ -x /usr/local/bin/ovm-info ];
  163. then
  164. set -xv
  165. /usr/local/bin/ovm-info
  166. set +xv
  167. fi
  168. ## Oracle Database Appliance
  169. if [ -x /opt/oracle/oak/bin/oakcli ];
  170. then
  171. /opt/oracle/oak/bin/oakcli validate -d > /dev/null 2>&1
  172. if [ $? -eq 0 ] ; then
  173. $ECHO "Oracle Database Appliance Processor Information"
  174. set -xv
  175. /opt/oracle/oak/bin/oakcli show processor
  176. /opt/oracle/oak/bin/oakcli show core_config_key
  177. /opt/oracle/oak/bin/oakcli show cpupool -node 0
  178. /opt/oracle/oak/bin/oakcli show cpupool -node 1
  179. set +xv
  180. ODA_IMPL=`/opt/oracle/oak/bin/oakcli validate -d | grep "Type of environment found" |cut -d ":" -f3`
  181. echo "Implementation type : [$ODA_IMPL]"
  182. fi
  183. elif [ -x /opt/oracle/dcs/bin/odacli ];
  184. then
  185. # Must be an ODA X6-2 S/M/L Model which does not support oakcli or CPU Pools
  186. if [ -x /opt/oracle/oak/bin/odaadmcli ];
  187. then
  188. set -xv
  189. /opt/oracle/oak/bin/odaadmcli show env_hw
  190. /opt/oracle/oak/bin/odaadmcli show processor
  191. set +xv
  192. fi
  193. set -xv
  194. /opt/oracle/dcs/bin/odacli describe-cpucore
  195. /opt/oracle/dcs/bin/odacli list-cpucores
  196. /opt/oracle/dcs/bin/odacli list-databases
  197. set +xv
  198. fi
  199. RELEASE=`uname -r`
  200. IPADDR=`/sbin/ifconfig | grep inet | awk '{print $2}' | sed 's/addr://'`
  201. elif [ "$OS_NAME" = "SunOS" ] ; then
  202. set -xv
  203. /usr/sbin/prtconf
  204. /usr/sbin/prtdiag
  205. set +xv
  206. /usr/sbin/psrinfo -p > /dev/null 2>&1
  207. isPoptionSupported=${?}
  208. if [ ${isPoptionSupported} -eq 0 ]
  209. then
  210. set -xv
  211. /usr/sbin/psrinfo -vp
  212. set +xv
  213. else
  214. set -xv
  215. /usr/sbin/psrinfo -v
  216. set +xv
  217. fi
  218. ## Get a list of cores on the system
  219. set -xv
  220. if [ -x /usr/bin/kstat ] ; then
  221. /usr/bin/kstat cpu_info | egrep "core_id|on-line|offline" | awk ' /core_id/ { Cores = $0 } /state/ { threadState = $0 ; printf("%s|%s\n", Cores, threadState) }' | sort | uniq
  222. else
  223. /bin/kstat cpu_info | egrep "core_id|on-line|offline" | awk ' /core_id/ { Cores = $0 } /state/ { threadState = $0 ; printf("%s|%s\n", Cores, threadState) }' | sort | uniq
  224. fi
  225. set +xv
  226. # Let's check if we're a VM - we need prtdiag to run successfully to do this
  227. /usr/sbin/prtdiag > /dev/null 2>&1
  228. if [ $? -eq 0 ] ; then
  229. SYSCON=`/usr/sbin/prtdiag | grep "System Configuration:" | cut -d':' -f2`
  230. $ECHO $SYSCON | egrep 'Sun Microsystems|Oracle Corporation'
  231. SUNCHECK=$?
  232. if [ $SUNCHECK -ne 0 ] ; then
  233. $ECHO "CPUQ: CT-01102: WARNING: Possible Virtual Machine $SYSCON, processor information is also needed for the physical machine"
  234. fi
  235. fi
  236. # Look for LDOMs and get LDOM version
  237. if [ -x /usr/sbin/virtinfo ] ; then
  238. set -xv
  239. /usr/sbin/virtinfo -ap
  240. set +xv
  241. fi
  242. if [ -x /usr/sbin/ldm ] || [ -x /opt/SUNWldm/bin/ldm ]; then
  243. if [ -x /usr/sbin/ldm ]; then
  244. alias ldm=/usr/sbin/ldm
  245. else
  246. alias ldm=/opt/SUNWldm/bin/ldm
  247. fi
  248. set -xv
  249. ldm -V
  250. ldm list
  251. ldm list-devices -p cpu
  252. set +xv
  253. # Get a list of LDOMs and get their configurations and core allocations
  254. for DOM in `ldm list | grep -v "NAME" | cut -f1 -d' '`
  255. do
  256. set -xv
  257. ldm list -o resmgmt,core $DOM
  258. set +xv
  259. done
  260. fi
  261. RELEASE=`uname -r`
  262. MAJOR=`echo $RELEASE | cut -d'.' -f1`
  263. MINOR=`echo $RELEASE | cut -d'.' -f2`
  264. if [ ${MINOR} -gt 9 ] ; then
  265. set -xv
  266. # check and see if we're running in the global zone
  267. ZONENAME=`/sbin/zonename`
  268. set +xv
  269. if [ "$ZONENAME" != "global" ] ; then
  270. $ECHO "CPUQ: CT-01103: WARNING: ${0} executed in the $ZONENAME zone, processor information is also needed for the global zone"
  271. fi
  272. set -xv
  273. # Get a list of zones and their UUIDs
  274. /usr/sbin/zoneadm list -cp
  275. # Loop through each zone and get its config info
  276. for CFG_ZONENAME in `/usr/sbin/zoneadm list -c`
  277. do
  278. $ECHO "\nZone $CFG_ZONENAME configuration:"
  279. /usr/sbin/zonecfg -z $CFG_ZONENAME info
  280. done
  281. /usr/sbin/pooladm
  282. set +xv
  283. fi
  284. IPADDR=`grep $MACHINE_NAME /etc/hosts | awk '{print $1}'`
  285. elif [ "$OS_NAME" = "HP-UX" ] ; then
  286. # Check if this is server is Instance Capacity System
  287. if [ -x /usr/sbin/icapstatus ] ; then
  288. set -xv
  289. /usr/sbin/icapstatus
  290. set +xv
  291. if [ $? -eq 2 ] ; then
  292. $ECHO "\n$MACHINE_NAME is not an Instant Capacity System\n"
  293. fi
  294. elif [ -x /usr/sbin/icod_stat ] ; then
  295. # Check deprecated icod_stat command
  296. set -xv
  297. /usr/sbin/icod_stat
  298. if [ $? -eq 2 ] ; then
  299. $ECHO "\n$MACHINE_NAME is not an Instant Capacity System\n"
  300. fi
  301. set +xv
  302. fi
  303. set -xv
  304. /usr/sbin/ioscan -fkC processor
  305. set +xv
  306. set -xv
  307. /usr/bin/getconf MACHINE_MODEL
  308. set +xv
  309. RELEASE=`uname -r`
  310. IPADDR=`grep $MACHINE_NAME /etc/hosts | awk '{print $1}'`
  311. if [ -x /usr/contrib/bin/machinfo ] ; then
  312. set -xv
  313. /usr/contrib/bin/machinfo
  314. set +xv
  315. fi
  316. ## Check if this is a Itanium box
  317. ## if so run hpvmstatus for IVM's and setboot to see if
  318. ## processors have HyperThread enabled
  319. MACH_HARDWARE=`uname -m`
  320. if [ "${MACH_HARDWARE}" = "ia64" ] ; then
  321. ## Check to see if Integrity VMs are configured
  322. ## Let's first check if hpvmstatus is installed in the default location
  323. if [ -x /opt/hpvm/bin/hpvmstatus ] ; then
  324. for IVM in `/opt/hpvm/bin/hpvmstatus -V | grep "Virtual Machine Name" | cut -d ':' -f2`
  325. do
  326. set -xv
  327. /opt/hpvm/bin/hpvmstatus -V -P $IVM
  328. set +xv
  329. done
  330. else
  331. # Let's just see if hpvmstatus can be found
  332. for IVM in `hpvmstatus -V | grep "Virtual Machine Name" | cut -d ':' -f2`
  333. do
  334. set -xv
  335. hpvmstatus -V -P $IVM
  336. set +xv
  337. done
  338. fi
  339. if [ -x /usr/sbin/setboot ] ; then
  340. set -xv
  341. /usr/sbin/setboot
  342. set +xv
  343. else
  344. ## if setboot is not where it is should be
  345. ## just try and see if it is in the PATH
  346. set -xv
  347. setboot
  348. set +xv
  349. fi
  350. fi
  351. ## Check to see if nPars are configured
  352. if [ -x /usr/sbin/parstatus ] ; then
  353. set -xv
  354. /usr/sbin/parstatus
  355. set +xv
  356. fi
  357. ## Check to see if vPars are configured
  358. if [ -x /usr/sbin/vparstatus ] ; then
  359. set -xv
  360. # Get the name of the vPar where this script ran
  361. /usr/sbin/vparstatus -w
  362. # Get info for all the vPars
  363. /usr/sbin/vparstatus
  364. # check for dual core
  365. /usr/sbin/vparstatus -d
  366. set +xv
  367. fi
  368. if [ -x /usr/sbin/vparhwmgmt ] ; then
  369. set -xv
  370. /usr/sbin/vparhwmgmt -p cpu -l
  371. set +xv
  372. fi
  373. ## Check to see if Secure Resource Partitions/HP Containers are configured.
  374. if [ -x /opt/hpsrp/bin/srp ] ; then
  375. set -xv
  376. /opt/hpsrp/bin/srp -l -v -s prm
  377. set +xv
  378. fi
  379. elif [ "$OS_NAME" = "AIX" ] ; then
  380. set -xv
  381. uname -Mm
  382. /usr/sbin/lsdev -Cc processor
  383. /usr/sbin/prtconf
  384. set +xv
  385. if [ -x /usr/bin/lparstat ] ; then
  386. VERSION=`uname -v`
  387. ## Check OS version to see if we need to
  388. ## pass W option to get WPAR info
  389. if [ ${VERSION} -gt 5 ] ; then
  390. set -xv
  391. /usr/bin/lparstat -iW
  392. set +xv
  393. else
  394. set -xv
  395. /usr/bin/lparstat -i
  396. set +xv
  397. fi
  398. fi
  399. if [ -x /usr/bin/errpt ] ; then
  400. set -xv
  401. /usr/bin/errpt -a -J CLIENT_PMIG_STARTED,CLIENT_PMIG_DONE | tee ${ORA_MSG_FILE}
  402. /usr/bin/ls -l ${ORA_MSG_FILE}
  403. set +xv
  404. fi
  405. if [ -x /usr/sbin/lsattr ] ; then
  406. for PROC in `/usr/sbin/lsdev -Cc processor | cut -d' ' -f1`
  407. do
  408. set -xv
  409. /usr/sbin/lsattr -EH -l ${PROC}
  410. set +xv
  411. done
  412. fi
  413. if [ "$SCRIPT_USER" = "ROOT" ] ; then
  414. set -xv
  415. /usr/sbin/smtctl
  416. set +xv
  417. else
  418. $ECHO "smtctl command not executed - $SCRIPT_USER insufficient privileges"
  419. fi
  420. RELEASE="`uname -v`.`uname -r`"
  421. IPADDR=`grep $MACHINE_NAME /etc/hosts | awk '{print $1}'`
  422. elif [ "$OS_NAME" = "OSF1" -o "$OS_NAME" = "UnixWare" ] ; then
  423. set -xv
  424. /usr/sbin/psrinfo -v
  425. set +xv
  426. IPADDR=`grep $MACHINE_NAME /etc/hosts | awk '{print $1}'`
  427. fi
  428. # populate IP adresses to file
  429. $ECHO "$IPADDR" > $ORA_IPADDR_FILE
  430. }
  431. ################################################################################
  432. #
  433. # output welcome message.
  434. #
  435. beginMsg()
  436. {
  437. $ECHO "\n*******************************************************************************" >&2
  438. $ECHO "Terms for Oracle Software Collection Tool
  439. By selecting \"Accept License Agreement\" (or the equivalent) or by installing or using the Software (as defined below), You indicate Your acceptance of these terms and Your agreement, as an authorized representative of Your company or organization (if being acquired for use by an entity) or as an individual, to comply with the license terms that apply to the Software. If you are not willing to be bound by these terms, do not indicate Your acceptance and do not download, install, or use the Software.
  440. License Agreement
  441. PLEASE SCROLL DOWN AND READ ALL OF THE FOLLOWING TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT (this \"Agreement\") CAREFULLY. THIS AGREEMENT IS A LEGALLY BINDING CONTRACT BETWEEN YOU AND ORACLE AMERICA, INC. THAT SETS FORTH THE TERMS THAT GOVERN YOUR USE OF THE SOFTWARE.
  442. YOU MUST ACCEPT AND ABIDE BY THESE TERMS AS PRESENTED TO YOU - ANY CHANGES, ADDITIONS OR DELETIONS BY YOU TO THESE TERMS ARE NOT ACCEPTED AND WILL NOT BE PART OF THIS AGREEMENT.
  443. Definitions
  444. \"Oracle\" refers to Oracle America, Inc.
  445. \"You\" and \"Your\" refers to the individual or entity that wishes to use the Software.
  446. \"Software\" refers to the tool(s), script(s) and/or software product(s) (and any applicable documentation) provided with these terms to You by Oracle and which You wish to access and use to measure, monitor and/or manage Your usage of separately-licensed Oracle software (the \"Programs\") that has been licensed under a separate agreement between Oracle and You, such as an Oracle Master Agreement, an Oracle Software License and Services Agreement, an Oracle PartnerNetwork Agreement or an Oracle distribution agreement (each, an \"Oracle License Agreement\").
  447. Rights Granted
  448. Oracle grants You a non-exclusive, non-transferable limited right to use the Software, subject to the terms of this Agreement, for the limited purpose of measuring, monitoring and/or managing Your usage of the Programs. You may allow Your agents and contractors (including, without limitation, outsourcers) to use the Software for this purpose and You are responsible for their compliance with this Agreement in such use. You (including Your agents, contractors and/or outsourcers) may not use the Software for any other purpose.
  449. Ownership and Restrictions
  450. Oracle and Oracle's licensors retain all ownership and intellectual property rights to the Software. The Software may be installed on one or more servers; provided, however, that You may only make one copy of the Software for backup or archival purposes.
  451. Third party technology that may be appropriate or necessary for use with the Software is specified in the Software documentation, notice files or readme files. Such third party technology is licensed to You under the terms of the third party technology license agreement specified in the Software documentation, notice files or readme files and not under the terms of this Agreement.
  452. You may not:
  453. - use the Software for Your own internal data processing or for any commercial or production purposes, or use the Software for any purpose except the purpose stated herein;
  454. - remove or modify any Software markings or any notice of Oracle's or Oracle's licensors' proprietary rights;
  455. - make the Software available in any manner to any third party for use in the third party's business operations, without Oracle's prior written consent;
  456. - use the Software to provide third party training or rent or lease the Software or use the Software for commercial time sharing or service bureau use;
  457. - assign this Agreement or give or transfer the Software or an interest in them to another individual or entity;
  458. - cause or permit reverse engineering (unless required by law for interoperability), disassembly or decompilation of the Software (the foregoing prohibition includes but is not limited to review of data structures or similar materials produced by the Software);
  459. - disclose results of any Software benchmark tests without Oracle's prior written consent;
  460. - use any Oracle name, trademark or logo without Oracle's prior written consent.
  461. Disclaimer of Warranty
  462. ORACLE DOES NOT GUARANTEE THAT THE SOFTWARE WILL PERFORM ERROR-FREE OR UNINTERRUPTED. TO THE EXTENT NOT PROHIBITED BY LAW, THE SOFTWARE IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND AND THERE ARE NO WARRANTIES, EXPRESS OR IMPLIED, OR CONDITIONS, INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF MERCHANTABILITY, NONINFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE, THAT APPLY TO THE SOFTWARE.
  463. No Right to Technical Support
  464. You acknowledge and agree that Oracle's technical support organization will not provide You with technical support for the Software licensed under this Agreement.
  465. End of Agreement
  466. You may terminate this Agreement by destroying all copies of the Software. Oracle has the right to terminate Your right to use the Software at any time upon notice to You, in which case You shall destroy all copies of the Software.
  467. Entire Agreement
  468. You agree that this Agreement is the complete agreement for the Software and supersedes all prior or contemporaneous agreements or representations, written or oral, regarding the Software. If any term of this Agreement is found to be invalid or unenforceable, the remaining provisions will remain effective and such term shall be replaced with a term consistent with the purpose and intent of this Agreement.
  469. Limitation of Liability
  470. IN NO EVENT SHALL ORACLE BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOSS OF PROFITS, REVENUE, DATA OR DATA USE, INCURRED BY YOU OR ANY THIRD PARTY. ORACLE'S ENTIRE LIABILITY FOR DAMAGES ARISING OUT OF OR RELATED TO THIS AGREEMENT, WHETHER IN CONTRACT OR TORT OR OTHERWISE, SHALL IN NO EVENT EXCEED THE GREATER OF ONE THOUSAND U.S. DOLLARS (U.S. $1,000) OR THE LICENSE FEES THAT YOU HAVE PAID TO ORACLE FOR PROGRAMS PURSUANT TO AN ORACLE LICENSE AGREEMENT.
  471. Export
  472. Export laws and regulations of the United States and any other relevant local export laws and regulations apply to the Software. You agree that such export control laws govern Your use of the Software (including technical data) provided under this Agreement, and You agree to comply with all such export laws and regulations (including \"deemed export\" and \"deemed re-export\" regulations). You agree that no data, information, and/or Software (or direct product thereof) will be exported, directly or indirectly, in violation of any export laws, nor will they be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation, or development of missile technology.
  473. Other
  474. 1. This Agreement is governed by the substantive and procedural laws of the State of California, USA. You and Oracle agree to submit to the exclusive jurisdiction of, and venue in, the courts of San Francisco or Santa Clara counties in California in any dispute arising out of or relating to this Agreement.
  475. 2. You may not assign this Agreement or give or transfer the Software or an interest in them to another individual or entity. If You grant a security interest in the Software, the secured party has no right to use or transfer the Software.
  476. 3. Except for actions for breach of Oracle's proprietary rights, no action, regardless of form, arising out of or relating to this Agreement may be brought by either party more than two years after the cause of action has accrued.
  477. 4. The relationship between You and Oracle is that of licensee/licensor. Nothing in this Agreement shall be construed to create a partnership, joint venture, agency, or employment relationship between the parties. The parties agree that they are acting solely as independent contractors hereunder and agree that the parties have no fiduciary duty to one another or any other special or implied duties that are not expressly stated herein. Neither party has any authority to act as agent for, or to incur any obligations on behalf of or in the name of the other.
  478. 5. This Agreement may not be modified and the rights and restrictions may not be altered or waived except in a writing signed by authorized representatives of You and Oracle.
  479. 6. Any notice required under this Agreement shall be provided to the other party in writing.
  480. 7. In order to assist You with the measurement, monitoring or management of Your usage of the Programs, Oracle may have access to and collect Your information, which may include personal information, and data residing on Oracle, customer or third-party systems on which the Software is used and/or to which Oracle is provided access to perform any associated services. Oracle treats such information and data in accordance with the terms of the Oracle Services Privacy Policy and the Oracle Corporate Security Practices, which are available at http://www.oracle.com/contracts, and treats such data as confidential in accordance with the terms of the Oracle License Agreement applicable to the Programs. The Oracle Services Privacy Policy and the Oracle Corporate Security Practices are subject to change at Oracle's discretion; however, Oracle will not materially reduce the level of protection specified in the Oracle Services Privacy Policy or the Oracle Corporate Security Practices in effect at the time the information was collected during the period that Oracle retains such information.
  481. Contact Information
  482. Should You have any questions concerning Your use of the Software or this Agreement, please contact Oracle at: http://www.oracle.com/corporate/contact/
  483. Oracle America, Inc.
  484. 500 Oracle Parkway,
  485. Redwood City, CA 94065
  486. Last updated 1 November 2018
  487. \n" | more
  488. ANSWER=
  489. $ECHO "Accept License Agreement? "
  490. while [ -z "${ANSWER}" ]
  491. do
  492. $ECHO "$1 [y/n/q]: \c" >&2
  493. read ANSWER
  494. #
  495. # Act according to the user's response.
  496. #
  497. case "${ANSWER}" in
  498. Y|y)
  499. return 0 # TRUE
  500. ;;
  501. N|n|Q|q)
  502. exit 1 # FALSE
  503. ;;
  504. #
  505. # An invalid choice was entered, reprompt.
  506. #
  507. *) ANSWER=
  508. ;;
  509. esac
  510. done
  511. }
  512. ################################################################################
  513. #
  514. # print out the search header
  515. #
  516. printMachineInfo() {
  517. NUMIPADDR=0
  518. # print script information
  519. $ECHO "[BEGIN SCRIPT INFO]"
  520. $ECHO "Script Name=$SCRIPT_NAME"
  521. $ECHO "Script Version=$SCRIPT_VERSION"
  522. $ECHO "CT Version=${CT_BUILD_VERSION}"
  523. $ECHO "Script Command options=$SCRIPT_OPTIONS"
  524. $ECHO "Script Command shell=$SCRIPT_SHELL"
  525. $ECHO "Script Command user=$SCRIPT_USER"
  526. $ECHO "Script Start Time=$NOW"
  527. # Get the approximate end time of the script by calling setTime again.
  528. setTime
  529. $ECHO "Script End Time=$NOW"
  530. $ECHO "[END SCRIPT INFO]"
  531. # print system information
  532. $ECHO "[BEGIN SYSTEM INFO]"
  533. $ECHO "Machine Name=$MACHINE_NAME"
  534. $ECHO "Operating System Name=$OS_NAME"
  535. $ECHO "Operating System Release=$RELEASE"
  536. for IP in `cat $ORA_IPADDR_FILE`
  537. do
  538. NUMIPADDR=`expr ${NUMIPADDR} + 1`
  539. $ECHO "System IP Address $NUMIPADDR=$IP"
  540. done
  541. cat ${ORA_PROCESSOR_FILE}
  542. cksum ${ORA_MSG_FILE} | cut -d' ' -f1-2
  543. $ECHO "[END SYSTEM INFO]"
  544. }
  545. setAlias() {
  546. unalias -a
  547. cmd_list="printf
  548. touch
  549. cat
  550. more
  551. grep
  552. egrep
  553. cut
  554. find
  555. uname
  556. awk
  557. sed
  558. sort
  559. uniq
  560. expr
  561. cksum
  562. ps
  563. rm
  564. ls
  565. "
  566. path_list="/bin/
  567. /usr/bin/"
  568. for c in $cmd_list
  569. do
  570. alias_flag=0
  571. for p in $path_list
  572. do
  573. if [ -x ${p}${c} ];
  574. then
  575. alias ${c}=${p}${c}
  576. alias_flag=1
  577. break
  578. fi
  579. done
  580. if [ $alias_flag -eq 0 ] ; then
  581. if [ "${alias_not_found}" = "" ]; then
  582. alias_not_found=$c
  583. else
  584. alias_not_found=${alias_not_found},$c
  585. fi
  586. fi
  587. done
  588. if [ "${alias_not_found}" != "" ]; then
  589. eval 'printf "${alias_not_found} utility(ies) not found. Please contact your assigned consultant"'
  590. exit 600
  591. fi
  592. #alias
  593. }
  594. CredentialValidation() {
  595. if [ $OS_NAME = "Linux" ] && [ $USR_ID != "root" ] ; then
  596. $ECHO "Current OS user $USR_ID does NOT have administrative rights!"
  597. $ECHO "If you are sure that the Current OS user $USR_ID is granted the required privileges, continue with yes(y), otherwise select No(n) and please log on with a OS user with sufficient privileges."
  598. $ECHO "Running Processor Queries with insufficient privileges may have a significant impact on the quality of the data and information collected from this environment. Due to this, Oracle may have to get back to you and ask for additional items, or to execute again."
  599. ANSWER=
  600. while [ -z "${ANSWER}" ]
  601. do
  602. $ECHO "Do you wish to continue anyway? [y/n]: \c" >&2
  603. read ANSWER
  604. case "${ANSWER}" in
  605. Y|y)
  606. return 0 # TRUE
  607. ;;
  608. N|n)
  609. exit 1 # FALSE
  610. ;;
  611. *) ANSWER=
  612. ;;
  613. esac
  614. done
  615. fi
  616. }
  617. ################################################################################
  618. #
  619. #*********************************** MAIN **************************************
  620. #
  621. ################################################################################
  622. umask 022
  623. # command line defaults
  624. SCRIPT_OPTIONS=${*}
  625. LOG_FILE="true"
  626. DEBUG="false"
  627. setAlias
  628. # initialize script values
  629. # set up default os non-specific machine values
  630. OS_NAME=`uname -s`
  631. MACHINE_NAME=`uname -n`
  632. tmp_dir="$1"
  633. USER_ID_CMD=`type whoami >/dev/null 2>/dev/null && echo "Found" || echo "NotFound"`
  634. if [ "$USER_ID_CMD" = "Found" ] ; then
  635. USR_ID=`whoami`
  636. else
  637. if [ "$OS_NAME" = "SunOS" ] ; then
  638. if [ -x /usr/ucb/whoami ] ; then
  639. USR_ID=`/usr/ucb/whoami`
  640. fi
  641. else
  642. USR_ID=$LOGNAME
  643. fi
  644. fi
  645. if [ "$USR_ID" = "root" ] ; then
  646. SCRIPT_USER="ROOT"
  647. else
  648. SCRIPT_USER=$USR_ID
  649. fi
  650. # set up $ECHO
  651. ECHO="echo_print"
  652. # set up $ECHO for debug
  653. ECHO_DEBUG="echo_debug"
  654. # search start time
  655. setTime
  656. SEARCH_START=$NOW
  657. $ECHO "\nScript started at $SEARCH_START"
  658. # see if any Collection* scripts are running, if not then print license.
  659. if [ "${CT_BUILD_VERSION}" = "" ] ;then
  660. STANDALONE=true
  661. beginMsg
  662. CredentialValidation
  663. fi
  664. # set output files
  665. #setOutputFiles ${1}
  666. setOutputFiles
  667. # set current system info
  668. setOSSystemInfo> $ORA_PROCESSOR_FILE 2>&1
  669. # Write machine info to the output file
  670. printMachineInfo > $ORA_MACHINFO_FILE 2>>$UNIXCMDERR
  671. if [ -s $UNIXCMDERR ];
  672. then
  673. cat $UNIXCMDERR >> $ORA_MACHINFO_FILE
  674. fi
  675. # search finish time
  676. setTime
  677. SEARCH_FINISH=$NOW
  678. # if "${STANDALONE}" = "true" then we did not get called from Collection.sh
  679. # so we need to print the following
  680. if [ "${STANDALONE}" = "true" ] ; then
  681. $ECHO "\nScript $SCRIPT_NAME finished at $SEARCH_FINISH"
  682. $ECHO "\nPlease collect the output file generated: $ORA_MACHINFO_FILE"
  683. fi
  684. # delete the tmp files
  685. rm -rf $ORA_IPADDR_FILE $ORA_DEBUG_FILE $ORA_PROCESSOR_FILE $ORA_MSG_FILE $UNIXCMDERR 2>/dev/null
  686. exit 0