12 lines
465 B
Bash
Executable File
12 lines
465 B
Bash
Executable File
#!/usr/bin/env bash
|
|
echo "Date CPUUsed MEMUsed IOWait" > /tmp/sar-report.txt
|
|
for f in $(ls /var/log/sysstat/sa[0123]*); do
|
|
SARDate=$(stat $f | grep Modify | awk '{print $2}')
|
|
CPUUsed=$(sar -f $f | tail -1 | awk '{print 100-$NF}')
|
|
MEMUsed=$(sar -r -f $f | tail -1 | awk '{print $5}')
|
|
IOWait=$(sar -f $f | tail -1 | awk '{print $6}')
|
|
echo "$SARDate $CPUUsed $MEMUsed $IOWait" >> /tmp/sar-report.txt
|
|
done
|
|
cat /tmp/sar-report.txt | column -t
|
|
rm -f /tmp/sar-report.txt
|