1.  As <ROOT_USER>, log in to Node 1 and cd to the “/tmp” directory.

# cd /tmp

2.  Use “vi” or editor of your choice, to create the “osw_capture” script as shown below.

osw_capture:

#!/bin/bash
# The osw_capture script enables OSWatcher data collection for selected hours in 24 hour
# time period.
# $1 is the timestamp (in YY.MM.DD format) on the log file(s).
# $2 is the first two digits of the starting hour: acceptable values 00 through 23.
# $3 is the first two digits of the ending hour: acceptable values 00 through 23.
# $4 is the output directory.logdir=$4
mkdir -p $logdir
rm -f $logdir/*zip
date=$(date +%d_%m_%y)
for i in $(seq -w $2 $3); do
find /opt/oracle/oswbb/archive -name “$(hostname -f)_*_$1.${i}00.dat*” -exec zip $logdir/osw_$(hostname -s)_${date}.zip {} \;
done

3.  Save script as “osw_capture” and give the script execute permission.

# chmod +x osw_capture

4. When run, the “osw_capture” script takes 4 arguments:

  • Timestamp on the log file(s) expressed in YY.MM.DD format.
  • First two digits of the log collection starting hour – acceptable values of 00 through 23 where 00 denotes 12 AM and where 23 denotes 11 PM.
  • First two digits of the log collection ending hour – acceptable values of 00 through 23 where 00 denotes 12 AM and where 23 denotes 11 PM.
  • Output directory for holding the results.

5. Run the script with the arguments specific to your collection. For example to collect logs on a single host for July 2, 2019 from 7AM to 12 PM with the output being placed in the /u03/osw_capture directory, execute as shown below:

./<PATH>/osw_capture 19.07.02 07 12 /u03/osw_capture 

6. To capture the logs on all hosts:

a) Copy the file to all hosts and to a staging directory “/tmp”:

# dcli -C -f /tmp/osw_capture -d /tmp/osw_capture 

b) Verify:

# dcli -C md5sum /tmp/osw_capture 

c) Run the script to collect logs on all hosts and place the zip file in the output directory:

# dcli -C “/tmp/osw_capture 19.07.02 07 12 /u03/osw_capture” 

d) Verify, in this case the output is in a zip file under /u03/osw_capture:

# dcli -C ls -l /u03/osw_capture/

<PRIVATE_IP_HOST1>: total 14156
<PRIVATE_IP_HOST1>: -rw-r–r– 1 root root 14491001 Jul 2 21:02 osw_<HOSTNAME1>_02_07_19.zip

<PRIVATE_IP_HOSTn>: total 11808
<PRIVATE_IP_HOSTn>: -rw-r–r– 1 root root 12089627 Jul 2 21:02 osw_<HOSTNAMEn>_02_07_19.zip

Recent Posts

Start typing and press Enter to search