UPD: adding support for EL

This commit is contained in:
xpk 2020-04-22 16:00:58 +08:00
parent c22d6c8ed7
commit 2ecce40ec1
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86

View File

@ -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}')