Open m0dular opened 3 years ago
Currently, I use this ungodly command to shape the human readable sar metrics into a format usable by gnuplot:
sar
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.
I'm dumb and sadf -c and sadf -g can be used on recent versions to make an SVG.
sadf -c
sadf -g
Currently, I use this ungodly command to shape the human readable
sar
metrics into a format usable bygnuplot
:And plot it with:
Please script this.