forked from m0dular/support-script-tooling
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Currently, I use this ungodly command to shape the human readable sar metrics into a format usable by gnuplot:
echo "time %usr %sys %iowait" >sar.dat; sed 1,2d metrics/sa/sar29 | awk -v RS= 'NR < 14{ n = split($0, lines, "\n"); for (i=2;i<n;i++) {if (lines[i] ~ "all") { split(lines[i], fields, " "); if ( fields[2] == "AM" && substr(fields[1],1,2) == 12 ) {fulltime="00:" substr(fields[1],4,2)} else if ( fields[2] == "PM" && substr(fields[1],1,2) == 12 ) {fulltime="12:" substr(fields[1],4,2)} else if ( fields[2] == "PM" ) {fulltime=substr(fields[1],1,2)+12 ":" substr(fields[1],4,2)} else {fulltime=substr(fields[1],1,5)}; cpu_usr[fulltime]=fields[4]; cpu_sys[fulltime]=fields[6]; cpu_wait[fulltime]=fields[7]}}} END { for (t in cpu_usr) print t, cpu_usr[t], cpu_sys[t], cpu_wait[t]}' | sort -k 1,1 >>sar.dat
And plot it with:
set timefmt '%H:%M'
set xdata time
set format x "%H:%M"
plot for [col=2:4] 'sar.dat' using 1:col with lines title columnheader
Please script this.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request