From 6da77dc13baa9a1a119f85d2ba8014b348132a10 Mon Sep 17 00:00:00 2001 From: x p k Date: Wed, 22 Apr 2020 16:11:43 +0800 Subject: [PATCH] UPD: fixed memory column issue on EL --- sh/sar-weekly.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/sar-weekly.sh b/sh/sar-weekly.sh index 79b8d65..d2d2e02 100755 --- a/sh/sar-weekly.sh +++ b/sh/sar-weekly.sh @@ -7,7 +7,7 @@ echo "Date CPUUsed MEMUsed IOWait" > /tmp/sar-report.txt 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}') +MEMUsed=$(sar -r -f $f | tail -1 | grep -Eo '[0-9]+\.[0-9]+' | head -1) IOWait=$(sar -f $f | tail -1 | awk '{print $6}') echo "$SARDate $CPUUsed $MEMUsed $IOWait" >> /tmp/sar-report.txt done