linux_wiki:sar

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_wiki:sar [2014/12/03 21:57]
billdozor
linux_wiki:sar [2019/05/25 23:50] (current)
Line 1: Line 1:
 ====== sar (system activity report) ====== ====== sar (system activity report) ======
 +
 +**General Information**
 +
 sar is used for displaying collected activity counters of various OS stats, including CPU, memory, swap, and disk I/O. sar is used for displaying collected activity counters of various OS stats, including CPU, memory, swap, and disk I/O.
  
-sar is a command provided by the sysstat package.+**Checklist** 
 +  * Distro(s): Any 
 +  * Package: sar is a command provided by the "sysstatpackage. 
 + 
 +----
  
 ===== Installation and Configuration ===== ===== Installation and Configuration =====
Line 25: Line 32:
  
 Look for a line like this to edit: Look for a line like this to edit:
 +<code>
 # Activity reports every 10 minutes everyday # Activity reports every 10 minutes everyday
 5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1 5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
 +</code>
  
 4) Start the service 4) Start the service
Line 45: Line 54:
 After sysstat has collected data for a while, you can start to view the information with sar. After sysstat has collected data for a while, you can start to view the information with sar.
  
-=== Log location ===+==== Log location ====
 Sar logs to either: Sar logs to either:
   * /var/log/sysstat/   * /var/log/sysstat/
Line 63: Line 72:
 ---- ----
  
-=== CPU Utilization ===+==== CPU Utilization ====
 <code> <code>
 sar -u  (displays for current day until that point) sar -u  (displays for current day until that point)
Line 90: Line 99:
 ---- ----
  
-=== Memory (RAM) Stats ===+==== Memory (RAM) Stats ====
 <code> <code>
 sar -r  (display todays memory stats) sar -r  (display todays memory stats)
Line 111: Line 120:
 ---- ----
  
-=== Swap Stats ===+==== Swap Stats ====
 <code> <code>
 sar -S  (todays swap usage) sar -S  (todays swap usage)
Line 133: Line 142:
 ---- ----
  
-=== Disk I/O ===+==== Disk I/O ====
 <code> <code>
 sar -b  (todays disk I/O and transfer rates) sar -b  (todays disk I/O and transfer rates)
Line 150: Line 159:
   * rtps => read requests per second   * rtps => read requests per second
   * wtps => write requests per second   * wtps => write requests per second
-  * bread/s => total amount read in blocks per second(block = sector = 512 bytes) +  * bread/s => blocks read per second (block = sector = 512 bytes) 
-  * bwrtn/s => total amount of data written to devices in blocks per second(block = sector = 512 bytes)+  * bwrtn/s => blocks written per second (block = sector = 512 bytes)
  
 ---- ----
  
-=== Network Stats ===+==== Network Stats ====
 <code> <code>
 sar -n TYPE (todays network statistics) sar -n TYPE (todays network statistics)
Line 169: Line 178:
   * UDP => UDPv4 network traffic   * UDP => UDPv4 network traffic
   * ALL => All of the above (and more). Warning: this will be very long.   * ALL => All of the above (and more). Warning: this will be very long.
 +
 +Example (device stats for just eth1 from 5pm to 6pm today)
 +<code bash>
 +sar -n DEV -s 17:00:00 -e 18:00:00 | grep eth1
 +05:25:01 PM     IFACE   rxpck/  txpck/   rxkB/   txkB/  rxcmp/  txcmp/ rxmcst/  %ifutil
 +05:35:01 PM      eth1     13.77     11.45     12.31      1.37      0.00      0.00      0.05      0.01
 +05:45:01 PM      eth1     23.35     17.53     27.06      2.09      0.00      0.00      0.04      0.02
 +05:55:01 PM      eth1     50.00     35.92     63.80      3.92      0.00      0.00      0.04      0.05
 +Average:         eth1     29.04     21.64     34.39      2.46      0.00      0.00      0.04      0.03
 +</code>
  
 ---- ----
  
-=== Start and End === +==== Start and End ==== 
-<code>+Report only specfic time periods
  
 +CPU stats for today, from 6pm to 6:30pm
 +<code bash>
 +sar -u -s 18:00:00 -e 18:30:00  
 </code> </code>
  
 +Memory stats 1pm to 3pm, from the 1st day of the month
 <code bash> <code bash>
 +sar -r -s 13:00:00 -e 15:00:00 -f /var/log/sysstat/sa01
 </code> </code>
  • linux_wiki/sar.1417661828.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)