UPD: changed to column format
This commit is contained in:
parent
4250378ec5
commit
c22d6c8ed7
13
sh/sar-weekly.sh
Normal file → Executable file
13
sh/sar-weekly.sh
Normal file → Executable file
@ -1,8 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
echo "Date CPUUsed MEMUsed IOWait" > /tmp/sar-report.txt
|
||||||
for f in $(ls /var/log/sysstat/sa[0123]*); do
|
for f in $(ls /var/log/sysstat/sa[0123]*); do
|
||||||
echo -n "Date: "; stat $f | grep Modify | awk '{print $2}'
|
SARDate=$(stat $f | grep Modify | awk '{print $2}')
|
||||||
sar -f $f | tail -1 | awk '{print "CPU Used: ", 100-$NF}'
|
CPUUsed=$(sar -f $f | tail -1 | awk '{print 100-$NF}')
|
||||||
sar -r -f $f | tail -1 | awk '{print "Memused: "$5}'
|
MEMUsed=$(sar -r -f $f | tail -1 | awk '{print $5}')
|
||||||
sar -f $f | tail -1 | awk '{print "iowait: "$6}'
|
IOWait=$(sar -f $f | tail -1 | awk '{print $6}')
|
||||||
echo "- - -"
|
echo "$SARDate $CPUUsed $MEMUsed $IOWait" >> /tmp/sar-report.txt
|
||||||
done
|
done
|
||||||
|
cat /tmp/sar-report.txt | column -t
|
||||||
|
rm -f /tmp/sar-report.txt
|
||||||
|
Loading…
Reference in New Issue
Block a user