Using sar you can monitor performance of various Linux subsystems (CPU, Memory, I/O..) in real time.
Using sar, you can also collect all performance data on an on-going basis, store them, and do historical analysis to identify bottlenecks.
Sar is part of the sysstat package.
Below are the Linux performance statistics using sar. (along with argument)
- Collective CPU usage --> sar -u
- Individual CPU statistics --> sar -u -P ALL
- Memory used and available --> sar -r
- Swap space used and available --> sar -S
- Overall I/O activities of the system --> sar -b
- Individual device I/O activities --> sar -d
- Context switch statistics --> sar -w
- Run queue and load average data --> sar -q
- Network statistics --> sar -n
- Report sar data from a specific time --> sar -s
/var/log/sa/saXX --> where XX is date of month
- Based on the linux configuration, sar data get stored in below location in linux server for few days (by default for 1 month)
For example: for 5th of this month
- To get the CPU utilization of particular date, below command can be run.
sar -u -P ALL -f /var/log/sa/sa05
sar –u –P ALL –s 02:00:00 –e 03:00:00 –f /var/log/sa/sa05
- If one wants to get data for particular timeframe
Similarly one can get other metrics also like memory. disk i/o.
SAR - Linux Utility for System Monitoring
SAR - Very useful System Monitoring Utility