2396l1.orig100640 1061 330 4512 6575571574 11137 0ustar mlrljedit 1 #!/bin/bash 2 # $Header: /var/log/sar/RCS/sa,v 1.2 2025/06/19 03:59:42 dgavin Exp $ 3 # 4 # $Log: sa,v $ 5 # Revision 1.2 2025/06/19 03:59:42 dgavin 6 # cleanup 7 # dgavin 8 # 9 # Revision 1.1 2025/06/12 03:34:56 dgavin 10 # Initial revision 11 # 12 # 13 cd /var/log/sar/data 14 TIME=`date +"%H%M"` 15 DATE=`date +"%b%d.%y"` 16 # 17 # Collect the memory and swap stats 18 awk ' 19 /^Mem: / { 20 printf("'${TIME}' %s\n",substr($0,5)) >>"mem.'${DATE}'"; 21 } 22 /^Swap: / { 23 printf("'${TIME}' %s\n",substr($0,6)) >>"swap.'${DATE}'"; 24 } 25 ' /proc/meminfo 26 # 27 # collect the active network interface stats. If ppp hasn't been used 28 # There won't be any ppp line. 29 awk ' 30 /^ eth/ { 31 printf("'${TIME}' %s\n",substr($0,8)) >>substr($0,3,4)".'${DATE}'"; 32 } 33 /^ ppp/ { 34 printf("'${TIME}' %s\n",substr($0,8)) >>substr($0,3,4)".'${DATE}'"; 35 } 36 ' /proc/net/dev 37 # 38 # Collect CPU, disk I/O, paging, interrupts, context switching, and processes 39 awk ' 40 /^cpu/ { 41 printf("'${TIME}' %s\n",substr($0,6)) >>"cpu.'${DATE}'"; 42 } 43 /^disk / { 44 d=split($0,disk); 45 } 46 /^disk_rio / { 47 d=split($0,disk_rio); 48 } 49 /^disk_wio / { 50 d=split($0,disk_wio); 51 } 52 /^disk_rblk / { 53 d=split($0,disk_rblk); 54 } 55 /^disk_wblk / { 56 d=split($0,disk_wblk); 57 printf("'${TIME}'") >>"disk.'${DATE}'"; 58 for (r = 2; r <= d ; r ++ ) { 59 printf(" %s %s %s %s %s", 60 disk[r],disk_rio[r],disk_wio[r], 61 disk_rblk[r],disk_wblk[r]) >>"disk.'${DATE}'";} 62 printf("\n") >>"disk.'${DATE}'"; 63 } 64 /^page/ { 65 printf("'${TIME}' %s\n",substr($0,6)) >>"page.'${DATE}'"; 66 } 67 /^swap/ { 68 printf("'${TIME}' %s\n",substr($0,6)) >>"swap.'${DATE}'"; 69 } 70 /^intr/ { 71 printf("'${TIME}' %s\n",substr($0,6)) >>"intr.'${DATE}'"; 72 } 73 /^ctxt/ { 74 printf("'${TIME}' %s\n",substr($0,6)) >>"ctxt.'${DATE}'"; 75 } 76 /^processes/ { 77 printf("'${TIME}' %s\n",$2) >>"processes.'${DATE}'"; 78 } 79 ' /proc/stat 2396l2.orig100640 1061 330 15444 6575571565 11166 0ustar mlrljedit 1 #!/bin/bash 2 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 3 # $Header: /var/log/sar/RCS/cpu,v 1.4 2025/06/19 04:31:05 dgavin Exp dgavin $ 4 # 5 # cpu - display cpu utilization 6 # 7 # input - /var/log/sar/data/cpu.Mondd.yy 8 # output- chart showing time spent in user/sys/nice states 9 # 10 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 11 # 12 trap '/bin/rm /tmp/gnuplot.cpu.* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM 13 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 14 # 15 # Function definitions 16 # 17 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 18 function checkForEmpty { 19 if [ ! -s ${1} ] ; then 20 echo "0 0" >${1} 21 fi 22 return 23 } 24 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 25 # 26 # Mainline code 27 # 28 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 29 # 30 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 31 # 32 # Variable initialization 33 # 34 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 35 HARDCOPY="" 36 GHOSTVIEW="" 37 CMDNAME=`basename $0` 38 # 39 HELP="${CMDNAME} generates X11 or hardcopy graph of cpu utilization." 40 USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] 41 -D turns on execution tracing 42 -H displays help info and exits 43 -L displays RCS log and exits 44 -V display Revision info and exits 45 -h displays help info and exits 46 -P Print without display 47 -p display and offer print option 48 49 MonDD.YY - day to work with, defaults to today 50 i.e. Jun12.97 -the year will default to this year 51 52 " 53 # 54 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 55 # 56 # Parse options 57 # 58 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# 59 # 60 while getopts DHLVhPp c ; do 61 case ${c} in 62 h|H) echo -e "\n${HELP}\n\n${USAGE}\n" 63 exit 1 64 ;; 65 p) HARDCOPY="YES" 66 GHOSTVIEW="YES" 67 ;; 68 P) HARDCOPY="YES" 69 GHOSTVIEW="" 70 ;; 71 D) echo "DEBUG ON" 72 set -x 73 DEBUG="yes" 74 trap '' SIGHUP SIGINT SIGQUIT SIGTERM 75 ;; 76 L) echo ' 77 $Log: $ 78 ' 79 exit 1 80 ;; 81 V) echo '$Revision: $' 82 exit 1 83 ;; 84 ?) echo -e "\n${USAGE}\n" 85 exit 3 86 ;; 87 esac 88 done 89 # re-align the positional parameters as $1, $2,... 90 shift `expr ${OPTIND} - 1` 91 # 92 cd /var/log/sar/data 93 if [ $# -eq 0 ] ; then 94 FN="cpu.`date +%b%d.%y`" 95 else 96 l=`echo ${1} | wc -c` 97 l=`expr ${l} + 0` 98 case ${l} in 99 6) FN="cpu.${1}.`date +%y`";; 100 9) FN="cpu.${1}";; 101 *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" 102 exit 103 ;; 104 esac 105 fi 106 if [ ! -f ${FN} ] ; then 107 echo "No such file: ${FN}" 108 exit 109 fi 110 if [ ! -r ${FN} ] ; then 111 echo "File not readable: ${FN}" 112 exit 113 fi 114 if [ ! -s ${FN} ] ; then 115 echo "File empty: ${FN}" 116 exit 117 fi 118 # 119 # user nice system idle 120 #0940 8065221 3719924 2017086 53289599 121 awk ' 122 BEGIN{} 123 { 124 if (NR == 1) { 125 old_user = $2; 126 old_nice = $3; 127 old_sys = $4; 128 old_idle = $5; 129 } else { 130 mm=substr($1,3,2) * .016; 131 tim=substr($1,1,2)+mm; 132 if ( old_user > $2 ) { 133 user = 0; 134 nice = 0; 135 sys = 0; 136 idle = 0; 137 reboot = 100; 138 } else { 139 user = $2 - old_user; 140 nice = $3 - old_nice; 141 sys = $4 - old_sys; 142 idle = $5 - old_idle; 143 reboot = -1; 144 } 145 total = user + nice + sys + idle ; 146 if ( user == 0 ) { puser = 0; } else { puser= (user / total) * 100;} 147 if ( sys == 0 ) { psys = 0; } else { psys = (sys / total) * 100;} 148 if ( nice == 0 ) { pnice = 0; } else { pnice= (nice / total) * 100;} 149 if ( idle == 0 ) { pidle = 0; } else { pidle= (idle / total) * 100;} 150 151 printf("%5.2f %7.2f %7.2f %7.2f %7.2f %d\n", 152 tim, pidle+puser+psys+pnice, 153 puser+psys+pnice, psys+pnice, pnice,reboot) >"/tmp/gnuplot.cpu"; 154 155 old_user = $2; 156 old_nice = $3; 157 old_sys = $4; 158 old_idle = $5; 159 } 160 } 161 END{}' ${FN} 162 # 163 # Get system name and date of report into variables... 164 system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` 165 sysdate=`echo ${FN} | cut -c 5-` 166 /bin/echo "Generating plot for $system $sysdate" 167 # 168 # Set gnuplot variables as needed 169 # 170 if [ -z ${HARDCOPY} ]; then 171 TERMINAL="set terminal X11" 172 PAUSE="pause 10" 173 YLABEL="" 174 else 175 TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 176 set output "/tmp/gnuplot.cpu.ps"' 177 PAUSE="" 178 YLABEL='set ylabel "Nice|Sys|User|Idle"' 179 fi 180 # 181 # Generate the plots 182 # 183 gnuplot </dev/null 217 fi 218 # clean up the junk 219 if [ ${DEBUG}. = "." ]; then 220 rm /tmp/gnuplot.cpu 2>/dev/null 221 fi 2396l2.txt100640 1061 330 12011 6602037571 11011 0ustar mlrljeditThe graphing script is in Listing 2, 2396l2.orig. A breakdown of the major parts of this script follows: Line 12: trap command to remove working files if the user hits break Lines 18 - 23: A function that will check if a file exists and has a file size greater than zero Lines 35 - 52: Some variable definitions and help/usage information Lines 60 - 90: Parsing the options, set switches or display information as requested. I find it helpful to include options for help (-h or -H), RCS log information (-L) and version number (-V) and debugging (-D); so I use a standard template for most of my scripts with these basic options, then add appropriate options for the job at hand. For this script the additional options are: print without display (-P), display the chart with ghostview, then offer the option of printing or not (-p). Lines 92: Change the current directory to the one where the data files are collected. Lines 93 - 105: Check for a passed file name; if no file name was passed default to constructing the name for today's data file. Lines 106 - 117: Validate the file name, making sure that the file exists, is readable and is non-zero in length. Lines 121 - 161: Run the data file through an in-stream awk script, converting the timestamp to hours and hundredths so that the plot will have the data distributed evenly across the scale for each hour. If we left the minutes scaled to 60, the data points would be clustered within the first .6 of the hour. @bb: If we find a value for user time that is lower than the prior observation, it is either a reboot or the counter rolled over. Since it is usually a reboot, I adjust the saved values to zero to reflect the counter reset and set the reboot data point to 100 to generate a reboot indication on the chart. On normal observations the reboot data point is set to -1, so the plotted point will fall outside of the chart and not appear. @bb: Calculate the gain for each counter and divide by the number of seconds since the last records and write the values out to a temporary file with the converted timestamp. Save the value of each variable for use with the next record. Line 164: Get the name of the host. I'm assuming that this is the machine that the data was generated on. This also assumes that the data being charted is for the machine it is being charted on. If I were to go with a central data collection and analysis system, I would embed the originating host name in the file name. Line 165: Clip the date out of the file name of the input for use in chart titles. Lines 166: Display a progress message, showing the system and date. Lines 170 - 179: Define the gnuplot script line that sets the output device. If the user requested hardcopy, set the "set terminal" and "set output" for PostScript output; otherwise, set the terminal as X11 for display in an X11 window. We also "set label" for the Y axis for hardcopy and leave it null for X11, as it gets displayed incorrectly on the display. The X11 display gets a pause of ten seconds to allow some time to view the chart. Without the pause the graphic display is cleared too quickly to be seen. Line 183: Start echoing the in-stream script as stdin to the gnuplot program to generate the chart. Line 184: Set the previously defined "set terminal" command. Lines 185 - 187: Turn on plotting with lines, turn off the grid overlay, and turn on the key legend display for labeling the lines. Line 188: Set the chart title, using the system name and the date from the input file name. Lines 189 - 191: Set up the X-axis variables: label, range of values and range of tic marks.The x scale is used for the time of day and is labeled as such, from 0 to 24 with tic marks for every hour. Lines 192 - 194: Set up the Y-axis variables: label, range of values and range of tic marks.The Y scale is for the percentages and as such runs from 0 to 100, but to allow room for the legends in the upper right corner the scale is set to 0 to 140, with tic marks every 10 points from 0 to 100. Lines 195 - 200: Define the plots, input file, columns to use, title for the legend and plot type. The reboot plot is done with points rather than a line, as it refers to events rather than trends (we hope). Lines 201 - 202: Pause, if appropriate, and quit. Line 203: The EOF marks the end of the input stream. Lines 204 -217: If hardcopy and no display before printing is requested, go right to lpr. If a display before printing is requested, send the PostScript file to Ghostview, then prompt for whether to print or not. Clean up the PostScript file when done. Line 218 - 221: I have found that I want to look at the work files when I'm debugging, so If I set the debug switch (-D), keep the data file; otherwise, trash it. @b:The other scripts work on the same basic pattern with some additional twists for the scripts for disks and interrupts, as I try not to generate graphs for non-existent disks or unused interrupts. I've pulled the descriptive text for the used interrupts out of the /proc/interrupts file to add a little more detail to the charts. cpu100750 1061 330 12074 6364537621 10142 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/cpu,v 1.4 2025/06/19 04:31:05 dgavin Exp dgavin $ # # cpu - display cpu utilization # # input - /var/log/sar/data/cpu.Mondd.yy # output- chart showing time spent in user/sys/nice states # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.cpu.* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -s ${1} ] ; then echo "0 0" >${1} fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of cpu utilization." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" set -x DEBUG="yes" trap '' SIGHUP SIGINT SIGQUIT SIGTERM ;; L) echo ' $Log: $ ' exit 1 ;; V) echo '$Revision: $' exit 1 ;; ?) echo -e "\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then FN="cpu.`date +%b%d.%y`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) FN="cpu.${1}.`date +%y`";; 9) FN="cpu.${1}";; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac fi if [ ! -f ${FN} ] ; then echo "No such file: ${FN}" exit fi if [ ! -r ${FN} ] ; then echo "File not readable: ${FN}" exit fi if [ ! -s ${FN} ] ; then echo "File empty: ${FN}" exit fi # # user nice system idle #0940 8065221 3719924 2017086 53289599 awk ' BEGIN{} { if (NR == 1) { old_user = $2; old_nice = $3; old_sys = $4; old_idle = $5; } else { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; if ( old_user > $2 ) { user = 0; nice = 0; sys = 0; idle = 0; reboot = 100; } else { user = $2 - old_user; nice = $3 - old_nice; sys = $4 - old_sys; idle = $5 - old_idle; reboot = -1; } total = user + nice + sys + idle ; if ( user == 0 ) { puser = 0; } else { puser= (user / total) * 100;} if ( sys == 0 ) { psys = 0; } else { psys = (sys / total) * 100;} if ( nice == 0 ) { pnice = 0; } else { pnice= (nice / total) * 100;} if ( idle == 0 ) { pidle = 0; } else { pidle= (idle / total) * 100;} printf("%5.2f %7.2f %7.2f %7.2f %7.2f %d\n", tim, pidle+puser+psys+pnice, puser+psys+pnice, psys+pnice, pnice,reboot) >"/tmp/gnuplot.cpu"; old_user = $2; old_nice = $3; old_sys = $4; old_idle = $5; } } END{}' ${FN} # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` sysdate=`echo ${FN} | cut -c 5-` /bin/echo "Generating plot for $system $sysdate" # # Set gnuplot variables as needed # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.cpu.ps"' PAUSE="" YLABEL='set ylabel "Nice|Sys|User|Idle"' fi # # Generate the plots # gnuplot </dev/null fi # clean up the junk if [ ${DEBUG}. = "." ]; then rm /tmp/gnuplot.cpu 2>/dev/null fi crontab100750 1061 330 173 6350301421 10716 0ustar mlrljedit0-55/5 * * * * exec /var/log/sar/bin/sa 0 0 * * * exec /usr/bin/find /var/log/sar/data/ -mtime +14 -exec /bin/rm -f {} \; ctxt100550 1061 330 11235 6364502534 10324 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/ctxt,v 1.4 2025/07/20 21:38:14 dgavin Exp $ # # ctxt - display context switching activity # # input - /var/log/sar/data/ctxt.Mondd.yy # output- chart showing context switches per second # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.ctxt* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of context switching." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" set -x DEBUG="yes" trap '' SIGHUP SIGINT SIGQUIT SIGTERM ;; L) echo ' $Log: ctxt,v $ Revision 1.4 2025/07/20 21:38:14 dgavin removed psnup - single chart dgavin Revision 1.3 2025/06/19 05:26:36 dgavin cleanup dgavin Revision 1.2 2025/06/12 03:43:54 dgavin removed extra log area Revision 1.1 2025/06/12 03:36:35 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.4 $' exit 1 ;; ?) echo "\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then FN="ctxt.`date +%b%d.%y`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) FN="ctxt.${1}.`date +%y`";; 9) FN="ctxt.${1}";; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac fi if [ ! -f ${FN} ] ; then echo "No such file: ${FN}" exit fi if [ ! -r ${FN} ] ; then echo "File not readable: ${FN}" exit fi if [ ! -s ${FN} ] ; then echo "File empty: ${FN}" exit fi # #0940 8065221 #0945 8068341 #0950 8071218 #0955 8073893 #1000 8076925 awk ' BEGIN{} { if (NR == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; old_time = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); old_cs = $2; } else { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; now = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); delta_tim = now - old_time; if(delta_tim < 1 ) { delta_tim = 1; } if ( old_cs > $2 ) { old_cs = 0; } cs = ($2 - old_cs) / delta_tim; printf("%5.2f %7.2f\n",tim, cs ) >"/tmp/gnuplot.ctxt"; old_cs = $2; } } END{}' ${FN} # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` #sysdate=`/bin/date` sysdate=`echo ${FN} | cut -c 6-` echo "Generating plot for $system $sysdate" # # # Start building the gnuplot.ctxt.script # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.ctxt.ps"' PAUSE="" YLABEL='set ylabel "Context Switches per second"' fi # # Generate the plots # gnuplot </dev/null fi exit disk100750 1061 330 14215 6364503220 10270 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/disk,v 1.3 2025/06/19 05:26:48 dgavin Exp dgavin $ # # disk - display disk I/O # # input - /var/log/sar/data/disk.Mondd.yy # output- chart for each active disk showing r/w and block r/w per second # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.disk* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of disk I/O." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" set -x DEBUG="yes" trap '' SIGHUP SIGINT SIGQUIT SIGTERM ;; L) echo ' $Log: disk,v $ Revision 1.3 2025/06/19 05:26:48 dgavin cleanup dgavin Revision 1.2 2025/06/12 03:44:37 dgavin removed extra log area Revision 1.1 2025/06/12 03:38:53 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.3 $' exit 1 ;; ?) echo -e "\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/adm/sar/data if [ $# -eq 0 ] ; then FN="disk.`date +%b%d.%y`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) FN="disk.${1}.`date +%y`";; 9) FN="disk.${1}";; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac fi if [ ! -f ${FN} ] ; then echo "No such file: ${FN}" exit fi if [ ! -r ${FN} ] ; then echo "File not readable: ${FN}" exit fi if [ ! -s ${FN} ] ; then echo "File empty: ${FN}" exit fi # tot - 0 rio wio rblk wblk 1 2 3 #0000 1136068 522777 613291 2781276 1551452 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #0005 1136517 523032 613485 2782710 1552002 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #0010 1139791 524476 615315 2791322 1556448 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 rm /tmp/gnuplot.disk* 2>/dev/null awk ' BEGIN{} { if (NR == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; old_time = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); tok = split(substr($0,6),old_array); disks = int(tok / 5); printf("%d disks in database\n",disks); } else { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; now = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); delta_tim = now - old_time; if(delta_tim < 1 ) { delta_tim = 1; } if ( array[1] > old_array[1] ) { for (i=1;i<=tok;i++){ old_array[i] = 0; } } else { x = split(substr($0,6),array); for ( d = 0; d < disks ; d++ ) { printf("%5.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n", tim, (array[(d*5)+1]-old_array[(d*5)+1])/delta_tim, (array[(d*5)+2]-old_array[(d*5)+2])/delta_tim, (array[(d*5)+3]-old_array[(d*5)+3])/delta_tim, (array[(d*5)+4]-old_array[(d*5)+4])/delta_tim, (array[(d*5)+5]-old_array[(d*5)+5])/delta_tim)>"/tmp/gnuplot.disk."d; } } for (i=1;i<=tok;i++){ old_array[i] = array[i]; } old_time = now; } } END{ for ( d = 0 ; d < disks ; d++){ if ( old_array[(d*5)+1] == 0 ) { system("/bin/rm /tmp/gnuplot.disk."d); } } }' ${FN} DISKS=`ls -l /tmp/gnuplot.disk.[0-9]* | wc -l` echo "${DISKS} with non-zero data to be processed" # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` #sysdate=`/bin/date` sysdate=`echo ${FN} | cut -c 6-` echo "Generating plot for $system $sysdate" # # # Start building the /tmp/gnuplot.disk.script # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.disk.ps"' PAUSE="" YLABEL='set ylabel "Disk I/O"' fi cat </tmp/gnuplot.disk.script ${TERMINAL} set data style lines set nogrid set key set xlabel "Time of Day" set xrange [00:24] set xtics 0,1,24 ${YLABEL} set autoscale y EOF D=0 while [ ${D} -lt ${DISKS} ] ; do cat <>/tmp/gnuplot.disk.script set title "Disk I/O per Second - Disk # ${D} - $system On $sysdate" plot \ "/tmp/gnuplot.disk.${D}" u 1:2 t "Total i/o per second" with line 1,\ "/tmp/gnuplot.disk.${D}" u 1:3 t "Total reads per second" with line 2,\ "/tmp/gnuplot.disk.${D}" u 1:4 t "Total writes per second" with line 3,\ "/tmp/gnuplot.disk.${D}" u 1:5 t "Total blocks reads per second" with line 4,\ "/tmp/gnuplot.disk.${D}" u 1:6 t "Total blocks writes per second" with line 5 ${PAUSE} EOF D=`expr ${D} + 1` done echo "quit" >>/tmp/gnuplot.disk.script # # Generate the plots # gnuplot /tmp/gnuplot.disk.script # if [ .${HARDCOPY} = ".YES" ]; then if [ -z ${GHOSTVIEW} ] ; then lpr /tmp/gnuplot.disk.ps else ghostview -upsidedown -magstep 3 /tmp/gnuplot.disk.ps echo "Print ?" read ans if [ ${ans} = "y" ] ; then lpr /tmp/gnuplot.disk.ps fi fi fi # clean up the junk if [ ${DEBUG}. = "." ]; then rm /tmp/gnuplot.disk* 2>/dev/null fi exit eth100750 1061 330 16233 6364504234 10126 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/eth,v 1.1 2025/06/19 05:27:52 dgavin Exp dgavin $ # # eth - display ethernet interface activity # # input - /var/log/sar/data/eth[0-9].Mondd.yy # output- 3 charts for each active ethernet interface; # transmit/receive packets per second # receive errors # tranmit errors # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.eth* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of ethernet interface activity." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" set -x DEBUG="yes" trap '' SIGHUP SIGINT SIGQUIT SIGTERM ;; L) echo ' $Log: eth,v $ Revision 1.1 2025/06/19 05:27:52 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.1 $' exit 1 ;; ?) echo -e "\n${HELP}\n\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then arg="eth[0-9]"."`date +"%b%d.%y"`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) DAT=${1}".`date +%y`";; 9) DAT=${1};; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac arg="eth[0-9].${DAT}" fi LIST=`/bin/ls -1 ${arg} 2>/dev/null ` n=`echo ${LIST} | tr " " "\n" | wc -l ` # #Inter-| Receive | Transmit # face |packets errs drop fifo frame|packets errs drop fifo colls carrier # eth0:1072737 1 1 0 1 360837 0 0 0 7049 1 #1618 1069300 1 1 0 1 359772 0 0 0 7049 1 #1620 1069406 1 1 0 1 359801 0 0 0 7049 1 DEVLIST="" for FN in ${LIST} ; do DEVICE=`echo ${FN} | cut -c1-4 | tr "[A-Z]" "[a-z]"` DEVLIST="${DEVLIST} ${DEVICE}" awk ' BEGIN{} { if (NR == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; old_time = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); old_rpackets = $2; old_rerrors = $3; old_rdrop = $4; old_rfifo = $5; old_rframe = $6; old_tpackets = $7; old_terrors = $8; old_tdrop = $9; old_tfifo = $10; old_tcolls = $11; old_tcarrier = $12; } else { if(NF == 12 ) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; now = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); delta_tim = now - old_time; if ( old_rpackets > $2 ) { rpackets = 0; rerrors = 0; rdrop = 0; rfifo = 0; rframe = 0; tpackets = 0; terrors = 0; tdrop = 0; tfifo = 0; tcolls = 0; tcarrier = 0; } else { rpackets = $2 - old_rpackets; rerrors = $3 - old_rerrors; rdrop = $4 - old_rdrop; rfifo = $5 - old_rfifo; rframe = $6 - old_rframe; tpackets = $7 - old_tpackets; terrors = $8 - old_terrors; tdrop = $9 - old_tdrop; tfifo = $10 - old_tfifo; tcolls = $11 - old_tcolls; tcarrier = $12 - old_tcarrier; } printf("%5.2f %7.2f %d %d %d %d %7.2f %d %d %d %d %d\n",tim, rpackets/delta_tim,rerrors, rdrop, rfifo, rframe, tpackets/delta_tim, terrors, tdrop, tfifo, tcolls, tcarrier) >"/tmp/gnuplot.'${DEVICE}'"; old_time = now; old_rpackets = $2; old_rerrors = $3; old_rdrop = $4; old_rfifo = $5; old_rframe = $6; old_tpackets = $7; old_terrors = $8; old_tdrop = $9; old_tfifo = $10; old_tcolls = $11; old_tcarrier = $12; } } } END{}' ${FN} done # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` sysdate=`echo ${FN} | cut -c 6-` echo "Generating plot for $system $sysdate" # # # Start building the /tmp/gnuplot.eth.script # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL1="" YLABEL2="" YLABEL3="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.eth.ps"' PAUSE="" YLABEL1='set ylabel "Transmit | Receive"' YLABEL2='set ylabel "Receive Errors"' YLABEL3='set ylabel "Transmit Errors"' fi cat </tmp/gnuplot.eth.script ${TERMINAL} set data style lines set nogrid set key set xlabel "Time of Day" set xrange [00:24] set xtics 0,1,24 EOF for DEV in ${DEVLIST} ; do echo "Processing plots for ${DEV} $system $sysdate" cat <>/tmp/gnuplot.eth.script set title "Network Packets per second - ${DEV} $system On $sysdate" ${YLABEL1} set autoscale y plot \ "/tmp/gnuplot.${DEV}" using 1:2 title "Received" with line 1, \ "/tmp/gnuplot.${DEV}" using 1:7 title "Transmitted" with line 2 ${PAUSE} set title "Network Receive Errors - ${DEV} $system On $sysdate" ${YLABEL2} set autoscale y plot "/tmp/gnuplot.${DEV}" using 1:3 title "Total Errors" with line 1, \ "/tmp/gnuplot.${DEV}" using 1:4 title "Drop Errors" with line 2, \ "/tmp/gnuplot.${DEV}" using 1:5 title "Fifo Errors" with line 3, \ "/tmp/gnuplot.${DEV}" using 1:6 title "Frame Errors" with line 4 ${PAUSE} set title "Network Transmit Errors - ${DEV} $system On $sysdate" ${YLABEL2} set autoscale y plot "/tmp/gnuplot.${DEV}" using 1:8 title "Total Errors" with line 1, \ "/tmp/gnuplot.${DEV}" using 1:9 title "Drop Errors" with line 2, \ "/tmp/gnuplot.${DEV}" using 1:10 title "Fifo Errors" with line 3, \ "/tmp/gnuplot.${DEV}" using 1:11 title "Collisions" with line 4, \ "/tmp/gnuplot.${DEV}" using 1:12 title "Carrier Loss" with line 5 ${PAUSE} EOF # done # echo "quit" >>/tmp/gnuplot.eth.script # # Generate the plots # gnuplot /tmp/gnuplot.eth.script # if [ .${HARDCOPY} = ".YES" ]; then if [ -z ${GHOSTVIEW} ] ; then lpr /tmp/gnuplot.eth.ps else ghostview -upsidedown -magstep 3 /tmp/gnuplot.eth.ps echo "Print ?" read ans if [ ${ans} = "y" ] ; then lpr /tmp/gnuplot.eth.ps fi fi fi # clean up the junk if [ ${DEBUG}. = "." ]; then rm /tmp/gnuplot.eth* 2>/dev/null fi exit intr100550 1061 330 14271 6352141570 10315 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/intr,v 1.4 2025/06/19 05:28:18 dgavin Exp $ # # intr - display interrupt activity # # NOTE: Some DEC AXP systems have a lot more than 16 interrupts! # This script assumes interrupts 0 - 15 only. # # input - /var/log/sar/data/intr.Mondd.yy # output- chart for each active interrupt showing interrupts per second # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.intr* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } function minMax { MINMAX=`awk ' BEGIN{min=0;max=0;} { if ( $2 > max) { max = $2;} if ( $2 < min) { min = $2;} } END{ printf("%d %d\n",min,max);}' $1` return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of interrupt activity." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" set -x DEBUG="yes" trap '' SIGHUP SIGINT SIGQUIT SIGTERM ;; L) echo ' $Log: intr,v $ Revision 1.4 2025/06/19 05:28:18 dgavin cleanup dgavin Revision 1.3 2025/06/12 03:52:08 dgavin added comment about Alpha interrupts Revision 1.2 2025/06/12 03:45:10 dgavin removed extra log area Revision 1.1 2025/06/12 03:39:28 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.4 $' exit 1 ;; ?) echo -e "\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then FN="intr.`date +%b%d.%y`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) FN="intr.${1}.`date +%y`";; 9) FN="intr.${1}";; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac fi if [ ! -f ${FN} ] ; then echo "No such file: ${FN}" exit fi if [ ! -r ${FN} ] ; then echo "File not readable: ${FN}" exit fi if [ ! -s ${FN} ] ; then echo "File empty: ${FN}" exit fi # # 1 1 1 1 1 1 #hhmm total 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 #0940 71648935 67091830 275952 0 0 23 0 1 0 0 0 1146614 1018791 2115723 1 0 0 #0945 71682636 67121886 276671 0 0 23 0 1 0 0 0 1147073 1020430 2116551 1 0 0 awk ' BEGIN{} { if (NR == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; old_time = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); toks = split($0,old_array," ") } else { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; now = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); delta_tim = now - old_time; if(delta_tim < 1) { delta_tim = 1; } toks = split($0,array," ") for (i=1;i<=toks;i++) { if ( old_array[i] > array[i] ) { old_array[i] = 0 ; } } if ( delta_tim < 1 ) { delta_tim = 1;} for (i=3;i<=toks;i++) { Delta = (array[i] - old_array[i])/delta_tim; fn="/tmp/gnuplot.intr." i - 3; printf("%5.2f %9.4f\n",tim,Delta) > fn ; } toks = split($0,old_array," ") old_time = now; } } END{}' ${FN} # # Get system name and date of report into variables... system=`hostname -s` sysdate=`echo ${FN} | cut -c 6-` echo "Generating plot for $system $sysdate" # # # Start building the /tmp/gnuplot.intr.script # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.ps"' PAUSE="" YLABEL="set ylabel Interrupts" fi cat </tmp/gnuplot.intr.script ${TERMINAL} set data style lines set nogrid set key set title "Interrupts Per Second - ${system} on ${sysdate}" set xlabel "Time of Day" set xrange [00:24] set xtics 0,1,24 ${YLABEL} set autoscale y EOF # get a properly sorted list of data files and eliminate # the ones with all zeroes (unused interrupt) for I in `/bin/ls -1 /tmp/gnuplot.intr.[0-9]* | \ /usr/bin/sort -n -t"." +2` ; do minMax ${I} set ${MINMAX} intr=`echo ${I} | cut -d"." -f3` if [ ${1} -eq 0 -a ${2} -eq 0 ] ; then echo "Skipped ${intr}" else if [ ${intr} -lt 10 ]; then INT=' '${intr} else INT=${intr} fi # get the text associated with this interrupt number from /proc/interrupts TEXT=`grep "^${INT}" /proc/interrupts | awk \ '{ for (i=3;i<=NF;i++){ TEXT = TEXT" "$(i); } printf("%s\n", TEXT); }'` cat <>/tmp/gnuplot.intr.script plot \ "${I}" title "IRQ ${intr} (${TEXT} )" with line 1 ${PAUSE} EOF fi done echo "quit" >>/tmp/gnuplot.intr.script # # Generate the plots # gnuplot /tmp/gnuplot.intr.script # if [ .${HARDCOPY} = ".YES" ]; then /usr/local/bin/psnup -8 -cq /tmp/gnuplot.ps 2>/dev/null \ >/tmp/gnuplot.intr.${system}.ps if [ -z ${GHOSTVIEW} ] ; then lpr /tmp/gnuplot.intr.${system}.ps else ghostview -upsidedown -magstep 3 /tmp/gnuplot.intr.${system}.ps echo "Print ?" read ans if [ ${ans} = "y" ] ; then lpr /tmp/gnuplot.intr.${system}.ps fi fi fi # clean up the junk if [ ${DEBUG}. = "." ]; then rm /tmp/gnuplot.intr* 2>/dev/null fi exit mem100750 1061 330 11307 6364503643 10124 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/mem,v 1.4 2025/06/19 05:28:32 dgavin Exp dgavin $ # # mem - display memory utilization # # input - /var/log/sar/data/mem.Mondd.yy # output- charts for total/free/used, buffer/cache usage and shared memory # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.mem* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of memory utilization." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" set -x DEBUG="yes" trap '' SIGHUP SIGINT SIGQUIT SIGTERM ;; L) echo ' $Log: mem,v $ Revision 1.4 2025/06/19 05:28:32 dgavin cleanup dgavin Revision 1.3 2025/06/13 14:26:57 dgavin cleanup dgavin Revision 1.2 2025/06/12 03:45:39 dgavin removed extra log area Revision 1.1 2025/06/12 03:40:03 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.4 $' exit 1 ;; ?) echo -e "\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then FN="mem.`date +%b%d.%y`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) FN="mem.${1}.`date +%y`";; 9) FN="mem.${1}";; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac fi if [ ! -f ${FN} ] ; then echo "No such file: ${FN}" exit fi if [ ! -r ${FN} ] ; then echo "File not readable: ${FN}" exit fi if [ ! -s ${FN} ] ; then echo "File empty: ${FN}" exit fi # #HHMM page in page out #HHMM total: used: free: shared: buffers: cached: #0900 21897216 21577728 319488 13410304 245760 5988352 # awk ' BEGIN{} { if (NR == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; } else { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; printf("%5.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",tim, $2/1024,$3/1024,$4/1024 + $3/1024,$5/1024, $6/1024,$7/1024) >"/tmp/gnuplot.mem"; } } END{}' ${FN} # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` sysdate=`echo ${FN} | cut -c 5-` echo "Generating plot for $system $sysdate" # # Start building the gnuplot.mem.script # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.mem.ps"' PAUSE="" YLABEL="" fi gnuplot </dev/null fi exit page100750 1061 330 11150 6573031324 10250 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/page,v 1.2 2025/06/19 05:30:34 dgavin Exp dgavin $ # # page - display paging activity # # input - /var/log/sar/data/page.Mondd.yy # output- chart showing page in and page out operations per second # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.page* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of paging activity." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" set -x DEBUG="yes" trap '' SIGHUP SIGINT SIGQUIT SIGTERM ;; L) echo ' $Log: page,v $ Revision 1.2 2025/06/19 05:30:34 dgavin cleanup dgavin Revision 1.1 2025/06/12 03:41:14 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.2 $' exit 1 ;; ?) echo -e "\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then FN="page.`date +%b%d.%y`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) FN="page.${1}.`date +%y`";; 9) FN="page.${1}";; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac fi if [ ! -f ${FN} ] ; then echo "No such file: ${FN}" exit fi if [ ! -r ${FN} ] ; then echo "File not readable: ${FN}" exit fi if [ ! -s ${FN} ] ; then echo "File empty: ${FN}" exit fi # #HHMM page in page out #0940 1044752 617081 #0945 1047033 617720 # awk ' BEGIN{} { if (NR == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; old_time = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); old_pgin = $2; old_pgout = $3; } else { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; now = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); delta_tim = now - old_time; if(delta_tim < 1) { delta_tim = 1; } if ( old_pgin > $2 ) { old_pgin = 0; old_pgout = 0; } pgin = $2 - old_pgin; pgout = $3 - old_pgout; printf("%5.2f %7.2f %7.2f\n", tim,pgin/delta_tim,pgout/delta_tim ) >"/tmp/gnuplot.page"; old_pgin = $2; old_pgout = $3; old_time = now; } } END{}' ${FN} # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` sysdate=`echo ${FN} | cut -c 6-` echo "Generating plot for $system $sysdate" # # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.page.ps"' PAUSE="" YLABEL="" fi gnuplot </dev/null fi exit ppp100750 1061 330 16534 6364504670 10155 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/ppp,v 1.1 2025/06/19 05:30:55 dgavin Exp dgavin $ # # ppp - display ppp interface activity # # input - /var/log/sar/data/ppp*.Mondd.yy # output- 3 charts for each active ppp interface; # transmit/receive packets per second # receive errors # tranmit errors # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.ppp* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of network interface activity." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" DEBUG="yes" set -x ;; L) echo ' $Log: ppp,v $ Revision 1.1 2025/06/19 05:30:55 dgavin Initial revision Revision 1.2 2025/06/12 03:46:21 dgavin removed extra log area Revision 1.1 2025/06/12 03:40:38 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.1 $' exit 1 ;; ?) echo -e "\n${HELP}\n\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then arg="ppp[0-9]"."`date +"%b%d.%y"`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) DAT=${1}".`date +%y`";; 9) DAT=${1};; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac arg="ppp[0-9].${DAT}" fi LIST=`/bin/ls -1 ${arg} 2>/dev/null ` n=`echo ${LIST} | tr " " "\n" | wc -l ` # #Inter-| Receive | Transmit # face |packets errs drop fifo frame|packets errs drop fifo colls carrier # eth0:1072737 1 1 0 1 360837 0 0 0 7049 1 #1618 1069300 1 1 0 1 359772 0 0 0 7049 1 #1620 1069406 1 1 0 1 359801 0 0 0 7049 1 DEVLIST="" for FN in ${LIST} ; do DEVICE=`echo ${FN} | cut -c1-4 | tr "[A-Z]" "[a-z"` DEVLIST="${DEVLIST} ${DEVICE}" awk ' BEGIN{} { if (NR == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; old_time = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); old_rpackets = $2; old_rerrors = $3; old_rdrop = $4; old_rfifo = $5; old_rframe = $6; old_tpackets = $7; old_terrors = $8; old_tdrop = $9; old_tfifo = $10; old_tcolls = $11; old_tcarrier = $12; } else { if(NF == 12 ) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; now = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); delta_tim = now - old_time; if(delta_tim < 1) { delta_tim = 1; } if ( old_rpackets > $2 ) { old_rpackets = 0; old_rerrors = 0; old_rdrop = 0; old_rfifo = 0; old_rframe = 0; old_tpackets = 0; old_terrors = 0; old_tdrop = 0; old_tfifo = 0; old_tcolls = 0; old_tcarrier = 0; } rpackets = $2 - old_rpackets; rerrors = $3 - old_rerrors; rdrop = $4 - old_rdrop; rfifo = $5 - old_rfifo; rframe = $6 - old_rframe; tpackets = $7 - old_tpackets; terrors = $8 - old_terrors; tdrop = $9 - old_tdrop; tfifo = $10 - old_tfifo; tcolls = $11 - old_tcolls; tcarrier = $12 - old_tcarrier; printf("%5.2f %7.2f %d %d %d %d %7.2f %d %d %d %d %d\n",tim, rpackets/delta_tim,rerrors, rdrop, rfifo, rframe, tpackets/delta_tim, terrors, tdrop, tfifo, tcolls, tcarrier) >"/tmp/gnuplot.'${DEVICE}'"; old_time = now; old_rpackets = $2; old_rerrors = $3; old_rdrop = $4; old_rfifo = $5; old_rframe = $6; old_tpackets = $7; old_terrors = $8; old_tdrop = $9; old_tfifo = $10; old_tcolls = $11; old_tcarrier = $12; } } } END{}' ${FN} done # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` sysdate=`echo ${FN} | cut -c 6-` echo "Generating plot for $system $sysdate" # # # Start building the /tmp/gnuplot.ppp.script # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL1="" YLABEL2="" YLABEL3="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.ppp.ps"' PAUSE="" YLABEL1='set ylabel "Transmit | Receive"' YLABEL2='set ylabel "Receive Errors"' YLABEL3='set ylabel "Transmit Errors"' fi cat </tmp/gnuplot.ppp.script ${TERMINAL} set data style lines set nogrid set key set xlabel "Time of Day" set xrange [00:24] set xtics 0,1,24 EOF for DEV in ${DEVLIST} ; do echo "Processing plots for ${DEV} $system $sysdate" cat <>/tmp/gnuplot.ppp.script set title "Network Packets per second - ${DEV} $system On $sysdate" ${YLABEL1} set autoscale y plot \ "/tmp/gnuplot.${DEV}" using 1:2 title "Received" with line 1, \ "/tmp/gnuplot.${DEV}" using 1:7 title "Transmitted" with line 2 ${PAUSE} set title "Network Receive Errors - ${DEV} $system On $sysdate" ${YLABEL2} set autoscale y plot "/tmp/gnuplot.${DEV}" using 1:3 title "Total Errors" with line 1, \ "/tmp/gnuplot.${DEV}" using 1:4 title "Drop Errors" with line 2, \ "/tmp/gnuplot.${DEV}" using 1:5 title "Fifo Errors" with line 3, \ "/tmp/gnuplot.${DEV}" using 1:6 title "Frame Errors" with line 4 ${PAUSE} set title "Network Transmit Errors - ${DEV} $system On $sysdate" ${YLABEL2} set autoscale y plot "/tmp/gnuplot.${DEV}" using 1:8 title "Total Errors" with line 1, \ "/tmp/gnuplot.${DEV}" using 1:9 title "Drop Errors" with line 2, \ "/tmp/gnuplot.${DEV}" using 1:10 title "Fifo Errors" with line 3, \ "/tmp/gnuplot.${DEV}" using 1:11 title "Collisions" with line 4, \ "/tmp/gnuplot.${DEV}" using 1:12 title "Carrier Loss" with line 5 ${PAUSE} EOF # done # echo "quit" >>/tmp/gnuplot.ppp.script # # Generate the plots # gnuplot /tmp/gnuplot.ppp.script # if [ .${HARDCOPY} = ".YES" ]; then if [ -z ${GHOSTVIEW} ] ; then lpr /tmp/gnuplot.ppp.ps else ghostview -upsidedown -magstep 3 /tmp/gnuplot.ppp.ps echo "Print ?" read ans if [ ${ans} = "y" ] ; then lpr /tmp/gnuplot.ppp.ps fi fi fi # clean up the junk if [ ${DEBUG}. = "." ]; then rm /tmp/gnuplot.ppp* 2>/dev/null fi exit proc100750 1061 330 11105 6364505131 10277 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/proc,v 1.1 2025/06/19 05:33:28 dgavin Exp dgavin $ # # proc - chart process creation rate # # input - /var/log/sar/data/proc.Mondd.yy # output- chart showing context switches per second # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.proc* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of context switching." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" set -x DEBUG="yes" trap '' SIGHUP SIGINT SIGQUIT SIGTERM ;; L) echo ' $Log: proc,v $ Revision 1.1 2025/06/19 05:33:28 dgavin Initial revision Revision 1.2 2025/06/12 03:43:54 dgavin removed extra log area Revision 1.1 2025/06/12 03:36:35 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.1 $' exit 1 ;; ?) echo "\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then FN="processes.`date +%b%d.%y`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) FN="processes.${1}.`date +%y`";; 9) FN="processes.${1}";; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac fi if [ ! -f ${FN} ] ; then echo "No such file: ${FN}" exit fi if [ ! -r ${FN} ] ; then echo "File not readable: ${FN}" exit fi if [ ! -s ${FN} ] ; then echo "File empty: ${FN}" exit fi # #0940 8065221 #0945 8068341 #0950 8071218 #0955 8073893 #1000 8076925 awk ' BEGIN{} { if (NR == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; old_time = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); old_proc = $2; } else { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; now = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); delta_tim = now - old_time; if(delta_tim < 1) { delta_time = 1; } if ( old_proc > $2 ) { old_proc = 0; } proc = ($2 - old_proc) / delta_tim; printf("%5.2f %7.2f\n",tim, proc ) >"/tmp/gnuplot.proc"; old_proc = $2; } } END{}' ${FN} # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` #sysdate=`/bin/date` sysdate=`echo ${FN} | cut -c 11-` echo "Generating plot for $system $sysdate" if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.proc.ps"' PAUSE="" YLABEL='set ylabel "Context Switches per second"' fi # # Generate the plots # gnuplot </dev/null fi exit sa100550 1061 330 3322 6352127267 7726 0ustar mlrljedit#!/bin/bash # $Header: /var/log/sar/RCS/sa,v 1.2 2025/06/19 03:59:42 dgavin Exp $ # # $Log: sa,v $ # Revision 1.2 2025/06/19 03:59:42 dgavin # cleanup # dgavin # # Revision 1.1 2025/06/12 03:34:56 dgavin # Initial revision # # cd /var/log/sar/data TIME=`date +"%H%M"` DATE=`date +"%b%d.%y"` # # Collect the memory and swap stats awk ' /^Mem: / { printf("'${TIME}' %s\n",substr($0,5)) >>"mem.'${DATE}'"; } /^Swap: / { printf("'${TIME}' %s\n",substr($0,6)) >>"swap.'${DATE}'"; } ' /proc/meminfo # # collect the active network interface stats. If ppp hasn't been used # There won't be any ppp line. awk ' /^ eth/ { printf("'${TIME}' %s\n",substr($0,8)) >>substr($0,3,4)".'${DATE}'"; } /^ ppp/ { printf("'${TIME}' %s\n",substr($0,8)) >>substr($0,3,4)".'${DATE}'"; } ' /proc/net/dev # # Collect CPU, disk I/O, paging, interrupts, context switching, and processes awk ' /^cpu/ { printf("'${TIME}' %s\n",substr($0,6)) >>"cpu.'${DATE}'"; } /^disk / { d=split($0,disk); } /^disk_rio / { d=split($0,disk_rio); } /^disk_wio / { d=split($0,disk_wio); } /^disk_rblk / { d=split($0,disk_rblk); } /^disk_wblk / { d=split($0,disk_wblk); printf("'${TIME}'") >>"disk.'${DATE}'"; for (r = 2; r <= d ; r ++ ) { printf(" %s %s %s %s %s", disk[r],disk_rio[r],disk_wio[r], disk_rblk[r],disk_wblk[r]) >>"disk.'${DATE}'";} printf("\n") >>"disk.'${DATE}'"; } /^page/ { printf("'${TIME}' %s\n",substr($0,6)) >>"page.'${DATE}'"; } /^swap/ { printf("'${TIME}' %s\n",substr($0,6)) >>"swap.'${DATE}'"; } /^intr/ { printf("'${TIME}' %s\n",substr($0,6)) >>"intr.'${DATE}'"; } /^ctxt/ { printf("'${TIME}' %s\n",substr($0,6)) >>"ctxt.'${DATE}'"; } /^processes/ { printf("'${TIME}' %s\n",$2) >>"processes.'${DATE}'"; } ' /proc/stat swap100750 1061 330 12423 6364503571 10320 0ustar mlrljedit#!/bin/bash #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # $Header: /var/log/sar/RCS/swap,v 1.2 2025/06/19 04:01:39 dgavin Exp dgavin $ # # swap - display swapping activity # # input - /var/log/sar/data/swap.Mondd.yy # output- two charts # swap in and out operations per second # total/used/free swap space utilization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # trap '/bin/rm /tmp/gnuplot.swap* 2>/dev/null;exit' SIGHUP SIGINT SIGQUIT SIGTERM #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Function definitions # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# function checkForEmpty { if [ ! -f ${1} ] ; then echo "0 0" >${1} ; fi return } #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Mainline code # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Variable initialization # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# HARDCOPY="" GHOSTVIEW="" CMDNAME=`basename $0` # HELP="${CMDNAME} generates X11 or hardcopy graph of swap activity." USAGE="${CMDNAME} [-DHLVhPp] [MonDD[.YY]] -D turns on execution tracing -H displays help info and exits -L displays RCS log and exits -V display Revision info and exits -h displays help info and exits -P Print without display -p display and offer print option MonDD.YY - day to work with, defaults to today i.e. Jun12.97 -the year will default to this year " # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # # Parse options # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # while getopts DHLVhPp c ; do case ${c} in h|H) echo -e "\n${HELP}\n\n${USAGE}\n" exit 1 ;; p) HARDCOPY="YES" GHOSTVIEW="YES" ;; P) HARDCOPY="YES" GHOSTVIEW="" ;; D) echo "DEBUG ON" DEBUG="yes" set -x ;; L) echo ' $Log: swap,v $ Revision 1.2 2025/06/19 04:01:39 dgavin cleanup dgavin Revision 1.1 2025/06/12 03:37:33 dgavin Initial revision ' exit 1 ;; V) echo '$Revision: 1.2 $' exit 1 ;; ?) echo -e "\n${USAGE}\n" exit 3 ;; esac done # re-align the positional parameters as $1, $2,... shift `expr ${OPTIND} - 1` # cd /var/log/sar/data if [ $# -eq 0 ] ; then FN="swap.`date +%b%d.%y`" else l=`echo ${1} | wc -c` l=`expr ${l} + 0` case ${l} in 6) FN="swap.${1}.`date +%y`";; 9) FN="swap.${1}";; *) echo -e "\n${CMDNAME}: Invalid date - ${1}\n" exit ;; esac fi if [ ! -f ${FN} ] ; then echo "No such file: ${FN}" exit fi if [ ! -r ${FN} ] ; then echo "File not readable: ${FN}" exit fi if [ ! -s ${FN} ] ; then echo "File empty: ${FN}" exit fi # #HHMM swap in swap out #0940 1044752 617081 #0945 1047033 617720 # awk ' BEGIN{ r=0; } { # Swap ins, outs per second if (NF == 3) { r++; if (r == 1) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; old_time = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); old_swpin = $2; old_swpout = $3; } else { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; now = (substr($1,1,2) * 3600) + (substr($1,3,2) * 60); delta_tim = now - old_time; if ( swpin > $2 ) { swpin = 0; swpout = 0; } else { swpin = $2 - old_swpin; swpout = $3 - old_swpout; } if ( delta_tim < 1 ) { inv = swpin / delta_tim; outv = swpout / delta_tim; } else { inv = swpin; outv = swpout; } printf("%5.2f %7.2f %7.2f\n",tim,inv,outv) >"/tmp/gnuplot.swap"; old_swpin = $2; old_swpout = $3; old_time = now; } } # Total, Used, Free swap pages if (NF == 4) { mm=substr($1,3,2) * .016; tim=substr($1,1,2)+mm; printf("%5.2f %7.2f %7.2f %7.2f\n", tim,$2/1048576,$3/1048576,$4/1048576) >"/tmp/gnuplot.swapSp"; } } END{}' ${FN} # # Get system name and date of report into variables... system=`hostname -s | /usr/bin/tr "[A-Z]" "[a-z]"` #sysdate=`/bin/date` sysdate=`echo ${FN} | cut -c 6-` echo "Generating plot for $system $sysdate" # # Set up for output requested or defaulted # if [ -z ${HARDCOPY} ]; then TERMINAL="set terminal X11" PAUSE="pause 10" YLABEL="" else TERMINAL='set terminal postscript landscape monochrome dashed "Times-Roman" 18 set output "/tmp/gnuplot.swap.ps"' PAUSE="" YLABEL="" fi # # Generate the plot # gnuplot </dev/null fi exit