Sar in UNIX
Encyclopedia
In computing
,
command used to report on various system loads, including CPU activity, memory/paging, device load, network. Linux
distributions provide
-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.
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
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
,
sar
is a Solaris-derived system monitorSystem monitor
A system monitor is a hardware- or software- based system used to monitor resources and performance in a computer system.Software monitors occur more commonly, sometimes as a part of a widget engine. These monitoring systems are often used to keep track of system resources, such as CPU usage and...
command used to report on various system loads, including CPU activity, memory/paging, device load, network. Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
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:$ sarDisplays 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