SAR(1)
๐ SAR(1) โ Linux User's Manual ๐
okay bestie, this is the manual page for sar, and it's giving "system activity reporter" ๐ฆ it's part of the Linux User's Manual, so this is the official SAR(1) page, and I'm gonna walk you through every single bit of it โจ
โจ NAME โจ
sar is the tool that collects, reports, or saves system activity information ๐ literally all of it in one place ๐
๐ SYNOPSIS ๐
sar [ -A ] [ -B ] [ -b ] [ -C ] [ -D ] [ -d ] [ -F [ MOUNT ] ] [ -H ] [
-h ] [ -p ] [ -r [ ALL ] ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [
-W ] [ -w ] [ -x ] [ -y ] [ -z ] [ --dec={ 0 | 1 | 2 } ] [
--dev=dev_list ] [ --fs=fs_list ] [ --help ] [ --human ] [
--iface=iface_list ] [ --int=int_list ] [ --pretty ] [ --sadc ] [ -I [
SUM | ALL ] ] [ -P { cpu_list | ALL } ] [ -m { keyword[,...] | ALL } ] [
-n { keyword[,...] | ALL } ] [ -q [ keyword[,...] | ALL ] ] [ -j { SID |
ID | LABEL | PATH | UUID | ... } ] [ -f [ filename ] | -o [ filename ] |
-[0-9]+ ] [ -i interval ] [ -s [ start_time ] ] [ -e [ end_time ] ] ] [
interval [ count ] ]
๐ธ DESCRIPTION ๐ธ
okay so the sar command writes to standard output whatever is inside the selected cumulative activity counters in the operating system ๐ the accounting system uses the count and interval parameters to decide how many times it writes info and how far apart those writes are spaced, in seconds ๐ซถ
if the interval parameter is set to zero, sar shows the average stats for the time since the system was started โฐ and if you give interval without count, the reports keep coming forever, continuously ๐
the collected data can also be saved to the file you specify with the -o filename flag, on top of showing up on your screen ๐พ if filename is left out, sar uses the standard system activity daily data file (more on that below) โจ by default, all the data the kernel has available gets saved into the data file ๐
the sar command can also extract records that were saved earlier and write them to standard output ๐ those records live in either the file you pick with the -f flag or, by default, the standard system activity daily data file ๐ you can also pass -1, -2 etc. as an argument to sar to display data from that many days ago ๐ฆ for example, -1 points at the standard system activity file of yesterday ๐
so the standard system activity daily data files are named saDD or saYYYYMMDD, where YYYY is the current year, MM is the current month, and DD is the current day ๐ they're only the default files sar uses when no filename has been explicitly specified, so no need to stress ๐ซถ when sar writes data to files (with the -o option), it uses saYYYYMMDD if the -D option was also specified, otherwise it uses saDD ๐
and when it's displaying records that were saved earlier, sar looks for the most recent of saDD and saYYYYMMDD and uses that one ๐
the standard system activity daily data files live in /var/log/sysstat by default ๐ but you can totally point somewhere else for them โจ if you use a directory (instead of a plain file) with the -f or -o options, then that directory gets treated as the directory holding the data files ๐ง
without the -P flag, sar reports system-wide stats (global across all processors) ๐ those get calculated as averages for values written as percentages, and as sums for everything else ๐ if you do use the -P flag, sar reports activity for the processor or processors you specify ๐ฅ and if you give -P ALL, it reports stats for each individual processor AND the global stats across all of them ๐คฏ offline processors are not displayed, so don't look for them ๐
you can select info about specific system activities using flags ๐ if you don't specify any flags, sar only selects CPU activity ๐ specifying the -A flag selects all possible activities, so that's your everything button โจ
the default version of sar (the CPU utilization report) is honestly probably one of the first things you'll run when you start investigating system activity ๐ because it monitors the major system resources ๐
if CPU utilization is near 100 percent (user + nice + system), the sampled workload is CPU-bound ๐ฅ
if you want multiple samples and multiple reports, it's super convenient to specify an output file for sar ๐ซถ run sar as a background process, and the syntax for that is:
sar -o datafile interval count >/dev/null 2>&1 &
all the data gets captured in binary form and saved to a file (datafile) ๐พ then you can selectively display it with sar using the -f option ๐ฆ set the interval and count parameters to select count records at interval second intervals โฑ๏ธ if count isn't set, all the records saved in the file get selected ๐
collecting data this way is hugely useful for characterizing system usage over a period of time and figuring out your peak usage hours ๐ literally iconic ๐
Note: the sar command only reports on local activities ๐ so it won't be telling you about anything happening somewhere else ๐
๐ OPTIONS ๐
-Aโ this is the everything flag ๐ it's equivalent to specifying-bBdFHISvwWy -m ALL -n ALL -q ALL -r ALL -u ALL. it also implies specifying-I ALL -P ALL, unless you've explicitly set those on the command line ๐-Bโ reports paging statistics ๐ these values get displayed:pgpgin/sโ total number of kibibytes the system paged in from disk per second ๐ฅpgpgout/sโ total number of kibibytes the system paged out to disk per second ๐คfault/sโ number of page faults (major + minor) made by the system per second ๐ this isn't a count of page faults that generate I/O, because some page faults can be resolved without I/O ๐majflt/sโ number of major faults the system has made per second, meaning the ones that needed a memory page loaded from disk ๐ซpgfree/sโ number of pages placed on the free list by the system per second โจpgscank/sโ number of pages scanned by thekswapddaemon per second ๐งpgscand/sโ number of pages scanned directly per second ๐pgsteal/sโ number of pages the system has reclaimed from cache (pagecache and swapcache) per second to satisfy its memory demands ๐งนpgprom/sโ number of pages promoted (i.e. migrated from slow to fast memory types) by the system per second ๐pgdem/sโ number of pages demoted (i.e. migrated from fast to slow memory types) by the system per second ๐
-bโ reports I/O and transfer rate statistics ๐ซ these values get displayed:tpsโ total number of transfers per second that were issued to physical devices ๐ฅ a transfer is an I/O request to a physical device, and multiple logical requests can be combined into a single I/O request to the device ๐ซถ a transfer is of indeterminate size ๐คทโโ๏ธrtpsโ total number of read requests per second issued to physical devices ๐wtpsโ total number of write requests per second issued to physical devices โ๏ธdtpsโ total number of discard requests per second issued to physical devices ๐๏ธbread/sโ total amount of data read from the devices in blocks per second ๐ blocks are equivalent to sectors, so they have a size of 512 bytes ๐bwrtn/sโ total amount of data written to devices in blocks per second ๐พbdscd/sโ total amount of data discarded for devices in blocks per second ๐
-Cโ when reading data from a file, tellssarto display comments that have been inserted bysadc๐ฌ-Dโ usessaYYYYMMDDinstead ofsaDDas the standard system activity daily data file name ๐ this option only works when it's used alongside the-ooption to save data to a file ๐ซถ-dโ reports activity for each block device ๐ฟ when data gets displayed, the device name is shown the way it (should) appear in/devโจsaruses data in/systo figure out the device name from its major and minor numbers ๐ if that name resolution fails,sarfalls back to the name mapping controlled by the/etc/sysstat/sysstat.ioconffile ๐บ๏ธ persistent device names can also be printed if the-joption is used (see below) ๐ท๏ธ stats for all devices are displayed unless you give a restricted list with the--dev=option (see its entry) ๐ heads up: disk activity depends onsadc's options-S DISKand-S XDISKbeing collected ๐จ these values get displayed:tpsโ total number of transfers per second that were issued to physical devices ๐ฅ a transfer is an I/O request to a physical device, multiple logical requests can be merged into one, and a transfer is of indeterminate size ๐ซถrkB/sโ number of kibibytes read from the device per second ๐wkB/sโ number of kibibytes written to the device per second โ๏ธdkB/sโ number of kibibytes discarded for the device per second ๐๏ธareq-szโ the average size (in kibibytes) of the I/O requests that were issued to the device ๐- Note: in previous versions, this field was known as
avgrq-szand was expressed in sectors ๐
- Note: in previous versions, this field was known as
aqu-szโ the average queue length of the requests that were issued to the device ๐งโโ๏ธ๐งโโ๏ธ๐งโโ๏ธ- Note: in previous versions, this field was known as
avgqu-sz๐ฐ๏ธ
- Note: in previous versions, this field was known as
awaitโ the average time (in milliseconds) for I/O requests issued to the device to be served โณ this includes the time the requests spend in the queue AND the time spent servicing them ๐%utilโ percentage of elapsed time during which I/O requests were issued to the device (the bandwidth utilization for the device) ๐ device saturation happens when this value is close to 100% for devices serving requests serially ๐ฅ but for devices serving requests in parallel, like RAID arrays and modern SSDs, this number does NOT reflect their performance limits ๐ โโ๏ธ
--dec={ 0 | 1 | 2 }โ specifies the number of decimal places to use (0 to 2, default value is2) ๐ข--dev=dev_listโ specifies the block devices whose statistics should be displayed bysar๐ฟdev_listis a list of comma-separated device names ๐ซถ
-e [ hh:mm[:ss] ] / -e [ seconds_since_the_epoch ] โจ
-e [ hh:mm[:ss] ],-e [ seconds_since_the_epoch ]โ this one sets when the report ends ๐ The default ending time is18:00:00. You can give hours in 24-hour format, or as seconds since the epoch (a 10 digit number) ๐งฎ Only really matters when you're reading from or writing to a file (-for-o) ๐-F [ MOUNT ]โ show stats for the filesystems that are currently mounted ๐พ Pseudo-filesystems get ignored, no drama ๐ โโ๏ธ At the very end,sardrops a summary of all of them. Pass theMOUNTkeyword and it reports the mountpoint instead of the filesystem device ๐บ๏ธ You get stats for every filesystem unless you narrow it down with--fs=(check that option's entry ๐). Also, filesystem stats only show up ifsadcwas run with its-S XDISKoption ๐ฅ
The following values are displayed:
MBfsfreeโ total free space in mebibytes, including the stuff only the privileged user can touch ๐MBfsusedโ total space used in mebibytes ๐ฆ%fsusedโ percentage of filesystem space used, as a privileged user sees it ๐%ufsusedโ percentage of filesystem space used, as an unprivileged user sees it ๐โโ๏ธIfreeโ total number of free file nodes (inodes) in the filesystem ๐Iusedโ total number of file nodes used in the filesystem ๐%Iusedโ percentage of file nodes used in the filesystem ๐ฏ
-f [ filename ]โ pull records out offilename(the one you made with-o filename) ๐๏ธ If you don't give a name, it defaults to the current standard system activity daily data file ๐ Iffilenameis a directory instead of a plain file,sartreats it as the folder where the standard daily data files live ๐๏ธ Heads up:-fand-ocan't be used together, they're exclusive ๐ โโ๏ธ--fs=fs_listโ pick which filesystemssarshould show stats for ๐ฏfs_listis a comma-separated list of filesystem names or mountpoints ๐งพ-Hโ report hugepages utilization stats ๐ง The following values are displayed:kbhugfreeโ amount of hugepages memory in kibibytes that hasn't been allocated yet ๐kbhugusedโ amount of hugepages memory in kibibytes that has been allocated ๐%hugusedโ percentage of total hugepages memory that's been allocated ๐kbhugrsvdโ amount of reserved hugepages memory in kibibytes ๐kbhugsurpโ amount of surplus hugepages memory in kibibytes ๐
-hโ this is the same as typing--pretty --human๐ซถ--helpโ shows a short help message, then exits ๐--humanโ prints sizes in a human readable format, like1.0kor1.2M๐ The units this gives you override any other default units tied to the metrics, like kibibytes or sectors. Main character energy โจ-I [ SUM | ALL ]โ report interrupt stats ๐ฉ๏ธ You get the number of interrupts per second, either for a given processor or across all processors ๐ฅ๏ธ You can narrow it to a list of interrupts with--int=(go read that entry ๐). TheSUMkeyword shows the total number of interrupts received per second ๐งฎ TheALLkeyword reports stats from every interrupt, and it's the default ๐ซง Note that this needssadc's-S INToption to have been used to collect the data ๐ฅ-i intervalโ selects data records at seconds as close as possible to the number you give forinterval๐ฏ--iface=iface_listโ choose which network interfacessarshows stats for ๐iface_listis a comma-separated list of interface names ๐งต--int=int_listโ choose which interrupt namessarshows stats for ๐int_listis a comma-separated list of values or ranges, like0-16,35,40-๐ง-j { SID | ID | LABEL | PATH | UUID | ... }โ displays persistent device names ๐ Use it together with-d๐ค The keywordsID,LABEL, and so on tell it which type of persistent name you want. The list isn't limited to these, the only real requirement is that the directory holding the persistent names exists in/dev/disk๐ TheSIDkeyword tries to get a stable identifier to use as the device name ๐ชช A stable identifier won't change across reboots for the same physical device. When one exists, it's usually the WWN (World Wide Name) of the device, read from the/dev/disk/by-iddirectory ๐-m { keyword[,...] | ALL }โ report power management stats โก Heads up: these needsadc's-S POWERoption to have been used when collecting ๐
Possible keywords are BAT, CPU, FAN, FREQ, IN, TEMP and USB ๐
BATโ battery capacity stats get reported ๐ The following values are displayed:%capโ battery capacity ๐ชcap/minโ capacity the battery lost or gained per minute ๐๐statusโ charging status of the battery:โ(full),โ(charging),โ(not charging),โ(discharging),?(unknown) ๐น๏ธ
CPUโ CPU stats get reported ๐ง The following value is displayed:MHzโ instantaneous CPU clock frequency in MHz ๐๏ธ
FANโ fan speed stats get reported ๐ The following values are displayed:rpmโ fan speed in revolutions per minute ๐drpmโ calculated as the difference between the current fan speed (rpm) and its low limit (fan_min) ๐DEVICEโ sensor device name ๐ท๏ธ
FREQโ CPU clock frequency stats get reported ๐ข The following value is displayed:wghMHzโ weighted average CPU clock frequency in MHz ๐งฎ Also, the cpufreq-stats driver has to be compiled into the kernel for this to work, no cap ๐งข
INโ voltage input stats get reported โก The following values are displayed:inVโ voltage input in Volts ๐%inโ relative input value. 100% means the voltage input has hit its high limit (in_max), and 0% means it hit its low limit (in_min) ๐๏ธDEVICEโ sensor device name ๐ท๏ธ
TEMPโ device temperature stats get reported ๐ก๏ธ The following values are displayed:degCโ device temperature in degrees Celsius ๐ฅต%tempโ relative device temperature. 100% means it's reached its high limit (temp_max) ๐ฅDEVICEโ sensor device name ๐ท๏ธ
USBโsartakes a snapshot of every USB device plugged into the system right now ๐ At the end of the report, it shows a summary of all those USB devices ๐งพ The following values are displayed:BUSโ root hub number of the USB device ๐idvendorโ vendor ID number (assigned by the USB organization) ๐ฌidprodโ product ID number (assigned by the manufacturer) ๐maxpowerโ maximum power consumption of the device, in mA โกmanufactโ manufacturer name ๐ญproductโ product name ๐๏ธ
The ALL keyword is the same as listing every keyword above, so you get all the power management stats ๐
-n { keyword[,...] | ALL }โ report network stats ๐
Possible keywords are DEV, EDEV, FC, ICMP, EICMP, ICMP6, EICMP6, IP, EIP, IP6, EIP6, NFS, NFSD, SOCK, SOCK6, SOFT, TCP, ETCP, UDP and UDP6 ๐งฉ
DEVโ stats from the network devices get reported ๐ก You get every network interface unless you narrow it down with--iface=(see that entry ๐). The following values are displayed:IFACEโ name of the network interface being reported ๐ท๏ธrxpck/sโ total number of packets received per second ๐ฅtxpck/sโ total number of packets transmitted per second ๐คrxkB/sโ total number of kibibytes received per second ๐งtxkB/sโ total number of kibibytes transmitted per second ๐rxcmp/sโ number of compressed packets received per second (for cslip and friends) ๐๏ธtxcmp/sโ number of compressed packets transmitted per second ๐๏ธrxmcst/sโ number of multicast packets received per second ๐ข%ifutilโ utilization percentage of the network interface. For half-duplex interfaces, it's calculated using the sum ofrxkB/sandtxkB/sas a percentage of the interface speed. For full-duplex, it's the greater ofrxkB/SortxkB/s๐งฎ
EDEVโ stats on failures (errors) from the network devices get reported ๐จ Again, you get every interface unless you narrow it with--iface=(see corresponding entry ๐). The following values are displayed:IFACEโ name of the network interface being reported ๐ท๏ธrxerr/sโ total number of bad packets received per second ๐ โโ๏ธtxerr/sโ total number of errors that happened per second while transmitting packets ๐ฅcoll/sโ number of collisions that happened per second while transmitting packets ๐๐ฅ๐rxdrop/sโ number of received packets dropped per second because linux buffers ran out of space ๐ชฃtxdrop/sโ number of transmitted packets dropped per second because linux buffers ran out of space ๐ซtxcarr/sโ number of carrier-errors that happened per second while transmitting packets ๐ก๐rxfram/sโ number of frame alignment errors that happened per second on received packets ๐งฑ
rxfifo/sโ bestie, this one counts the FIFO overrun errors per second on received packets ๐ฅ๐txfifo/sโ same chaotic energy, but for transmitted packets ๐คโจ
๐พ FC
With the FC keyword, we get the fibre channel traffic stats ๐ซถ Heads up: these depend on sadc's option -S DISK being collected, so make sure that's on. Here's what you get:
FCHOSTโ the name of the fibre channel host bus adapter (HBA) interface the stats are for ๐งfch_rxf/sโ the total number of frames received per second ๐จfch_txf/sโ the total number of frames transmitted per second ๐คfch_rxw/sโ the total number of transmission words received per second ๐fch_txw/sโ the total number of transmission words transmitted per second ๐ธ
๐ ICMP
With the ICMP keyword, we're looking at ICMPv4 network traffic ๐ฆ Note that ICMPv4 stats depend on sadc's option -S SNMP being collected. The formal SNMP names are in square brackets, so you can match them up:
imsg/sโ the total number of ICMP messages the entity received per second[icmpInMsgs]. This counter includes everything counted byierr/s, so it's a big-picture one ๐omsg/sโ the total number of ICMP messages this entity tried to send per second[icmpOutMsgs]. This one also includes everything counted byoerr/s๐iech/sโ ICMP Echo (request) messages received per second[icmpInEchos]๐iechr/sโ ICMP Echo Reply messages received per second[icmpInEchoReps]๐oech/sโ ICMP Echo (request) messages sent per second[icmpOutEchos]๐oechr/sโ ICMP Echo Reply messages sent per second[icmpOutEchoReps]๐itm/sโ ICMP Timestamp (request) messages received per second[icmpInTimestamps]โฐitmr/sโ ICMP Timestamp Reply messages received per second[icmpInTimestampReps]โฑ๏ธotm/sโ ICMP Timestamp (request) messages sent per second[icmpOutTimestamps]๐ฐ๏ธotmr/sโ ICMP Timestamp Reply messages sent per second[icmpOutTimestampReps]๐งiadrmk/sโ ICMP Address Mask Request messages received per second[icmpInAddrMasks]๐ญiadrmkr/sโ ICMP Address Mask Reply messages received per second[icmpInAddrMaskReps]๐ญoadrmk/sโ ICMP Address Mask Request messages sent per second[icmpOutAddrMasks]๐ซงoadrmkr/sโ ICMP Address Mask Reply messages sent per second[icmpOutAddrMaskReps]๐ซง
๐จ EICMP
With the EICMP keyword, we're getting into the ICMPv4 error messages ๐ญ Same deal: these depend on sadc's option -S SNMP. SNMP names are in square brackets again:
ierr/sโ ICMP messages per second that the entity received but flagged as having ICMP-specific errors (bad ICMP checksums, bad length, etc.)[icmpInErrors]๐oerr/sโ ICMP messages per second that this entity didn't send because of problems found within ICMP, like a lack of buffers[icmpOutErrors]๐ซidstunr/sโ ICMP Destination Unreachable messages received per second[icmpInDestUnreachs]๐งodstunr/sโ ICMP Destination Unreachable messages sent per second[icmpOutDestUnreachs]๐งitmex/sโ ICMP Time Exceeded messages received per second[icmpInTimeExcds]โotmex/sโ ICMP Time Exceeded messages sent per second[icmpOutTimeExcds]โiparmpb/sโ ICMP Parameter Problem messages received per second[icmpInParmProbs]๐งฉoparmpb/sโ ICMP Parameter Problem messages sent per second[icmpOutParmProbs]๐งฉisrcq/sโ ICMP Source Quench messages received per second[icmpInSrcQuenchs]๐ซฅosrcq/sโ ICMP Source Quench messages sent per second[icmpOutSrcQuenchs]๐ซฅiredir/sโ ICMP Redirect messages received per second[icmpInRedirects]๐oredir/sโ ICMP Redirect messages sent per second[icmpOutRedirects]๐
๐ ICMP6
With the ICMP6 keyword, it's ICMPv6 network traffic time ๐ These depend on sadc's option -S IPV6 being collected. Formal SNMP names are in square brackets:
imsg6/sโ the total number of ICMP messages the interface received per second, including everything counted byierr6/s[ipv6IfIcmpInMsgs]๐omsg6/sโ the total number of ICMP messages this interface tried to send per second[ipv6IfIcmpOutMsgs]๐iech6/sโ ICMP Echo (request) messages the interface received per second[ipv6IfIcmpInEchos]๐iechr6/sโ ICMP Echo Reply messages the interface received per second[ipv6IfIcmpInEchoReplies]๐oechr6/sโ ICMP Echo Reply messages the interface sent per second[ipv6IfIcmpOutEchoReplies]๐igmbq6/sโ ICMPv6 Group Membership Query messages the interface received per second[ipv6IfIcmpInGroupMembQueries]๐ซงigmbr6/sโ ICMPv6 Group Membership Response messages the interface received per second[ipv6IfIcmpInGroupMembResponses]๐ซงogmbr6/sโ ICMPv6 Group Membership Response messages sent per second[ipv6IfIcmpOutGroupMembResponses]๐ซงigmbrd6/sโ ICMPv6 Group Membership Reduction messages the interface received per second[ipv6IfIcmpInGroupMembReductions]๐ชogmbrd6/sโ ICMPv6 Group Membership Reduction messages sent per second[ipv6IfIcmpOutGroupMembReductions]๐ชirtsol6/sโ ICMP Router Solicit messages the interface received per second[ipv6IfIcmpInRouterSolicits]๐งญortsol6/sโ ICMP Router Solicitation messages the interface sent per second[ipv6IfIcmpOutRouterSolicits]๐งญirtad6/sโ ICMP Router Advertisement messages the interface received per second[ipv6IfIcmpInRouterAdvertisements]๐ฃinbsol6/sโ ICMP Neighbor Solicit messages the interface received per second[ipv6IfIcmpInNeighborSolicits]๐๏ธonbsol6/sโ ICMP Neighbor Solicitation messages the interface sent per second[ipv6IfIcmpOutNeighborSolicits]๐๏ธinbad6/sโ ICMP Neighbor Advertisement messages the interface received per second[ipv6IfIcmpInNeighborAdvertisements]๐onbad6/sโ ICMP Neighbor Advertisement messages the interface sent per second[ipv6IfIcmpOutNeighborAdvertisements]๐
๐ฅ EICMP6
With the EICMP6 keyword, we're checking the ICMPv6 error messages ๐ฅฒ These depend on sadc's option -S IPV6. Formal SNMP names are in square brackets:
ierr6/sโ ICMP messages per second that the interface received but flagged as having ICMP-specific errors (bad ICMP checksums, bad length, etc.)[ipv6IfIcmpInErrors]๐idtunr6/sโ ICMP Destination Unreachable messages the interface received per second[ipv6IfIcmpInDestUnreachs]๐งodtunr6/sโ ICMP Destination Unreachable messages the interface sent per second[ipv6IfIcmpOutDestUnreachs]๐งitmex6/sโ ICMP Time Exceeded messages the interface received per second[ipv6IfIcmpInTimeExcds]โotmex6/sโ ICMP Time Exceeded messages the interface sent per second[ipv6IfIcmpOutTimeExcds]โiprmpb6/sโ ICMP Parameter Problem messages the interface received per second[ipv6IfIcmpInParmProblems]๐งฉoprmpb6/sโ ICMP Parameter Problem messages the interface sent per second[ipv6IfIcmpOutParmProblems]๐งฉiredir6/sโ Redirect messages the interface received per second[ipv6IfIcmpInRedirects]๐oredir6/sโ Redirect messages the interface sent by second[ipv6IfIcmpOutRedirects]๐ipck2b6/sโ ICMP Packet Too Big messages the interface received per second[ipv6IfIcmpInPktTooBigs]๐ฆopck2b6/sโ ICMP Packet Too Big messages the interface sent per second[ipv6IfIcmpOutPktTooBigs]๐ฆ
๐ IP
With the IP keyword, we're getting the IPv4 network traffic stats ๐ Note that IPv4 stats depend on sadc's option -S SNMP being collected. Formal SNMP names are in square brackets, so keep an eye out for them:
irec/sโ Okay so this is the total number of input datagrams that came in from interfaces per second, and yes, that includes the ones that arrived broken ๐ [ipInReceives].fwddgm/sโ Datagrams per second that weren't meant for this entity at all, so it went hunting for a route to pass them along to their real final destination ๐ฆ [ipForwDatagrams].idel/sโ The total number of input datagrams successfully delivered per second up to the IP user-protocols, ICMP included ๐ [ipInDelivers].orq/sโ The total number of IP datagrams that local IP user-protocols (ICMP included) handed to IP per second as transmission requests ๐ฎ [ipOutRequests]. Heads up, this counter doesn't include anything already counted infwddgm/s๐.asmrq/sโ The number of IP fragments received per second that had to be reassembled here ๐งฉ [ipReasmReqds].asmok/sโ The number of IP datagrams successfully reassembled per second โจ [ipReasmOKs].fragok/sโ The number of IP datagrams successfully fragmented at this entity per second ๐ฐ [ipFragOKs].fragcrt/sโ The number of IP datagram fragments generated per second because of fragmentation at this entity ๐ซถ [ipFragCreates].
With the EIP keyword, you get the IPv4 network error stats. Real talk, IPv4 stats need sadc's option -S SNMP to be collected, or they won't show up ๐. These are the values displayed (formal SNMP names in square brackets):
ihdrerr/sโ The number of input datagrams discarded per second because of errors in their IP headers. That covers bad checksums, version number mismatches, other format errors, time-to-live exceeded, errors found while processing their IP options, and so on ๐ [ipInHdrErrors].iadrerr/sโ The number of input datagrams discarded per second because the IP address in their header's destination field wasn't valid to receive at this entity. This includes invalid addresses (like0.0.0.0) and addresses from unsupported Classes (like Class E). For entities that aren't IP routers, and therefore don't forward datagrams, it also counts datagrams dropped because the destination wasn't a local address ๐ซ [ipInAddrErrors].iukwnpr/sโ The number of locally-addressed datagrams received successfully but discarded per second because the protocol was unknown or unsupported ๐คทโโ๏ธ [ipInUnknownProtos].idisc/sโ The number of input IP datagrams per second that had no problems stopping them from being processed, but got discarded anyway (for example, for lack of buffer space) ๐๏ธ [ipInDiscards]. This counter doesn't include datagrams discarded while waiting for reassembly.odisc/sโ The number of output IP datagrams per second that had no problem stopping them from reaching their destination, but got discarded anyway (for example, for lack of buffer space) ๐ค [ipOutDiscards]. Note that this counter would include datagrams counted infwddgm/sif any of them met this (discretionary) discard criterion.onort/sโ The number of IP datagrams discarded per second because no route could be found to get them to their destination ๐งญ [ipOutNoRoutes]. This counter includes any packets counted infwddgm/sthat meet this 'no-route' criterion. It also includes any datagrams a host can't route because all of its default routers are down.asmf/sโ The number of failures per second detected by the IP reassembly algorithm, for whatever reason (timed out, errors, etc.) ๐ [ipReasmFails]. This isn't necessarily a count of discarded IP fragments, because some algorithms can lose track of how many fragments there are when they combine them as they arrive.fragf/sโ The number of IP datagrams discarded per second because they needed to be fragmented at this entity but couldn't be, for example because their Don't Fragment flag was set ๐ง [ipFragFails].
With the IP6 keyword, you get the IPv6 network traffic stats. Same deal as before: IPv6 stats need sadc's option -S IPV6 to be collected ๐
. These are the values displayed (formal SNMP names in square brackets):
irec6/sโ The total number of input datagrams received from interfaces per second, including the ones received in error [ipv6IfStatsInReceives].fwddgm6/sโ The number of output datagrams per second that this entity received and forwarded on to their final destinations ๐ฆ [ipv6IfStatsOutForwDatagrams].idel6/sโ The total number of datagrams successfully delivered per second to the IPv6 user-protocols, ICMP included ๐ [ipv6IfStatsInDelivers].orq6/sโ The total number of IPv6 datagrams that local IPv6 user-protocols (ICMP included) supplied per second to IPv6 as transmission requests ๐ฎ [ipv6IfStatsOutRequests]. This counter doesn't include any datagrams counted infwddgm6/s.asmrq6/sโ The number of IPv6 fragments received per second that needed to be reassembled at this interface ๐งฉ [ipv6IfStatsReasmReqds].asmok6/sโ The number of IPv6 datagrams successfully reassembled per second โจ [ipv6IfStatsReasmOKs].imcpck6/sโ The number of multicast packets received per second by the interface ๐ก [ipv6IfStatsInMcastPkts].omcpck6/sโ The number of multicast packets transmitted per second by the interface ๐ฃ [ipv6IfStatsOutMcastPkts].fragok6/sโ The number of IPv6 datagrams successfully fragmented at this output interface per second ๐ฐ [ipv6IfStatsOutFragOKs].fragcr6/sโ The number of output datagram fragments generated per second because of fragmentation at this output interface ๐ซถ [ipv6IfStatsOutFragCreates].
With the EIP6 keyword, you get the IPv6 network error stats. Once again, these depend on sadc's option -S IPV6 being collected ๐ธ. These are the values displayed (formal SNMP names in square brackets):
ihdrer6/sโ The number of input datagrams discarded per second because of errors in their IPv6 headers. That includes version number mismatches, other format errors, hop count exceeded, errors found while processing their IPv6 options, and so on ๐ [ipv6IfStatsInHdrErrors]iadrer6/sโ The number of input datagrams discarded per second because the IPv6 address in their header's destination field wasn't valid to receive at this entity. This includes invalid addresses (like::0) and unsupported addresses (like addresses with unallocated prefixes). For entities that aren't IPv6 routers, and therefore don't forward datagrams, it also counts datagrams dropped because the destination wasn't a local address ๐ซ [ipv6IfStatsInAddrErrors].iukwnp6/sโ The number of locally-addressed datagrams received successfully but discarded per second because the protocol was unknown or unsupported ๐คทโโ๏ธ [ipv6IfStatsInUnknownProtos].i2big6/sโ The number of input datagrams per second that couldn't be forwarded because their size was bigger than the link MTU of the outgoing interface ๐ [ipv6IfStatsInTooBigErrors].idisc6/sโ The number of input IPv6 datagrams per second that had no problems stopping them from being processed, but got discarded anyway (for example, for lack of buffer space) ๐๏ธ [ipv6IfStatsInDiscards]. This counter doesn't include datagrams discarded while waiting for reassembly.odisc6/sโ The number of output IPv6 datagrams per second that had no problem stopping them from reaching their destination, but got discarded anyway (for example, for lack of buffer space) ๐ค [ipv6IfStatsOutDiscards]. This counter would include datagrams counted infwddgm6/sif any of them met this (discretionary) discard criterion.inort6/sโ The number of input datagrams discarded per second because no route could be found to get them to their destination ๐งญ [ipv6IfStatsInNoRoutes].onort6/sโ The number of locally generated IP datagrams discarded per second because no route could be found to get them to their destination ๐งญ [unknown formal SNMP name].asmf6/sโ The number of failures per second detected by the IPv6 reassembly algorithm, for whatever reason (timed out, errors, etc.) ๐ [ipv6IfStatsReasmFails]. This isn't necessarily a count of discarded IPv6 fragments, because some algorithms can lose track of how many fragments there are when they combine them as they arrive.fragf6/sโ okay so this one counts the IPv6 datagrams that got tossed each second because they needed fragmenting at this output interface but couldn't be ๐ [ipv6IfStatsOutFragFails].itrpck6/sโ the input datagrams dropped each second because the datagram frame didn't carry enough data to be valid ๐ [ipv6IfStatsInTruncatedPkts].
With the NFS keyword, we get the receipts on NFS client activity ๐งพ The following values are displayed:
call/sโ how many RPC requests the client made per second ๐retrans/sโ how many of those RPC requests per second had to be sent again, like when the server timed out ๐คread/sโ how many'read'RPC calls were made per second ๐write/sโ how many'write'RPC calls were made per second โ๏ธaccess/sโ how many'access'RPC calls were made per second ๐getatt/sโ how many'getattr'RPC calls were made per second ๐
With the NFSD keyword, we get the tea on NFS server activity โ The following values are displayed:
scall/sโ how many RPC requests the server received per second ๐ฅbadcall/sโ how many bad RPC requests came in per second, the ones whose processing ended up throwing an error ๐packet/sโ how many network packets were received per second ๐ฆudp/sโ how many UDP packets were received per second ๐ฆtcp/sโ how many TCP packets were received per second ๐งตhit/sโ how many reply cache hits happened per second ๐ฏmiss/sโ how many reply cache misses happened per second ๐sread/sโ how many'read'RPC calls were received per second ๐swrite/sโ how many'write'RPC calls were received per second โ๏ธsaccess/sโ how many'access'RPC calls were received per second ๐sgetatt/sโ how many'getattr'RPC calls were received per second ๐
With the SOCK keyword, we check the socket situation that's in use (IPv4) ๐งฆ The following values are displayed:
totsckโ the total number of sockets the system is using, full stop ๐ธtcpsckโ how many TCP sockets are in use right now ๐งตudpsckโ how many UDP sockets are in use right now ๐ฆrawsckโ how many RAW sockets are in use right now ๐ฅฉip-fragโ how many IP fragments are sitting in the queue right now ๐งฉtcp-twโ how many TCP sockets are in theTIME_WAITstate โณ
With the SOCK6 keyword, we check the socket situation in use (IPv6) ๐ Heads up, IPv6 stats only show up if you collect them with sadc's option -S IPV6 โ ๏ธ The following values are displayed:
tcp6sckโ how many TCPv6 sockets are in use right now ๐งตudp6sckโ how many UDPv6 sockets are in use right now ๐ฆraw6sckโ how many RAWv6 sockets are in use right now ๐ฅฉip6-fragโ how many IPv6 fragments are currently in use ๐งฉ
With the SOFT keyword, we peek at the software-based network processing ๐ง The following values are displayed:
total/sโ the total number of network frames processed per second ๐dropd/sโ the total number of network frames dropped per second because the processing queue had no room left ๐๏ธsqueezd/sโ how many times per second the softirq handler function stopped because its budget ran out or it hit the time limit, even though there was still more work it could've done ๐ฉrx_rps/sโ how many times per second the CPU got woken up to process packets via an inter-processor interrupt โฐflw_lim/sโ how many times per second the flow limit got reached ๐ง Flow limiting is an optional RPS feature that caps how many packets can be queued to the backlog for each flow, to a certain amount. It's giving fairness, because it helps make sure the smaller flows still get processed even when the much bigger flows are pushing packets in like crazy ๐ซถblg_lenโ the length of the network backlog ๐
With the TCP keyword, we get the tea on TCPv4 network traffic ๐ต Note that TCPv4 stats depend on sadc's option -S SNMP being collected โ ๏ธ The following values are displayed (formal SNMP names are in square brackets):
active/sโ how many times per second TCP connections went straight from CLOSED to SYN-SENT [tcpActiveOpens] ๐passive/sโ how many times per second TCP connections went straight from LISTEN to SYN-RCVD [tcpPassiveOpens] ๐iseg/sโ the total number of segments received per second, errors included [tcpInSegs] ๐ฅ This count includes segments received on connections that are currently established ๐คoseg/sโ the total number of segments sent per second [tcpOutSegs] ๐ค This includes the ones on current connections but leaves out the ones that only contained retransmitted octets ๐
With the ETCP keyword, we check the TCPv4 network errors ๐จ Note that TCPv4 stats depend on sadc's option -S SNMP being collected โ ๏ธ The following values are displayed (formal SNMP names are in square brackets):
atmptf/sโ how many times per second TCP connections went to CLOSED from SYN-SENT or SYN-RCVD, plus how many times per second they went to LISTEN from SYN-RCVD [tcpAttemptFails] ๐estres/sโ how many times per second TCP connections went to CLOSED from ESTABLISHED or CLOSE-WAIT [tcpEstabResets] ๐ซretrseg/sโ the total number of segments retransmitted per second, meaning TCP segments sent that contained one or more previously transmitted octets [tcpRetransSegs] ๐isegerr/sโ the total number of segments received in error per second, like bad TCP checksums [tcpInErrs] ๐ โโ๏ธorsts/sโ how many TCP segments per second were sent with the RST flag set [tcpOutRsts] ๐
With the UDP keyword, we look at UDPv4 network traffic ๐ฆ Note that UDPv4 stats depend on sadc's option -S SNMP being collected โ ๏ธ The following values are displayed (formal SNMP names are in square brackets):
idgm/sโ the total number of UDP datagrams delivered per second to UDP users [udpInDatagrams] ๐ฌodgm/sโ the total number of UDP datagrams sent per second from this entity [udpOutDatagrams] ๐คnoport/sโ the total number of received UDP datagrams per second that had no application at the destination port [udpNoPorts] ๐๏ธidgmerr/sโ the number of received UDP datagrams per second that couldn't be delivered for reasons other than having no application at the destination port [udpInErrors] ๐ต
With the UDP6 keyword, we look at UDPv6 network traffic ๐ Note that UDPv6 stats depend on sadc's option -S IPV6 being collected โ ๏ธ The following values are displayed (formal SNMP names are in square brackets):
idgm6/sโ the total number of UDP datagrams delivered per second to UDP users [udpInDatagrams] ๐ฌodgm6/sโ the total number of UDP datagrams sent per second from this entity [udpOutDatagrams] ๐คnoport6/sโ the total number of received UDP datagrams per second that had no application at the destination port [udpNoPorts] ๐๏ธidgmer6/sโ the number of received UDP datagrams per second that couldn't be delivered for reasons other than having no application at the destination port [udpInErrors] ๐ต
The ALL keyword is basically the whole main character lineup ๐ It's the same as typing every keyword above, so all the network activities get reported ๐
-o [ *filename* ]โ okay this one saves your readings to a file in binary form ๐พ Each reading gets its own separate record. The default filename is the current standard system activity daily data file ๐ If filename is a directory instead of a plain file, then it's treated as the directory where the standard system activity daily data files live ๐๏ธ Heads up,-ocan't be used together with-f๐ All the data available from the kernel gets saved to the file, because sar calls its data collector sadc with the option-S ALL๐ง (See the sadc(8) manual page for more.)-P { *cpu_list* | ALL }โ reports per-processor stats for the processor or processors you pick ๐ฅ๏ธ cpu_list is a list of comma-separated values or a range of values, like0,2,4-7,12-๐ Processor0is the first processor, and processorallis the global average across all processors โจ Using theALLkeyword reports stats for each individual processor, plus the global stats for all processors together ๐ Offline processors don't get displayed ๐-p,--prettyโ makes reports easier for humans to read ๐ง This one is especially useful when you're looking at network interface or block device stats ๐-q [ *keyword*[,...] | ALL ]โ reports system load and pressure-stall stats ๐
Possible keywords are CPU, IO, LOAD, MEM and PSI ๐ธ
With the CPU keyword, we get the CPU pressure stats ๐ค The following values are displayed:
%scpu-10โ the percentage of time that at least some runnable tasks were delayed because the CPU wasn't available to them, measured over the last 10 second window โฑ๏ธ
Okay so the pressure stats are where it gets spicy ๐ถ๏ธ Each % field tells you how often tasks were stuck, and the number at the end is the time window.
%scpu-60โ ๐ฅ Percentage of the time that at least some runnable tasks were delayed because the CPU was unavailable to them, over the last 60 second window.%scpu-300โ ๐ฅ Same vibe, but over the last 300 second window.%scpuโ ๐ฅ Same vibe again, but over the last time interval.
With the IO keyword, you get I/O pressure stats ๐พ Here's what shows up:
%sio-10โ Percentage of the time that at least some tasks lost waiting for I/O, over the last 10 second window.%sio-60โ Percentage of the time that at least some tasks lost waiting for I/O, over the last 60 second window.%sio-300โ Percentage of the time that at least some tasks lost waiting for I/O, over the last 300 second window.%sioโ Percentage of the time that at least some tasks lost waiting for I/O, over the last time interval.%fio-10โ Percentage of the time during which all non-idle tasks were stalled waiting for I/O, over the last 10 second window. ๐%fio-60โ Percentage of the time during which all non-idle tasks were stalled waiting for I/O, over the last 60 second window. ๐%fio-300โ Percentage of the time during which all non-idle tasks were stalled waiting for I/O, over the last 300 second window. ๐%fioโ Percentage of the time during which all non-idle tasks were stalled waiting for I/O, over the last time interval. ๐
With the LOAD keyword, you get queue length and load averages ๐ These are the values:
runq-szโ Run queue length (number of tasks running or waiting for run time).plist-szโ Number of tasks in the task list.ldavg-1โ System load average for the last minute. The load average is calculated as the average number of runnable or running tasks (R state), and the number of tasks in uninterruptible sleep (D state) over the specified interval.ldavg-5โ System load average for the past 5 minutes.ldavg-15โ System load average for the past 15 minutes.blockedโ Number of tasks currently blocked, waiting for I/O to complete.
With the MEM keyword, you get memory pressure stats ๐ง Here's the lineup:
%smem-10โ Percentage of the time during which at least some tasks were waiting for memory resources, over the last 10 second window.%smem-60โ Percentage of the time during which at least some tasks were waiting for memory resources, over the last 60 second window.%smem-300โ Percentage of the time during which at least some tasks were waiting for memory resources, over the last 300 second window.%smemโ Percentage of the time during which at least some tasks were waiting for memory resources, over the last time interval.%fmem-10โ Percentage of the time during which all non-idle tasks were stalled waiting for memory resources, over the last 10 second window. ๐%fmem-60โ Percentage of the time during which all non-idle tasks were stalled waiting for memory resources, over the last 60 second window. ๐%fmem-300โ Percentage of the time during which all non-idle tasks were stalled waiting for memory resources, over the last 300 second window. ๐%fmemโ Percentage of the time during which all non-idle tasks were stalled waiting for memory resources, over the last time interval. ๐
The PSI keyword is basically CPU, IO and MEM all bundled together ๐ so you get every pressure-stall stat at once.
The ALL keyword is the whole buffet ๐ It's the same as naming every keyword above, so every single stat gets reported.
-r [ ALL ]โ ๐ง Reports memory utilization stats. TheALLkeyword means every memory field gets displayed. These are the values that may show up:kbmemfreeโ Amount of free memory available in kibibytes.kbavailโ Estimate of how much memory in kibibytes is available for starting new applications, without swapping. The estimate takes into account that the system needs some page cache to function well, and that not all reclaimable slab will be reclaimable, due to items being in use. The impact of those factors will vary from system to system.kbmemusedโ Amount of used memory in kibibytes (calculated as total installed memory - kbmemfree - kbbuffers - kbcached - kbslab).%memusedโ Percentage of used memory.kbbuffersโ Amount of memory used as buffers by the kernel in kibibytes.kbcachedโ Amount of memory used to cache data by the kernel in kibibytes.kbcommitโ Amount of memory in kibibytes needed for current workload. This is an estimate of how much RAM/swap is needed to guarantee that there never is out of memory.%commitโ Percentage of memory needed for current workload in relation to the total amount of memory (RAM+swap). This number may be greater than 100% because the kernel usually overcommits memory.kbactiveโ Amount of active memory in kibibytes (memory that has been used more recently and usually not reclaimed unless absolutely necessary).kbinactโ Amount of inactive memory in kibibytes (memory which has been less recently used. It is more eligible to be reclaimed for other purposes).kbdirtyโ Amount of memory in kibibytes waiting to get written back to the disk.kbanonpgโ Amount of non-file backed pages in kibibytes mapped into userspace page tables.kbslabโ Amount of memory in kibibytes used by the kernel to cache data structures for its own use.kbkstackโ Amount of memory in kibibytes used for kernel stack space.kbpgtblโ Amount of memory in kibibytes dedicated to the lowest level of page tables.kbvmusedโ Amount of memory in kibibytes of used virtual address space.
-Sโ ๐ Reports swap space utilization stats. These are the values displayed:kbswpfreeโ Amount of free swap space in kibibytes.kbswpusedโ Amount of used swap space in kibibytes.%swpusedโ Percentage of used swap space.kbswpcadโ Amount of cached swap memory in kibibytes. This is memory that once was swapped out, is swapped back in but still also is in the swap area (if memory is needed it doesn't need to be swapped out again because it is already in the swap area. This saves I/O).%swpcadโ Percentage of cached swap memory in relation to the amount of used swap space.
-s [ hh:mm[:ss] ]and-s [ seconds_since_the_epoch ]โ โฐ Sets the starting time of the data, sosarpulls records time-tagged at, or following, the time you give it. The default starting time is08:00:00. Hours have to be in 24-hour format, or you can give the number of seconds since the epoch (a 10 digit number). This option only works when data is read from a file (option-f).--sadcโ ๐ Tells you which data collectorsarcalls. If the data collector is hiding somewhere inPATH, type"which sadc"to find out where it lives.-tโ ๐ When reading data from a daily data file, this makessarshow timestamps in the original local time of the data file creator. Without it,sarshows timestamps in your own local time.-u [ ALL ]โ ๐ป Reports CPU utilization. TheALLkeyword means every CPU field gets displayed. The report may show these fields:%userโ Percentage of CPU utilization that occurred while executing at the user level (application). Note that this field includes time spent running virtual processors.%usrโ Percentage of CPU utilization that occurred while executing at the user level (application). Note that this field does NOT include time spent running virtual processors.%niceโ Percentage of CPU utilization that occurred while executing at the user level with nice priority.%systemโ Percentage of CPU utilization that occurred while executing at the system level (kernel). Note that this field includes time spent servicing hardware and software interrupts.%sysโ Percentage of CPU utilization that occurred while executing at the system level (kernel). Note that this field does NOT include time spent servicing hardware or software interrupts.%iowaitโ Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request. ๐ซถ
%steal ๐ซฃ Percentage of time the virtual CPU or CPUs spent in involuntary wait while the hypervisor was busy servicing another virtual processor. Basically, someone else's VM was hogging the host.
%irqโก Percentage of time the CPU or CPUs spent handling hardware interrupts.%soft๐ Percentage of time the CPU or CPUs spent handling software interrupts.%guest๐ซถ Percentage of time the CPU or CPUs spent running a virtual processor.%gnice๐ Percentage of time the CPU or CPUs spent running a niced guest.%idle๐ด Percentage of time the CPU or CPUs were just chilling, idle, and the system had no outstanding disk I/O request waiting on it.-V๐ท๏ธ Prints the version number and then bounces.-v๐๏ธ Reports the status of the inode, file, and other kernel tables. You'll see these values:dentunusd๐งน Number of unused cache entries in the directory cache.file-nr๐ Number of file handles the system is using.inode-nr๐ข Number of inode handlers the system is using.pty-nr๐ฅ๏ธ Number of pseudo-terminals the system is using.
-W๐ Reports swapping stats. You'll get these values:pswpin/s๐ฅ Total number of swap pages the system brought in per second.pswpout/s๐ค Total number of swap pages the system brought out per second.
-w๐งต Reports task creation and system switching activity. You'll get these values:proc/s๐ฑ Total number of tasks created per second.cswch/s๐ Total number of context switches per second.
-x๐ Extended reports! On top of the averages, you also get the minimum and maximum values at the end of the report.-y๐ Reports TTY device activity. You'll get these values:rcvin/s๐จ Number of receive interrupts per second for the current serial line. The serial line number shows up in the TTY column.xmtin/s๐ค Number of transmit interrupts per second for the current serial line.framerr/s๐ฅ Number of frame errors per second for the current serial line.prtyerr/sโ ๏ธ Number of parity errors per second for the current serial line.brk/s๐ Number of breaks per second for the current serial line.ovrun/s๐ Number of overrun errors per second for the current serial line.
-z๐ซง Tellssarto skip the output for any devices that had zero activity during the sample period. Tidy!
๐ ENVIRONMENT ๐
The sar command is super aware of the following environment variables. ๐
S_COLORS๐จ By default, stats show up in color when the output goes to a terminal. Use this variable to change that. The possible values arenever,always, orauto(andautois the same as the default). Also, no cap, the color a value shows up in (red, yellow, or whatever) doesn't mean something is wrong. The colors just mark different ranges of values. ๐ โโ๏ธS_COLORS_SGR๐ Lets you pick the colors and other attributes used to display stats on the terminal. The value is a colon-separated list of capabilities. It defaults toC=33;22:I=32;22:N=34;1:R=31;22:W=35;1:X=31;1:Z=34;22. The supported capabilities are:C=๐ฌ SGR (Select Graphic Rendition) substring for comments inserted in the binary daily data files.I=๐ท๏ธ SGR substring for item names or values (like network interfaces, the CPU number, and so on).N=๐ฅ SGR substring for non-zero statistics values.R=๐ SGR substring for restart messages.W=(orM=) โ ๏ธ SGR substring for percentage values in the range from 75% to 90% (or from 10% to 25%, depending on what the metric means). It's also used for negative values in the range from -10 to -5.X=(orH=) ๐จ SGR substring for percentage values greater than or equal to 90% (or less than or equal to 10%, depending on what the metric means). It's also used for negative values less than or equal to -10.Z=๐ซฅ SGR substring for zero values.
S_REPEAT_HEADER๐ This contains the maximum number of lines after whichsarhas to show a header again when the output is not a terminal.S_TIME_DEF_TIME๐ฐ๏ธ If this variable exists and its value isUTC, thensarsaves its data in UTC time (the data still displays in local time).saralso uses UTC instead of local time to figure out which daily data file in the/var/log/sysstatdirectory is the current one. This can be handy for servers with users spread across several timezones. ๐S_TIME_FORMAT๐ If this variable exists and its value isISO, then the current locale gets ignored when printing the date in the report header.saruses the ISO 8601 format (YYYY-MM-DD) instead. The timestamps follow ISO 8601 too. Very organized of it. ๐
๐งช EXAMPLES ๐งช
sar -u 2 5
Reports CPU utilization every 2 seconds. 5 lines are displayed. โฑ๏ธ
sar -I --int=14 -o int14.file 2 10
Reports stats on IRQ 14 every 2 seconds. 10 lines are displayed. The data gets saved in a file called int14.file. ๐พ
sar -r -n DEV -f /var/log/sysstat/sa16
Displays the memory and network stats saved in the daily data file sa16. ๐ง ๐
sar -A
Displays all the stats saved in the current daily data file. Everything, all at once! ๐ซ
๐ BUGS ๐
๐จ The/procfilesystem must be mounted forsarto work. No/proc, nosar. Period. ๐ โโ๏ธ
Not every statistic is necessarily available. It depends on the kernel version you're using. sar assumes you're running at least a 2.6 kernel. ๐ง
๐ค Here's a fun little gotcha: even though sar shows units that look like kilobytes (kB), megabytes (MB)..., it actually uses kibibytes (kiB), mebibytes (MiB)... A kibibyte is 1024 bytes, and a mebibyte is 1024 kibibytes. Math is serving. ๐งฎ
๐ FILES ๐
/var/log/sysstat/saDD๐๏ธ/var/log/sysstat/saYYYYMMDD๐๏ธ These are the standard system activity daily data files, plus their default location.YYYYstands for the current year,MMfor the current month, andDDfor the current day. โจ/procand/sys๐งพ These contain various files with system statistics. The good stuff lives here! ๐
๐ฉโ๐ป AUTHOR ๐ฉโ๐ป
Sebastien Godard (sysstat <at> orange.fr) ๐ซถ
๐ SEE ALSO ๐
sadc(8), sa1(8), sa2(8), sadf(1), sysstat(5), pidstat(1), mpstat(1), iostat(1), vmstat(8) ๐
https://github.com/sysstat/sysstat ๐ https://sysstat.github.io/ ๐ธ
Bestie, that's the whole sar page! ๐๐ You now know everything about system activity reporting, and honestly? Iconic. Stay curious, stay caffeinated, and go watch your CPU chill for a sec. ๐ฆโจ
๐ฆ where this page comes from
- ubuntu questing: sysstat 12.7.7-0ubuntu1 ยท GPL-2.0-or-later
- ubuntu resolute: sysstat 12.7.7-0ubuntu2 ยท GPL-2.0-or-later
- ubuntu stonking: sysstat 12.7.7-0ubuntu2 ยท GPL-2.0-or-later
- (C) 1999-2024 Sebastien Godard (sysstat <at> orange.fr)
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms