[server1]~#cat /sw/solaris/scripts/analyze_sar.ksh #!/bin/ksh util_avg_max() { file=$1 assigned_cpu_threads=`psrinfo | grep on-line | wc -l` assigned_mem_mb=`prtconf | grep Memory | awk '{print $3}'` cd /var/adm/sa gun=`stat $file | grep Change | awk '{print $2}'` sunucu=`hostname` cpu_idle_avg=`sar -f $file -u | tail -1 | awk '{print $5}'` cpu_idle_least=`sar -f $file -u | grep ":" | grep -v idle | awk '{print $5}' | sort -nu | head -1` cpu_busy_avg=`echo 100-$cpu_idle_avg | bc` cpu_busy_max=`echo 100-$cpu_idle_least | bc` page_size=`pagesize` free_ram_pages_avg=`sar -f $file -r | tail -1 | awk '{print $2}'` free_ram_avg=`echo $free_ram_pages_avg*$page_size | bc` free_ram_avg_mb=`echo $free_ram_avg/1024/1024 | bc` free_ram_avg_pct=`echo 100*$free_ram_avg_mb/$assigned_mem_mb | bc` used_ram_avg_pct=`echo 100-$free_ram_avg_pct | bc` free_ram_pages_min=`sar -f $file -r | grep ":" | grep -v free | awk '{print $2}' | sort -nu | head -1` free_ram_min=`echo $free_ram_pages_min*$page_size | bc` free_ram_min_mb=`echo $free_ram_min/1024/1024 | bc` free_ram_min_pct=`echo 100*$free_ram_min_mb/$assigned_mem_mb | bc` used_ram_max_pct=`echo 100-$free_ram_min_pct | bc` message="$sunucu $gun CPU =$assigned_cpu_threads threads ( UTIL: avg % $cpu_busy_avg - max % $cpu_busy_max )" message="$message MEM = $assigned_mem_mb MB ( UTIL: avg % $used_ram_avg_pct - max % $used_ram_max_pct )" echo $message } cd /var/adm/sa for x in `ls sa*`;do util_avg_max $x;done [server1]~# root@server1:/#/sw/solaris/scripts/analyze_sar.ksh server1 2018-05-01 CPU = 8 threads ( UTIL: avg % 9 - max % 23 ) MEM = 24576 MB ( UTIL: avg % 92 - max % 93 ) server1 2018-05-02 CPU = 8 threads ( UTIL: avg % 16 - max % 61 ) MEM = 24576 MB ( UTIL: avg % 90 - max % 94 ) server1 2018-05-03 CPU = 8 threads ( UTIL: avg % 16 - max % 66 ) MEM = 24576 MB ( UTIL: avg % 90 - max % 92 ) server1 2018-05-04 CPU = 8 threads ( UTIL: avg % 19 - max % 62 ) MEM = 24576 MB ( UTIL: avg % 91 - max % 93 ) server1 2018-05-05 CPU = 8 threads ( UTIL: avg % 19 - max % 64 ) MEM = 24576 MB ( UTIL: avg % 91 - max % 93 ) server1 2018-05-06 CPU = 8 threads ( UTIL: avg % 19 - max % 65 ) MEM = 24576 MB ( UTIL: avg % 91 - max % 93 ) server1 2018-05-07 CPU = 8 threads ( UTIL: avg % 19 - max % 68 ) MEM = 24576 MB ( UTIL: avg % 92 - max % 94 ) server1 2018-05-08 CPU = 8 threads ( UTIL: avg % 19 - max % 78 ) MEM = 24576 MB ( UTIL: avg % 92 - max % 94 ) server1 2018-05-09 CPU = 8 threads ( UTIL: avg % 19 - max % 58 ) MEM = 24576 MB ( UTIL: avg % 92 - max % 94 ) server1 2018-05-10 CPU = 8 threads ( UTIL: avg % 19 - max % 61 ) MEM = 24576 MB ( UTIL: avg % 92 - max % 94 ) server1 2018-05-11 CPU = 8 threads ( UTIL: avg % 19 - max % 79 ) MEM = 24576 MB ( UTIL: avg % 93 - max % 95 ) server1 2018-05-12 CPU = 8 threads ( UTIL: avg % 19 - max % 58 ) MEM = 24576 MB ( UTIL: avg % 93 - max % 95 ) server1 2018-05-13 CPU = 8 threads ( UTIL: avg % 19 - max % 58 ) MEM = 24576 MB ( UTIL: avg % 93 - max % 95 ) server1 2018-05-14 CPU = 8 threads ( UTIL: avg % 19 - max % 76 ) MEM = 24576 MB ( UTIL: avg % 93 - max % 96 ) server1 2018-05-15 CPU = 8 threads ( UTIL: avg % 19 - max % 56 ) MEM = 24576 MB ( UTIL: avg % 94 - max % 96 ) server1 2018-05-16 CPU = 8 threads ( UTIL: avg % 20 - max % 74 ) MEM = 24576 MB ( UTIL: avg % 94 - max % 96 ) server1 2018-05-17 CPU = 8 threads ( UTIL: avg % 20 - max % 74 ) MEM = 24576 MB ( UTIL: avg % 94 - max % 96 ) server1 2018-05-18 CPU = 8 threads ( UTIL: avg % 20 - max % 69 ) MEM = 24576 MB ( UTIL: avg % 94 - max % 96 ) server1 2018-05-19 CPU = 8 threads ( UTIL: avg % 19 - max % 57 ) MEM = 24576 MB ( UTIL: avg % 95 - max % 97 ) server1 2018-05-20 CPU = 8 threads ( UTIL: avg % 20 - max % 57 ) MEM = 24576 MB ( UTIL: avg % 95 - max % 97 ) server1 2018-05-21 CPU = 8 threads ( UTIL: avg % 20 - max % 71 ) MEM = 24576 MB ( UTIL: avg % 95 - max % 97 ) server1 2018-05-22 CPU = 8 threads ( UTIL: avg % 20 - max % 69 ) MEM = 24576 MB ( UTIL: avg % 95 - max % 98 ) server1 2018-05-23 CPU = 8 threads ( UTIL: avg % 20 - max % 60 ) MEM = 24576 MB ( UTIL: avg % 95 - max % 97 ) server1 2018-05-24 CPU = 8 threads ( UTIL: avg % 20 - max % 73 ) MEM = 24576 MB ( UTIL: avg % 95 - max % 97 ) server1 2018-05-25 CPU = 8 threads ( UTIL: avg % 20 - max % 71 ) MEM = 24576 MB ( UTIL: avg % 96 - max % 98 ) server1 2018-05-26 CPU = 8 threads ( UTIL: avg % 21 - max % 59 ) MEM = 24576 MB ( UTIL: avg % 96 - max % 98 ) server1 2018-05-27 CPU = 8 threads ( UTIL: avg % 21 - max % 60 ) MEM = 24576 MB ( UTIL: avg % 96 - max % 98 ) server1 2018-05-28 CPU = 8 threads ( UTIL: avg % 21 - max % 61 ) MEM = 24576 MB ( UTIL: avg % 96 - max % 98 ) server1 2018-05-29 CPU = 8 threads ( UTIL: avg % 19 - max % 59 ) MEM = 24576 MB ( UTIL: avg % 97 - max % 98 ) server1 2018-04-30 CPU = 8 threads ( UTIL: avg % 9 - max % 26 ) MEM = 24576 MB ( UTIL: avg % 91 - max % 92 ) server1 2018-03-31 CPU = 8 threads ( UTIL: avg % 9 - max % 26 ) MEM = 24576 MB ( UTIL: avg % 90 - max % 91 ) root@server1:/#