Hi,
I got the code below is one of the threads from this forum.
lineCount=$(iostat | wc -l)
numDevices=$(expr $lineCount - 7);
iostat $interval -x -t |
awk -v awkCpuFile=$cpuFile -v awkDeviceFile=$deviceFile -v awkNumDevices=$numDevices '
BEGIN {
print "date/time,%user,%nice,%system,%iowait,%steal,%idle" > "awkCpuFile"
print "date/time,device,rrqm/s,wrqm/s,r/s,w/s,rsec/s,wsec/s,avgrq-sz,avgqu-sz,await,svctm,%util" > "awkDeviceFile"
}
NF==2{
s=$0
getline; getline; $1=$1
gsub(/ /,",",$0)
print s "," $0 > "awkCpuFile"
}
/Device:/{
for (i=0; i<awkNumDevices; i++) {
getline; $1=$1
gsub(/ /,",",$0)
print s "," $0 > "awkDeviceFile"
}
}'
Once this script is executed,
I am able to see the device statistics in the output file "awkDeviceFile" but there is no value displayed in the CPU statistics file "awkCpuFile"
Could you please let me know what could be the reason for the same?