Collect and report system activity statistics over time.
low risk
sar (System Activity Reporter) collects and reports CPU, memory, network, and disk statistics. Unlike vmstat/iostat which show current state, sar records historical data (when sadc daemon runs) enabling you to analyze what happened during an incident hours ago.
| Flag | Meaning |
|---|---|
-u --cpu | CPU utilization |
-r --memory | Memory statistics |
-n DEV | Network interface statistics |
-b --io | I/O statistics |
-f --file | Read from a saved data file |
sar -u 1 5CPU usage, every 1 second, 5 samples · explain & risk-check →sar -r 1 5Memory stats every second · explain & risk-check →sar -n DEV 1 3Network traffic per interface · explain & risk-check →sar -u -f /var/log/sysstat/sa01Review CPU history from a saved report · explain & risk-check →Enable sysstat's cron job (`/etc/cron.d/sysstat`) so sar continuously records history. After an incident, use `sar -u -f /var/log/sysstat/saNN` to replay what CPU/memory did during the event.
Reference text is hand-written and may be incomplete — check man sar for your version. Test destructive commands on a non-production system first.