http://www.cyberciti.biz/tips/identifying-linux-bottlenecks-sar-graphs-with-ksar.html
http://www.woblag.com/2013/10/standalone-server-reporting-with-sar.html
http://sourceforge.net/projects/ksar/
# --------------------------------------------------------- # --- : # yum install sysstat apt-get install sysstat # --------------------------------------------------------- # --- : # vi /etc/sysconfig/sysstat # keep log for 28 days # the default is 7 HISTORY=28 # --------------------------------------------------------- # --- : # Update it as follows to log all disk stats (the -d option force to log # stats for each block device and the -I option force report statistics # for all system interrupts) run system activity accounting tool every 10 minutes vi /etc/cron.d/sysstat */10 * * * * root /usr/lib64/sa/sa1 -I -d 1 1 # generate a daily summary of process accounting at 23:53 53 23 * * * root /usr/lib64/sa/sa2 -A # --------------------------------------------------------- # --- : # chkconfig sysstat on service sysstat start # sar -c 3 10 # To view process creation statistics, enter: # sar -b 3 10 # To view I/O and transfer rate statistics, enter: # sar -B 3 10 # To view paging statistics, enter: # sar -d 3 10 # To view block device statistics, enter: # sar -I XALL 3 10 # To view statistics for all interrupt statistics, enter: # sar -n DEV 3 10 # To view device specific network statistics, enter: sar -n EDEV 3 10 # sar -P ALL # To view CPU specific statistics, enter: # sar -P 1 3 10 # Only 1st CPU stats # sar -q 3 10 # To view queue length and load averages statistics, enter: # sar -r 3 10 # To view memory and swap space utilization statistics, enter: sar -R 3 10 # sar -v 3 10 # To view status of inode, file and other kernel tables statistics, enter: # sar -w 3 10 # To view system switching activity statistics, enter: # sar -W 3 10 # To view swapping statistics, enter: # sar -x 3256 3 10 # To view statistics for a given process called Apache with PID # 3256, enter: # --------------------------------------------------------- # --- : How Do I Generate sar Graphs Using kSar? # LC_ALL=C sar -A > /tmp/sar.data.txt LC_ALL=C sar -A -f /var/log/sa/sa01 >> 20150701.sar # for i in {1..31}; do LC_ALL=C sar -A -f /var/log/sa/sa$i >> /mon/sarmonthly_$(date + "%B").txt done # --------------------------------------------------------- # --- : # #!/bin/bash # # Script to get sar statistics# ## sar_stats.sh ## echo "Enter the number of intervals (seconds) for the sar statistics:" read int echo "enter the number of output lines (count) to process:" read cnt while : do clear echo "*******************************" echo "* Choose from the following: *" echo "*******************************" echo "* [1] To view process creation statistics *" echo "* [2] To view I/O and transfer rate statistics *" echo "* [3] To view paging statistics *" echo "* [4] To view block device statistics *" echo "* [5] To view statistics for all interrupt statistics *" echo "* [6] To view device specific network statistics *" echo "* [7] To view extended network statistics *" echo "* [8] To view CPU specific statistics *" echo "* [9] To view Only 1st CPU stats *" echo "* [10] To view queue length and load averages statistics *" echo "* [11] To view memory and swap space utilization statistics *" echo "* [12] To view inode, file and other kernel tables statistics*" echo "* [13] To view system switching activity statistics *" echo "* [14] To view swapping statistics *" echo "* [15] To view statistics for a given process ( Example: a process called Apache with PID # 3256) *" echo "* [0] Exit *" echo "************************" echo -n "Enter your menu choice [0-15]: " D=`/bin/date '+%B.%d'` INT=$int CNT=$cnt read mychoice case $mychoice in 1) echo "process creation statistics"; sar -c $INT $CNT |tee /tmp/sar_proc_stat_$D echo "This file will be saved to /tmp/sar_pc_stat_$D" sleep 3 ;; 2) echo "I/O and transfer rate statistics" sar -b $INT $CNT |tee /tmp/sar_IO_TR_stat_$D echo "This file will be saved to /tmp/sar_IO_TR_stat_$D" sleep 3 ;; 3) echo "paging statistics" sar -B $INT $CNT |tee /tmp/sar_pag_stat_$D echo "This file will be saved to /tmp/sar_pag_stat_$D" sleep 3 ;; 4) echo "block device statistics" sar -d $INT $CNT |tee /tmp/sar_block_stat_$D echo "This file will be saved to /tmp/sar_block_stat_$D" sleep 3 ;; 5) echo "all interrupt statistics statistics" sar -I XALL $INT $CNT |tee /tmp/sar_Intr_stat_$D echo "This file will be saved to /tmp/sar_Intr_stat_$D" sleep 3 ;; 6) echo "specific network statistics" sar -n DEV $INT $CNT |tee /tmp/sar_Net_stat_$D echo "This file will be saved to /tmp/sar_Net_stat_$D" sleep 3 ;; 7) echo "Extended network statistics" sar -n EDEV $INT $CNT |tee /tmp/sar_ENet_stat_$D echo "This file will be saved to /tmp/sar_ENet_stat_$D" sleep 3 ;; 8) echo "CPU specific statistics" sar -P ALL $INT $CNT |tee /tmp/sar_CPU_stat_$D echo "This file will be saved to /tmp/sar_CPU_stat_$D" sleep 3 ;; 9) echo "1st CPU statistics" sar -P 1 $INT $CNT |tee /tmp/sar_1CPU_stat_$D echo "This file will be saved to /tmp/sar_1CPU_stat_$D" sleep 3 ;; 10) echo "queue length and load averages statistics" sar -q $INT $CNT |tee /tmp/sar_queue_stat_$D echo "This file will be saved to /tmp/sar_queue_stat_$D" sleep 3 ;; 11) echo "memory and swap space utilization statistics" sar -r $INT $CNT |tee /tmp/sar_mem-swap_stat_$D echo "This file will be saved to /tmp/sar_mem-swap_stat_$D" sleep 3 ;; 12) echo "inode, file and other kernel tables statistics" sar -v $INT $CNT |tee /tmp/sar_kern_stat_$D echo "This file will be saved to /tmp/sar_kern_stat_$D" sleep 3 ;; 13) echo "system switching activity statistics" sar -w $INT $CNT |tee /tmp/sar_switch_stat_$D echo "This file will be saved to /tmp/sar_switch_stat_$D" sleep 3 ;; 14) echo "swapping statistics" sar -W $INT $CNT |tee /tmp/sar_swap_stat_$D echo "This file will be saved to /tmp/sar_swap_stat_$D" sleep 3 ;; 15) echo "statistics for a given process (Example: PID # 3256)" echo "Enter the proccess number you want to check:" read PROC sar -x $PROC $INT $CNT |tee /tmp/sar_proc_stat_$D echo "This file will be saved to /tmp/sar_proc_stat_$D" sleep 3 ;; 0) exit 0;; *) echo "BAD CHOICE!!! Please select choice 1,2,3,4,5,6 ........ "; echo "Press Enter to continue. . ." ; read ;; esac done