Easy Script Analysis – Automating Data Collection

Updated: Sep 21, 2018

The following example of how to automate script performance collection comes from a previous AIX site I (Rob Dearden) worked with. It has three basic scripts, as explained below. Note that I do not run these at the top of the hour, since most people schedule items near the top and bottom of the hour. I have also included a command to collect the environment variables, so this should be run on an application node by the d_<env> user.


  1. I have multiple copies of the same file with different names to take the snapshot (sqlarea_snap_0847.ksh). Each file has a timestamp in the filename to help with organization.

  2. I run a script to schedule the snapshots through atjobs (sqlarea_hourly_submits.ksh). This can also be done via crontab or other scheduling tools. In my example, I created the ability to run a snapshot every two hours and comment out the ones I don’t want at the present time.

  3. The third file is created by the scheduling (second) script, since it creates a file to run the DM2_SQLAREA_ANALYZE command for the appropriate snapshots (snap_analyz_${fl_dt}.ksh, where ${fl_dt} is the current date gathered by the script). This file is created at the end of the hourly submits script.


Sqlarea_snap_0847.ksh

Make one copy for each snapshot to be taken.


/cerner/mgr/<env name>_environment.ksh

fl_dt=`date "+%Y%b%d"`

file_nm=\'snap_${environment}_${fl_dt}_0847.csv\'


$cer_exe/cclora <<!

dm2_sqlarea_gather ${file_nm} go

!


#echo $file_nm >> /tmp/snaplist_${fl_dt}.txt #used for testing

Exit


Sqlarea_hourly_submits.ksh

/cerner/mgr/<env name>_environment.ksh

fl_dt=`date "+%Y%b%d"`

fl_nm1=\'snap_${environment}_${fl_dt}_0047.csv\'

fl_nm2=\'snap_${environment}_${fl_dt}_0247.csv\'

fl_nm3=\'snap_${environment}_${fl_dt}_0447.csv\'

fl_nm4=\'snap_${environment}_${fl_dt}_0647.csv\'

fl_nm5=\'snap_${environment}_${fl_dt}_0847.csv\'

fl_nm6=\'snap_${environment}_${fl_dt}_1047.csv\'

fl_nm7=\'snap_${environment}_${fl_dt}_1247.csv\'

fl_nm8=\'snap_${environment}_${fl_dt}_1447.csv\'

fl_nm9=\'snap_${environment}_${fl_dt}_1647.csv\'

fl_nm10=\'snap_${environment}_${fl_dt}_1847.csv\'

fl_nm11=\'snap_${environment}_${fl_dt}_2047.csv\'

fl_nm12=\'snap_${environment}_${fl_dt}_2247.csv\'


#at -f /home/<domain username>/scripts/sqlarea_snap_0047.ksh 00:47

#at -f /home/<domain username>/scripts/sqlarea_snap_0247.ksh 02:47

#at -f /home/<domain username>/scripts/sqlarea_snap_0447.ksh 04:47

#at -f /home/<domain username>/scripts/sqlarea_snap_0647.ksh 06:47

at -f /home/<domain username>/scripts/sqlarea_snap_0847.ksh 08:47

at -f /home/<domain username>/scripts/sqlarea_snap_1047.ksh 10:47

at -f /home/<domain username>/scripts/sqlarea_snap_1247.ksh 12:47

at -f /home/<domain username>/scripts/sqlarea_snap_1447.ksh 14:47

at -f /home/<domain username>/scripts/sqlarea_snap_1647.ksh 16:47

#at -f /home/<domain username>/scripts/sqlarea_snap_1847.ksh 18:47

#at -f /home/<domain username>/scripts/sqlarea_snap_2047.ksh 20:47

#at -f /home/<domain username>/scripts/sqlarea_snap_2247.ksh 22:47


Snap_analyz_${fl_dt}.ksh

echo "#!/usr/bin/ksh" > /tmp/snap_analyze_${fl_dt}.ksh

echo "/cerner/mgr/<env_name>_environment.ksh" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "chmod 775 $CCLUSERDIR/snap_${environment}_${fl_dt}_*.csv" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "$cer_exe/cclora <<!" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "dm2_sqlarea_analyze ${fl_nm1},${fl_nm2},'snp_anlz_${environment}_${fl_dt}_0047_0247.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "dm2_sqlarea_analyze ${fl_nm2},${fl_nm3},'snp_anlz_${environment}_${fl_dt}_0247_0447.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "dm2_sqlarea_analyze ${fl_nm3},${fl_nm4},'snp_anlz_${environment}_${fl_dt}_0447_0647.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh


echo "dm2_sqlarea_analyze ${fl_nm4},${fl_nm5},'snp_anlz_${environment}_${fl_dt}_0647_0847.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh


echo "dm2_sqlarea_analyze ${fl_nm5},${fl_nm6},'snp_anlz_${environment}_${fl_dt}_0847_1047.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh


echo "dm2_sqlarea_analyze ${fl_nm6},${fl_nm7},'snp_anlz_${environment}_${fl_dt}_1047_1247.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh


echo "dm2_sqlarea_analyze ${fl_nm7},${fl_nm8},'snp_anlz_${environment}_${fl_dt}_1247_1447.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh


echo "dm2_sqlarea_analyze ${fl_nm8},${fl_nm9},'snp_anlz_${environment}_${fl_dt}_1447_1647.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh


echo "dm2_sqlarea_analyze ${fl_nm9},${fl_nm10},'snp_anlz_${environment}_${fl_dt}_1647_1847.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "dm2_sqlarea_analyze ${fl_nm10},${fl_nm11},'snp_anlz_${environment}_${fl_dt}_1847_2047.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "dm2_sqlarea_analyze ${fl_nm11},${fl_nm12},'snp_anlz_${environment}_${fl_dt}_2047_2247.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "dm2_sqlarea_analyze ${fl_nm5},${fl_nm9},'snp_anlz_${environment}_${fl_dt}_0847_1647.csv' go" >> /tmp/snap_analyze_${fl_dt}.ksh


echo "!" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "" >> /tmp/snap_analyze_${fl_dt}.ksh

echo "exit" >> /tmp/snap_analyze_${fl_dt}.ksh

chmod 775 /tmp/snap_analyze_${fl_dt}.ksh

at -f /tmp/snap_analyze_${fl_dt}.ksh 23:35


exit


Please remember to check file system space if you run these scripts, since taking up too much space may create other issues. Although the data is collected and analyzed automatically, you will have to pull them from the $CCLUSERDIR manually.

  • Grey LinkedIn Icon
  • Grey Twitter Icon
  • Grey Facebook Icon
  • CernerUsersIcon

4500 West 89th Street

Prairie Village, KS 66207

Phone: 913.649.1024

© 1995 - 2020 Softek Solutions, Inc.

All rights reserved.

Cerner®, Cerner Millennium®, and Cerner Smart Hospital® are all registered trademarks of Cerner Corporation, or its subsidiaries or divisions, registered in the US and other countries, and Softek makes no claim in or to the same. Cerner Corporation is not affiliated with Softek and does not endorse or sponsor our products or services.