Jump to content

Sar (Unix)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Pweltz (talk | contribs) at 20:18, 25 May 2011 (sar is not only about CPU: also memory,I/O etc..). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computing, sar is a is a Solaris-derived system monitor command used to report on various system loads, including CPU activity, memory/paging, device load, network. Linux distributions provide sar through the sysstat package.

Syntax

sar [-flags] [ -e time ] [ -f filename ] [-i sec ] [ -s time ]
-f filename Uses filename as the data source for sar . Default is the current daily data file /var/adm/sa/sadd.
-e time Selects data up to time . Default is 18:00.
-i sec Selects data at intervals as close as possible to sec seconds.

Example

user@localhost:$ sar

Displays today's CPU activity so far. You must have permission and the information must be present on the computer.

To add hourly and average CPU usage to a logfile: echo "SAR on the 1/2 hour and average CPU" >> $LOGFILE sar | head -4 | tail -1 >> $LOGFILE sar | tail -3 >> $LOGFILE

See also

  • sag - "system activity graph" command[1]

References

Footnotes

  1. ^ "sag(1)" (PDF). SUNOS Reference Manual. Mountain View, California: Sun Microsystems. 1993-02-24. p. 1231. Retrieved 2010-05-04. sag - system activity graph [...] DESCRIPTION sag graphically displays the system activity data stored in a binary data file by a previous sar(1) run.