Login  Register

sar report

classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

sar report

Antonio
8 posts
hi erman, how can i generate weekly cpu,memory and disk usage with sar.I didnt find in at internet
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: sar report

ErmanArslansOracleBlog
Administrator
5727 posts
This post was updated on Feb 10, 2017; 1:37pm.
Hi,

You need to write a script for this.

I have written one.
This script will report SAR data weekly and it has options to report CPU utilization, SWAP operations and LOAD AVERAGE. (WEEKLY!)

echo "What dou you want to report? (weekly report -- last 7 days)"
echo type 1 for Load Average Report
echo type 2 for Cpu utilization
echo type 3 swapin/swapout operations
read choice
case "$choice" in
        1)
sar_reporting_argument="-q"
;;
        2)
sar_reporting_argument="-u"
;;
        3)
sar_reporting_argument="-W"
;;
*)
esac

day_high_count=`date +%d`
let day_counter=$day_high_count-7
while [  $day_counter -le $day_high_count ] ; do
day_counter_2digit="0${day_counter}"
day_counter_2digit="${day_counter_2digit: -2}"
sar `echo $sar_reporting_argument` -f /var/log/sa/sa`echo $day_counter_2digit`
echo $day_high_count
let day_counter=$day_counter+1
done


Example run:

[root@daroravmsrv1 ~]# sh /tmp/sar_weekly_load_average
What dou you want to report? (weekly report -- last 7 days)
type 1 for Load Average Report
type 2 for Cpu utilization
type 3 swapin/swapout operations
1 (my input)


After executing the script and producing the output, you can get the data from your shell to excel and do lots of reporting stuff . Optionally, you can enhance the script to put these sar outputs into html tables and even into the html graphs.