code-dumps/sh/sar-weekly.sh

9 lines
303 B
Bash
Raw Normal View History

2020-04-20 11:24:58 +08:00
#!/usr/bin/env bash
for f in $(ls /var/log/sysstat/sa[0123]*); do
2020-04-20 11:28:35 +08:00
echo -n "Date: "; stat $f | grep Modify | awk '{print $2}'
sar -f $f | tail -1 | awk '{print "CPU Used: ", 100-$NF}'
2020-04-20 11:24:58 +08:00
sar -r -f $f | tail -1 | awk '{print "Memused: "$5}'
sar -f $f | tail -1 | awk '{print "iowait: "$6}'
echo "- - -"
done