diff --git a/sh/sar-weekly.sh b/sh/sar-weekly.sh index 46ab9a3..79b8d65 100755 --- a/sh/sar-weekly.sh +++ b/sh/sar-weekly.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash +SARDIR=/var/log/sysstat +if [ -d /var/log/sa ]; then + SARDIR=/var/log/sa +fi echo "Date CPUUsed MEMUsed IOWait" > /tmp/sar-report.txt -for f in $(ls /var/log/sysstat/sa[0123]*); do +for f in $(ls $SARDIR/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}')