SAR(1)
๐ sar(1) ๐
okay so this one's from the Linux User's Manual, section 1, and it's sar. it's a whole thing, bestie โ grab a snack ๐
โจ NAME โจ
sar โ collect, report, or save system activity information. that's the whole job. it's giving "the main character of system monitoring" ๐
โจ 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 ] ]
yeah she's long. she's worth it tho ๐ซถ
๐ฆ DESCRIPTION ๐ฆ
so the sar command writes to standard output the contents of selected cumulative activity counters in the operating system. basically it peeks at the kernel's receipts ๐
the accounting system, based on the values in the count and interval parameters, writes information the specified number of times spaced at the specified intervals in seconds. so like โ you say how often, you say how many, it goes brrr.
if the interval parameter is set to zero, the sar command displays the average statistics for the time since the system was started. origin story energy โจ and if interval is specified without count, then reports are generated continuously โ no cap, it just keeps going ๐ญ
the collected data can also be saved in the file specified by the -o filename flag, in addition to being displayed onto the screen. and if filename is omitted, sar uses the standard system activity daily data file (details below, iykyk). by default all the data available from the kernel are saved in the data file. all of it. no crumbs.
the sar command also extracts and writes to standard output records previously saved in a file. this file can be either the one specified by the -f flag or, by default, the standard system activity daily data file. and here's the cute part โ it is also possible to enter -1, -2 etc. as an argument to sar to display data of that many days ago. for example, -1 will point at the standard system activity file of yesterday ๐ฐ๏ธ time travel but make it sysadmin.
standard system activity daily data files are named saDD or saYYYYMMDD, where YYYY stands for the current year, MM for the current month and DD for the current day. they are the default files used by sar only when no filename has been explicitly specified. when used to write data to files (with its option -o), sar will use saYYYYMMDD if option -D has also been specified, else it will use saDD. when used to display the records previously saved in a file, sar will look for the most recent of saDD and saYYYYMMDD, and use it. queen of always picking the freshest fit ๐
standard system activity daily data files are located in the /var/log/sa directory by default. yet it is possible to specify an alternate location for them: if a directory (instead of a plain file) is used with options -f or -o then it will be considered as the directory containing the data files. flexible. we love to see it ๐ซ
without the -P flag, the sar command reports system-wide (global among all processors) statistics, which are calculated as averages for values expressed as percentages, and as sums otherwise. if the -P flag is given, the sar command reports activity which relates to the specified processor or processors. if -P ALL is given, the sar command reports statistics for each individual processor and global statistics among all processors. offline processors are not displayed โ if they're not on the apps, they're not in the report ๐
you can select information about specific system activities using flags. not specifying any flags selects only CPU activity. specifying the -A flag selects all possible activities. go big or go home honestly ๐ฅ
the default version of the sar command (CPU utilization report) might be one of the first facilities the user runs to begin system activity investigation, because it monitors major system resources. if CPU utilization is near 100 percent (user + nice + system), the workload sampled is CPU-bound. she's booked, she's busy, she's at capacity ๐
if multiple samples and multiple reports are desired, it is convenient to specify an output file for the sar command. run the sar command as a background process. the syntax for this is:
sar -o datafile interval count >/dev/null 2>&1 &
all data are captured in binary form and saved to a file (datafile). the data can then be selectively displayed with the sar command using the -f option. set the interval and count parameters to select count records at interval second intervals. if the count parameter is not set, all the records saved in the file will be selected. collection of data in this manner is useful to characterize system usage over a period of time and determine peak usage hours. it's giving "let me take notes so I can gossip about my system later" ๐
Note: the sar command only reports on local activities. no long-distance, bestie. this is local-only ๐
๐ OPTIONS ๐
-Aโ this is equivalent to specifying-bBdFHISvwWy -m ALL -n ALL -q ALL -r ALL -u ALL. this option also implies specifying-I ALL -P ALLunless these options are explicitly set on the command line. basically the "give me everything" button ๐ฝ๏ธ-Bโ report paging statistics. the following values are 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 is not a count of page faults that generate I/O, because some page faults can be resolved without I/O. sneakyyy ๐majflt/sโ number of major faults the system has made per second, those which have required loading a memory page 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 (done in background, healthy system). green flags only ๐ฟpgscand/sโ number of pages scanned directly per second (process is stalled). not the vibe ๐ฌpgsteal/sโ number of pages the system has reclaimed from cache (pagecacheandswapcache) 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. glow up โจpgdem/sโ number of pages demoted (i.e. migrated from fast to slow memory types) by the system per second. it's giving flop era ๐
-bโ report I/O and transfer rate statistics. the following values are 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 combined into a single I/O request to the device. a transfer is of indeterminate size. mysterious. love that for her ๐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 and therefore have a size of512bytes.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, tellsarto display comments that have been inserted bysadc. the commentary, the lore, the behind-the-scenes ๐ฌ-Dโ usesaYYYYMMDDinstead ofsaDDas the standard system activity daily data file name. this option works only when used in conjunction with option-oto save data to file. solo it does nothing, bestie, it needs its plus-one ๐ซถ-dโ report activity for each block device. when data are displayed, the device name is displayed as it (should) appear in/dev.saruses data in/systo determine the device name based on its major and minor numbers. if this name resolution fails,sarwill use name mapping controlled by/etc/conf.d/sysstat.ioconffile. persistent device names can also be printed if option-jis used (see below). statistics for all devices are displayed unless a restricted list is specified using option--dev=(see corresponding option entry). note that disk activity depends onsadc's options-S DISKand-S XDISKto be collected. the following values are 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 combined into a single I/O request to the device. 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-sz and was expressed in sectors. rebrand era ๐
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. another rebrand, we stay adapting ๐ฆ
awaitโ the average time (in milliseconds) for I/O requests issued to the device to be served. this includes the time spent by the requests in queue and the time spent servicing them. the whole journey, not just the destination ๐ถโโ๏ธ%utilโ percentage of elapsed time during which I/O requests were issued to the device (bandwidth utilization for the device). device saturation occurs when this value is close to100%for devices serving requests serially. but for devices serving requests in parallel, such as RAID arrays and modern SSDs, this number does not reflect their performance limits. don't @ her, she's doing her best ๐ค
--dec={ 0 | 1 | 2 }โ specify the number of decimal places to use (0to2, default value is2). pick your precision, pick your poison ๐ข--dev=dev_listโ specify the block devices for which statistics are to be displayed bysar.dev_listis a list of comma-separated device names. keep it curated, keep it cute ๐-e [ hh:mm[:ss] ],-e [ seconds_since_the_epoch ]โ sets the ending time of the report, bestie. Default ending time is18:00:00๐. Hours go in 24-hour format, or you can hand it the number of seconds since the epoch (as a 10 digit number). This option is usable when data are read from or written to a file (options-for-o). So likeโฆ you can time-box your whole investigation, iconic.-F [ MOUNT ]โ shows stats for currently mounted filesystems โจ. Pseudo-filesystems get ignored, no cap. At the end of the reportsarwill display a summary of all those filesystems, which is giving wrap-up-slide energy ๐. If you use theMOUNTparameter keyword, that means the mountpoint gets reported instead of the filesystem device. Stats for all filesystems are displayed unless you specify a restricted list using option--fs=(see the corresponding option entry, it's right below ๐). Note that filesystems statistics depend onsadc's option-S XDISKto be collected โ like, they literally won't be there otherwise, so don't come forsar๐.
The following values are displayed:
MBfsfreeโ total amount of free space in mebibytes (including space available only to privileged user).MBfsusedโ total amount of space used in mebibytes.%fsusedโ percentage of filesystem space used, as seen by a privileged user.%ufsusedโ percentage of filesystem space used, as seen by an unprivileged user.Ifreeโ total number of free file nodes in filesystem.Iusedโ total number of file nodes used in filesystem.%Iusedโ percentage of file nodes used in filesystem.
-f [ filename ]โ extracts records from filename (which was created by the-o filenameflag, iykyk). The default value of the filename parameter is the current standard system activity daily data file. Plot twist: 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 are located ๐๏ธ. Heads up: option-fis exclusive of option-oโ they do not coexist, periodt.--fs=fs_listโ specifies the filesystems whose statisticssarshould display ๐ธ. fs_list is a list of comma-separated filesystem device names (for example/dev/sdb1) and/or mountpoints (for example/srv). Either form is accepted for filtering, independent of whether option-Fis showing device names or mountpoints โ flexible queen behavior ๐.-Hโ reports hugepages utilization statistics ๐. The following values are displayed:kbhugfreeโ amount of hugepages memory in kibibytes that is not yet allocated.kbhugusedโ amount of hugepages memory in kibibytes that has been allocated.%hugusedโ percentage of total hugepages memory that has been allocated.kbhugrsvdโ amount of reserved hugepages memory in kibibytes.kbhugsurpโ amount of surplus hugepages memory in kibibytes.
-hโ this option is equivalent to specifying--pretty --human. That's it, that's the whole vibe โจ.--helpโ displays a short help message then exits. Cute, quick, bye ๐ซถ.--humanโ prints sizes in human readable format (e.g.1.0k,1.2M, etc.). The units displayed with this option supersede any other default units (e.g. kibibytes, sectorsโฆ) associated with the metrics โ so it overrides, it does not negotiate ๐ .-I [ SUM | ALL ]โ reports statistics for interrupts โก. The values displayed are the number of interrupts per second for the given processor or among all processors. A list of interrupts can be specified using--int=(see that option). TheSUMkeyword indicates that the total number of interrupts received per second is to be displayed. TheALLkeyword indicates that statistics from all interrupts are to be reported (this is the default, bestie). Note that interrupts statistics depend onsadc's option-S INTto be collected.-i intervalโ selects data records at seconds as close as possible to the number specified by the interval parameter. So it's not like, exactly exactly, it's as-close-as-possible ๐ฏ.--iface=iface_listโ specifies the network interfaces whose statisticssarshould display ๐. iface_list is a list of comma-separated interface names.--int=int_listโ specifies the interrupts names whose statisticssarshould display. int_list is a list of comma-separated values or range of values (e.g.,0-16,35,40-). Note the trailing dash โ that's a real thing, not a typo, she's open-ended ๐.-j { SID | ID | LABEL | PATH | UUID | ... }โ displays persistent device names. Use this option in conjunction with option-d. KeywordsID,LABEL, etc. specify the type of the persistent name. These keywords are not limited โ the only prerequisite is that a directory with the required persistent names is present in/dev/disk๐๏ธ. KeywordSIDtries to get a stable identifier to use as the device name. A stable identifier won't change across reboots for the same physical device, which is the dream, honestly. If it exists, this identifier is normally the WWN (World Wide Name) of the device, as read from the/dev/disk/by-iddirectory ๐ฆ.-m { keyword[,...] | ALL }โ reports power management statistics ๐. Note that these statistics depend onsadc's option-S POWERto be collected.
Possible keywords are BAT, CPU, FAN, FREQ, IN, TEMP and USB.
With the BAT keyword, statistics about batteries capacity are reported. The following values are displayed:
%capโ battery capacity.cap/minโ capacity lost or gained per minute by the battery.statusโ charging status of the battery:โ(full),โ(charging),โ(not charging),โ(discharging),?(unknown). Tiny drama arrows, we love to see it ๐ญ.
With the CPU keyword, statistics about CPU are reported. The following value is displayed:
MHzโ instantaneous CPU clock frequency in MHz.
With the FAN keyword, statistics about fans speed are reported. The following values are displayed:
rpmโ fan speed expressed in revolutions per minute.drpmโ this field is calculated as the difference between current fan speed (rpm) and its low limit (fan_min).DEVICEโ sensor device name.
With the FREQ keyword, statistics about CPU clock frequency are reported. The following value is displayed:
wghMHzโ weighted average CPU clock frequency in MHz. Note that thecpufreq-statsdriver must be compiled in the kernel for this option to work โ no driver, no numbers, just vibes ๐ธ.
With the IN keyword, statistics about voltage inputs are reported. The following values are displayed:
inVโ voltage input expressed in Volts.%inโ relative input value. A value of100%means that voltage input has reached its high limit (in_max) whereas a value of0%means that it has reached its low limit (in_min).DEVICEโ sensor device name.
With the TEMP keyword, statistics about devices temperature are reported. The following values are displayed:
degCโ device temperature expressed in degrees Celsius.%tempโ relative device temperature. A value of100%means that temperature has reached its high limit (temp_max).DEVICEโ sensor device name.
With the USB keyword, the sar command takes a snapshot of all the USB devices currently plugged into the system ๐. At the end of the report, sar will display 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 USB organization).idprodโ product ID number (assigned by Manufacturer).maxpowerโ maximum power consumption of the device (expressed in mA).manufactโ manufacturer name.productโ product name.
The ALL keyword is equivalent to specifying all the keywords above and therefore all the power management statistics are reported โ the full menu, no skips ๐
.
-n { keyword[,...] | ALL }โ reports network statistics ๐.
Possible keywords are DEV, EDEV, FC, ICMP, EICMP, ICMP6, EICMP6, IP, EIP, IP6, EIP6, NFS, NFSD, SOCK, SOCK6, SOFT, TCP, ETCP, UDP and UDP6.
With the DEV keyword, statistics from the network devices are reported. Statistics for all network interfaces are displayed unless a restricted list is specified using option --iface= (see the corresponding option entry). The following values are displayed:
IFACEโ name of the network interface for which statistics are 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 (forcslipetc.).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, utilization is calculated using the sum ofrxkB/sandtxkB/sas a percentage of the interface speed. For full-duplex, this is the greater ofrxkB/SortxkB/s. (Yes, that capitalSis exactly how it's written in the original โ copying it verbatim, bestie ๐ค.)
With the EDEV keyword, statistics on failures (errors) from the network devices are reported. Statistics for all network interfaces are displayed unless a restricted list is specified using option --iface= (see the corresponding option entry). The following values are displayed:
IFACEโ name of the network interface for which statistics are 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 of a lack of space inlinuxbuffers.txdrop/sโ number of transmitted packets dropped per second because of a lack of space inlinuxbuffers.
txcarr/sโ how many carrier-errors went down per second while we were transmitting packets ๐rxfram/sโ how many frame alignment errors happened per second on the packets we received ๐ซrxfifo/sโ how many FIFO overrun errors happened per second on received packetstxfifo/sโ how many FIFO overrun errors happened per second on transmitted packets
๐ฆ the FC keyword
okay so when you use the FC keyword, you get stats about fibre channel traffic. heads up tho: fibre channel numbers only exist if sadc was run with the -S DISK option to actually collect them. iykyk. here's what shows up:
FCHOSTโ the name of the fibre channel host bus adapter (HBA) interface these stats are for ๐fch_rxf/sโ total frames received per secondfch_txf/sโ total frames transmitted per secondfch_rxw/sโ total transmission words received per secondfch_txw/sโ total transmission words transmitted per second
๐ the ICMP keyword
ICMP gives you stats about ICMPv4 network traffic ๐ btw these depend on sadc's -S SNMP option being used to collect them, so likeโฆ no collection, no data, no cap. formal SNMP names are in the square brackets, bestie:
imsg/sโ total number of ICMP messages this entity received per second[icmpInMsgs]. not me telling you this counter includes everything counted byierr/s๐omsg/sโ total number of ICMP messages this entity tried to send per second[icmpOutMsgs]. and yeah, this one includes everything counted byoerr/s.iech/sโ number of ICMP Echo (request) messages received per second[icmpInEchos]iechr/sโ number of ICMP Echo Reply messages received per second[icmpInEchoReps]oech/sโ number of ICMP Echo (request) messages sent per second[icmpOutEchos]oechr/sโ number of ICMP Echo Reply messages sent per second[icmpOutEchoReps]itm/sโ number of ICMP Timestamp (request) messages received per second[icmpInTimestamps]itmr/sโ number of ICMP Timestamp Reply messages received per second[icmpInTimestampReps]otm/sโ number of ICMP Timestamp (request) messages sent per second[icmpOutTimestamps]otmr/sโ number of ICMP Timestamp Reply messages sent per second[icmpOutTimestampReps]iadrmk/sโ number of ICMP Address Mask Request messages received per second[icmpInAddrMasks]iadrmkr/sโ number of ICMP Address Mask Reply messages received per second[icmpInAddrMaskReps]oadrmk/sโ number of ICMP Address Mask Request messages sent per second[icmpOutAddrMasks]oadrmkr/sโ number of ICMP Address Mask Reply messages sent per second[icmpOutAddrMaskReps]
๐
the EICMP keyword
EICMP is the error-message era of ICMPv4 โจ same deal as before: these depend on sadc's -S SNMP option to be collected. SNMP names, in brackets, as always:
ierr/sโ number of ICMP messages per second the entity received but clocked as having ICMP-specific errors (bad ICMP checksums, bad length, etc.)[icmpInErrors]๐ญoerr/sโ number of ICMP messages per second this entity did not send because of problems found inside ICMP, like a lack of buffers[icmpOutErrors]idstunr/sโ number of ICMP Destination Unreachable messages received per second[icmpInDestUnreachs]odstunr/sโ number of ICMP Destination Unreachable messages sent per second[icmpOutDestUnreachs]itmex/sโ number of ICMP Time Exceeded messages received per second[icmpInTimeExcds]otmex/sโ number of ICMP Time Exceeded messages sent per second[icmpOutTimeExcds]iparmpb/sโ number of ICMP Parameter Problem messages received per second[icmpInParmProbs]oparmpb/sโ number of ICMP Parameter Problem messages sent per second[icmpOutParmProbs]isrcq/sโ number of ICMP Source Quench messages received per second[icmpInSrcQuenchs]osrcq/sโ number of ICMP Source Quench messages sent per second[icmpOutSrcQuenchs]iredir/sโ number of ICMP Redirect messages received per second[icmpInRedirects]oredir/sโ number of ICMP Redirect messages sent per second[icmpOutRedirects]
๐ง the ICMP6 keyword
now we're in ICMPv6 network traffic territory ๐ฆ these stats depend on sadc's -S IPV6 option being collected โ fr fr, don't forget it. formal SNMP names between square brackets:
imsg6/sโ total number of ICMP messages received by the interface per second, which includes everything counted byierr6/s[ipv6IfIcmpInMsgs]omsg6/sโ total number of ICMP messages this interface tried to send per second[ipv6IfIcmpOutMsgs]iech6/sโ number of ICMP Echo (request) messages received by the interface per second[ipv6IfIcmpInEchos]iechr6/sโ number of ICMP Echo Reply messages received by the interface per second[ipv6IfIcmpInEchoReplies]oechr6/sโ number of ICMP Echo Reply messages sent by the interface per second[ipv6IfIcmpOutEchoReplies]igmbq6/sโ number of ICMPv6 Group Membership Query messages received by the interface per second[ipv6IfIcmpInGroupMembQueries]igmbr6/sโ number of ICMPv6 Group Membership Response messages received by the interface per second[ipv6IfIcmpInGroupMembResponses]ogmbr6/sโ number of ICMPv6 Group Membership Response messages sent per second[ipv6IfIcmpOutGroupMembResponses]igmbrd6/sโ number of ICMPv6 Group Membership Reduction messages received by the interface per second[ipv6IfIcmpInGroupMembReductions]ogmbrd6/sโ number of ICMPv6 Group Membership Reduction messages sent per second[ipv6IfIcmpOutGroupMembReductions]irtsol6/sโ number of ICMP Router Solicit messages received by the interface per second[ipv6IfIcmpInRouterSolicits]ortsol6/sโ number of ICMP Router Solicitation messages sent by the interface per second[ipv6IfIcmpOutRouterSolicits]irtad6/sโ number of ICMP Router Advertisement messages received by the interface per second[ipv6IfIcmpInRouterAdvertisements]inbsol6/sโ number of ICMP Neighbor Solicit messages received by the interface per second[ipv6IfIcmpInNeighborSolicits]onbsol6/sโ number of ICMP Neighbor Solicitation messages sent by the interface per second[ipv6IfIcmpOutNeighborSolicits]inbad6/sโ number of ICMP Neighbor Advertisement messages received by the interface per second[ipv6IfIcmpInNeighborAdvertisements]onbad6/sโ number of ICMP Neighbor Advertisement messages sent by the interface per second[ipv6IfIcmpOutNeighborAdvertisements]
๐ฅ the EICMP6 keyword
and finally the ICMPv6 error messages ๐ (these also depend on sadc's -S IPV6 option to be collected, obvs). SNMP names in the brackets:
ierr6/sโ number of ICMP messages per second the interface received but determined as having ICMP-specific errors (bad ICMP checksums, bad length, etc.)[ipv6IfIcmpInErrors]idtunr6/sโ number of ICMP Destination Unreachable messages received by the interface per second[ipv6IfIcmpInDestUnreachs]odtunr6/sโ number of ICMP Destination Unreachable messages sent by the interface per second[ipv6IfIcmpOutDestUnreachs]itmex6/sโ number of ICMP Time Exceeded messages received by the interface per second[ipv6IfIcmpInTimeExcds]otmex6/sโ number of ICMP Time Exceeded messages sent by the interface per second[ipv6IfIcmpOutTimeExcds]iprmpb6/sโ number of ICMP Parameter Problem messages received by the interface per second[ipv6IfIcmpInParmProblems]oprmpb6/sโ number of ICMP Parameter Problem messages sent by the interface per second[ipv6IfIcmpOutParmProblems]iredir6/sโ number of Redirect messages received by the interface per second[ipv6IfIcmpInRedirects]oredir6/sโ number of Redirect messages sent by the interface by second[ipv6IfIcmpOutRedirects]ipck2b6/sโ number of ICMP Packet Too Big messages received by the interface per second[ipv6IfIcmpInPktTooBigs]opck2b6/sโ number of ICMP Packet Too Big messages sent by the interface per second[ipv6IfIcmpOutPktTooBigs]
Okay so, quick vibe check before we dive in: every single one of these counters has its formal SNMP name hanging out in square brackets right next to it. That's your iykyk moment โ the bracket names are the real ones, the short names are the vibe.
With the IP keyword, we're talking alllll about IPv4 network traffic stats, bestie. ๐ And listen โ IPv4 stats only show up if sadc was run with option -S SNMP, so no -S SNMP, no stats, periodt. Here's the roster of values (formal SNMP names in square brackets, as always):
irec/sโ total number of input datagrams received from interfaces per second, error ones included, no gatekeeping[ipInReceives].fwddgm/sโ number of input datagrams per second where this entity was not the final IP destination, so it tried to find a route to forward them on to that final destination[ipForwDatagrams].idel/sโ total number of input datagrams successfully delivered per second to IP user-protocols (ICMP included)[ipInDelivers].orq/sโ total number of IP datagrams that local IP user-protocols (ICMP included, again) handed over per second to IP asking for transmission[ipOutRequests]. Heads up though: this counter does not include any datagrams already counted infwddgm/s. ๐asmrq/sโ number of IP fragments received per second that needed reassembling at this entity[ipReasmReqds].asmok/sโ number of IP datagrams successfully re-assembled per second[ipReasmOKs].fragok/sโ number of IP datagrams successfully fragmented at this entity per second[ipFragOKs].fragcrt/sโ number of IP datagram fragments generated per second as a result of fragmentation at this entity[ipFragCreates].
Now with the EIP keyword, it's giving IPv4 network errors energy ๐ญ โ the messy side of the family. Same deal: these depend on sadc's option -S SNMP to be collected. The values:
ihdrerr/sโ number of input datagrams discarded per second because their IP headers were a whole mess: bad checksums, version number mismatch, other format errors, time-to-live exceeded, errors found while processing their IP options, etc.[ipInHdrErrors]iadrerr/sโ number of input datagrams discarded per second because the IP address in their IP header's destination field wasn't a valid address to be received at this entity. This count includes invalid addresses (e.g.,0.0.0.0) and addresses of unsupported Classes (e.g., Class E). And for entities that aren't IP routers and therefore don't forward datagrams, this counter also includes datagrams discarded because the destination address wasn't a local address[ipInAddrErrors].iukwnpr/sโ number of locally-addressed datagrams received successfully but then discarded per second because of an unknown or unsupported protocol[ipInUnknownProtos]. rude, honestly.idisc/sโ number of input IP datagrams per second that hit no problems that would stop further processing, but got discarded anyway (like, for lack of buffer space)[ipInDiscards]. Note that this counter does not include any datagrams discarded while awaiting re-assembly.odisc/sโ number of output IP datagrams per second that hit no problem preventing transmission to their destination but got discarded anyway (again, lack of buffer space being the classic)[ipOutDiscards]. Also note: this counter would include datagrams counted infwddgm/sif any such packets met this (discretionary) discard criterion.onort/sโ number of IP datagrams discarded per second because no route could be found to transmit them to their destination[ipOutNoRoutes]. Note: this counter includes any packets counted infwddgm/sthat meet this 'no-route' criterion. Also note it includes any datagrams a host can't route because all of its default routers are down. ๐asmf/sโ number of failures detected per second by the IP re-assembly algorithm, for whatever reason (timed out, errors, etc.)[ipReasmFails]. Important nuance: this is not necessarily a count of discarded IP fragments, because some algorithms can lose track of how many fragments there are by combining them as they're received.fragf/sโ number of IP datagrams discarded per second because they needed fragmenting at this entity and couldn't be โ like when their Don't Fragment flag was set[ipFragFails].
Switching it up: the IP6 keyword reports IPv6 network traffic stats ๐ฆโจ. And yes, IPv6 statistics depend on sadc's option -S IPV6 to be collected โ different flag, don't mix them up. The values:
irec6/sโ total number of input datagrams received from interfaces per second, including the ones received in error[ipv6IfStatsInReceives].fwddgm6/sโ number of output datagrams per second that this entity received and forwarded to their final destinations[ipv6IfStatsOutForwDatagrams].idel6/sโ total number of datagrams successfully delivered per second to IPv6 user-protocols (ICMP included)[ipv6IfStatsInDelivers].orq6/sโ total number of IPv6 datagrams local IPv6 user-protocols (ICMP included) supplied per second to IPv6 in requests for transmission[ipv6IfStatsOutRequests]. Note that this counter does not include any datagrams counted infwddgm6/s.asmrq6/sโ number of IPv6 fragments received per second that needed reassembling at this interface[ipv6IfStatsReasmReqds].asmok6/sโ number of IPv6 datagrams successfully reassembled per second[ipv6IfStatsReasmOKs].imcpck6/sโ number of multicast packets received per second by the interface[ipv6IfStatsInMcastPkts].omcpck6/sโ number of multicast packets transmitted per second by the interface[ipv6IfStatsOutMcastPkts].fragok6/sโ number of IPv6 datagrams successfully fragmented at this output interface per second[ipv6IfStatsOutFragOKs].fragcr6/sโ number of output datagram fragments generated per second as a result of fragmentation at this output interface[ipv6IfStatsOutFragCreates].
And the EIP6 keyword? That's IPv6 network errors ๐ธ โ yep, it's the same depend-on-sadc's-option--S IPV6 situation, and yep, brackets mean formal SNMP names. Behold:
ihdrer6/sโ number of input datagrams discarded per second due to errors in their IPv6 headers: version number mismatch, other format errors, hop count exceeded, errors discovered while processing their IPv6 options, etc.[ipv6IfStatsInHdrErrors]iadrer6/sโ number of input datagrams discarded per second because the IPv6 address in their IPv6 header's destination field wasn't a valid address to be received at this entity. This count includes invalid addresses (e.g.,::0) and unsupported addresses (e.g., addresses with unallocated prefixes). For entities that aren't IPv6 routers and therefore don't forward datagrams, this counter also includes datagrams discarded because the destination address wasn't a local address[ipv6IfStatsInAddrErrors].iukwnp6/sโ number of locally-addressed datagrams received successfully but discarded per second because of an unknown or unsupported protocol[ipv6IfStatsInUnknownProtos].i2big6/sโ number of input datagrams that could not be forwarded per second because their size exceeded the link MTU of the outgoing interface[ipv6IfStatsInTooBigErrors]. too big, too slay, too discarded.idisc6/sโ number of input IPv6 datagrams per second with no problems preventing continued processing, but discarded anyway (lack of buffer space, the usual suspect)[ipv6IfStatsInDiscards]. Note that this counter does not include any datagrams discarded while awaiting re-assembly.odisc6/sโ number of output IPv6 datagrams per second with no problem preventing transmission to their destination, but discarded anyway (buffer space, etc.)[ipv6IfStatsOutDiscards]. Note that this counter would include datagrams counted infwddgm6/sif any such packets met this (discretionary) discard criterion.inort6/sโ number of input datagrams discarded per second because no route could be found to transmit them to their destination[ipv6IfStatsInNoRoutes].onort6/sโ number of locally generated IP datagrams discarded per second because no route could be found to transmit them to their destination[unknown formal SNMP name]. yes, that bracket really does say unknown formal SNMP name โ it's not a typo, that's just the lore ๐asmf6/sโ the number of failures the IPv6 reassembly algorithm caught per second, for literally whatever reason (timed out, errors, etc.) โ that's[ipv6IfStatsReasmFails]bestie. Quick heads up tho: this is not necessarily a count of discarded IPv6 fragments, because some algorithms can lose track of the fragment count by combining them as they come in. so the vibes are approximate, not exact ๐fragf6/sโ how many IPv6 datagrams got yeeted per second because they needed fragmenting at this output interface but just... couldn't โ[ipv6IfStatsOutFragFails]. it's giving "we tried and we failed" ๐ญitrpck6/sโ the number of input datagrams discarded per second because the datagram frame didn't carry enough data โ[ipv6IfStatsInTruncatedPkts]. short king packets, not slaying ๐ธ
๐ the NFS keyword โ client tea
With the NFS keyword, statistics about NFS client activity are reported. The following values are displayed:
call/sโ number of RPC requests made per second.retrans/sโ number of RPC requests per second that needed to be retransmitted (for example, because a server timed out). the flaky wifi of RPC ๐ฅread/sโ number of'read'RPC calls made per second.write/sโ number of'write'RPC calls made per second.access/sโ number of'access'RPC calls made per second.getatt/sโ number of'getattr'RPC calls made per second.
๐ the NFSD keyword โ server tea
With the NFSD keyword, statistics about NFS server activity are reported. The following values are displayed:
scall/sโ number of RPC requests received per second.badcall/sโ number of bad RPC requests received per second โ the ones whose processing generated an error. blocked and reported ๐packet/sโ number of network packets received per second.udp/sโ number of UDP packets received per second.tcp/sโ number of TCP packets received per second.hit/sโ number of reply cache hits per second. slay โจmiss/sโ number of reply cache misses per second. not slay ๐sread/sโ number of'read'RPC calls received per second.swrite/sโ number of'write'RPC calls received per second.saccess/sโ number of'access'RPC calls received per second.sgetatt/sโ number of'getattr'RPC calls received per second.
๐ง the SOCK keyword โ IPv4 sockets in use
With the SOCK keyword, statistics on sockets in use are reported (IPv4). The following values are displayed:
totsckโ total number of sockets used by the system.tcpsckโ number of TCP sockets currently in use.udpsckโ number of UDP sockets currently in use.rawsckโ number of RAW sockets currently in use.ip-fragโ number of IP fragments currently in queue.tcp-twโ number of TCP sockets inTIME_WAITstate. they're just standing there... waiting... ๐ซถ
๐ฆ the SOCK6 keyword โ IPv6 sockets in use
With the SOCK6 keyword, statistics on sockets in use are reported (IPv6). Note that IPv6 statistics depend on sadc's option -S IPV6 to be collected. The following values are displayed:
tcp6sckโ number of TCPv6 sockets currently in use.udp6sckโ number of UDPv6 sockets currently in use.raw6sckโ number of RAWv6 sockets currently in use.ip6-fragโ number of IPv6 fragments currently in use.
โญ the SOFT keyword โ software-based network processing
With the SOFT keyword, statistics about software-based network processing are reported. 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 there was no room on the processing queue. full queue behavior, tragic ๐ญsqueezd/sโ the number of times the softirq handler function terminated per second because its budget was consumed or the time limit was reached โ but more work could have been done. so much potential, so little time ๐rx_rps/sโ the number of times the CPU has been woken up per second to process packets via an inter-processor interrupt.flw_lim/sโ the number of times the flow limit has been reached per second. Flow limiting is an optional RPS feature that can be used to limit the number of packets queued to the backlog for each flow to a certain amount. This can help ensure that smaller flows are processed even though much larger flows are pushing packets in. it's giving "let the little guys through" ๐ซถblg_lenโ the length of the network backlog.
๐ฅ the TCP keyword โ TCPv4 traffic
With the TCP keyword, statistics about TCPv4 network traffic are reported. Note that TCPv4 statistics depend on sadc's option -S SNMP to be collected. The following values are displayed (formal SNMP names between square brackets):
active/sโ the number of times TCP connections have made a direct transition to theSYN-SENTstate from theCLOSEDstate per second[tcpActiveOpens]. main character energy, initiating โจpassive/sโ the number of times TCP connections have made a direct transition to theSYN-RCVDstate from theLISTENstate per second[tcpPassiveOpens].iseg/sโ the total number of segments received per second, including those received in error[tcpInSegs]. This count includes segments received on currently established connections.oseg/sโ the total number of segments sent per second, including those on current connections but excluding those containing only retransmitted octets[tcpOutSegs].
๐ the ETCP keyword โ TCPv4 errors
With the ETCP keyword, statistics about TCPv4 network errors are reported. Note that TCPv4 statistics depend on sadc's option -S SNMP to be collected. The following values are displayed (formal SNMP names between square brackets):
atmptf/sโ the number of times per second TCP connections have made a direct transition to theCLOSEDstate from either theSYN-SENTstate or theSYN-RCVDstate, plus the number of times per second TCP connections have made a direct transition to theLISTENstate from theSYN-RCVDstate[tcpAttemptFails]. it didn't work out, no hard feelings ๐ญestres/sโ the number of times per second TCP connections have made a direct transition to theCLOSEDstate from either theESTABLISHEDstate or theCLOSE-WAITstate[tcpEstabResets]. the breakup stat ๐retrseg/sโ the total number of segments retransmitted per second โ that is, the number of TCP segments transmitted containing one or more previously transmitted octets[tcpRetransSegs]. round two, we go again ๐ฅisegerr/sโ the total number of segments received in error (e.g., bad TCP checksums) per second[tcpInErrs].orsts/sโ the number of TCP segments sent per second containing theRSTflag[tcpOutRsts]. hanging up with attitude ๐
๐ธ the UDP keyword โ UDPv4 traffic
With the UDP keyword, statistics about UDPv4 network traffic are reported. Note that UDPv4 statistics depend on sadc's option -S SNMP to be collected. The following values are displayed (formal SNMP names between 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 for which there was no application at the destination port[udpNoPorts]. nobody home, iconic ๐idgmerr/sโ the number of received UDP datagrams per second that could not be delivered for reasons other than the lack of an application at the destination port[udpInErrors].
๐ the UDP6 keyword โ UDPv6 traffic
With the UDP6 keyword, statistics about UDPv6 network traffic are reported. Note that UDPv6 statistics depend on sadc's option -S IPV6 to be collected. The following values are displayed (formal SNMP names between 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 for which there was no application at the destination port[udpNoPorts].idgmer6/sโ the number of received UDP datagrams per second that could not be delivered for reasons other than the lack of an application at the destination port[udpInErrors].
The ALL keyword is equivalent to specifying all the keywords above, and therefore all the network activities are reported. literally the whole buffet, eat up ๐
โจ more OPTIONS โจ
-o [ filename ]โ save the readings in the file in binary form. Each reading is in a separate record. The default value of the filename parameter is the current standard system activity daily data file. If filename is a directory instead of a plain file then it is considered as the directory where the standard system activity daily data files are located. Option-ois exclusive of option-f. All the data available from the kernel are saved in the file โ in fact,sarcalls its data collectorsadcwith the option-S ALL. Seesadc(8)manual page.
ok so-oand-fare NOT friends, bestie. pick one. exclusive means exclusive ๐
-P { cpu_list | ALL }โ report per-processor statistics for the specified processor or processors. cpu_list is a list of comma-separated values or range of values (e.g.,0,2,4-7,12-). Note that processor0is the first processor, and processorallis the global average among all processors. Specifying theALLkeyword reports statistics for each individual processor, and globally for all processors. Offline processors are not displayed. no showing up for offline CPUs, they're on a break ๐-p,--prettyโ make reports easier to read by a human. This option may be especially useful when displaying e.g., network interfaces or block devices statistics. she understood the assignment, she made it pretty ๐โจ-q [ keyword[,...] | ALL ]โ report system load and pressure-stall statistics. ooh tension ๐
Possible keywords are CPU, IO, LOAD, MEM and PSI.
๐ป CPU โ the pressure one
With the CPU keyword, CPU pressure statistics are reported. Here's what gets displayed:
%scpu-10โ percentage of the time that at least some runnable tasks were delayed because the CPU was unavailable to them, over the last 10 second 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โ percentage of the time that at least some runnable tasks were delayed because the CPU was unavailable to them, over the last 300 second window.%scpuโ percentage of the time that at least some runnable tasks were delayed because the CPU was unavailable to them, over the last time interval.
๐๏ธ IO โ I/O pressure, bestie
With the IO keyword, I/O pressure statistics are reported. The following values are displayed:
%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.
๐ LOAD โ queue length + load averages
With the LOAD keyword, queue length and load averages statistics are reported. The following values are displayed:
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.
๐ง MEM โ memory pressure, obviously
With the MEM keyword, memory pressure statistics are reported. The following values are displayed:
%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 literally the same thing as specifying the CPU, IO and MEM keywords together, so all the pressure-stall statistics get reported. Two birds, one flag, no cap โจ
The ALL keyword is equivalent to specifying all the keywords above, so every single statistic shows up. It's giving "select all" energy ๐
-r [ ALL ]โ report memory utilization statistics. TheALLkeyword means all the memory fields should be displayed. The following values may be displayed: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. If not provided by the kernel, this field is the same askbmemfree.kbmemusedโ amount of used memory in kibibytes (calculated as total installed memory -kbavail).%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. ๐ญ (not a bug, it's a feature)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.kbshmemโ amount of shared memory in kibibytes (memory mostly used by tmpfs).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โ report swap space utilization statistics. The following values are 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] ]-s [ seconds_since_the_epoch ]โ set the starting time of the data, sosarextracts records time-tagged at, or following, the time you specified. ๐ The default starting time is08:00:00. Hours must be given in 24-hour format, or as the number of seconds since the epoch (given as a 10 digit number). Heads up bestie: this option can be used only when data are read from a file (option-f).
-s [ hh:mm[:ss] ]
-s [ seconds_since_the_epoch ]
--sadcโ indicate which data collector is called bysar. If the data collector is sought inPATHthen enterwhich sadcto know where it is located. iykyk ๐ต๏ธโโ๏ธ-tโ when reading data from a daily data file, indicate thatsarshould display the timestamps in the original local time of the data file creator. Without this option, thesarcommand displays the timestamps in the user's local time. Time zone glow-up, iconic โจ-u [ ALL ]โ report CPU utilization. TheALLkeyword means all the CPU fields should be displayed. The report may show the following 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. Read that twice, bestie.%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 spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.%irqโ Percentage of time spent by the CPU or CPUs to service hardware interrupts.%softโ Percentage of time spent by the CPU or CPUs to service software interrupts.%guestโ Percentage of time spent by the CPU or CPUs to run a virtual processor.%gniceโ Percentage of time spent by the CPU or CPUs to run a niced guest.%idleโ Percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.-Vโ Print version number then exit. Short, sweet, iconic.-vโ Report status of inode, file and other kernel tables. The following values are displayed:dentunusdโ Number of unused cache entries in the directory cache.file-nrโ Number of file handles used by the system.inode-nrโ Number of inode handlers used by the system.pty-nrโ Number of pseudo-terminals used by the system.
-Wโ Report swapping statistics. The following values are displayed: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โ Report task creation and system switching activity. The following values are displayed:proc/sโ Total number of tasks created per second.cswch/sโ Total number of context switches per second.
-xโ Extended reports: Display minimum and maximum values in addition to average ones at the end of the report. Extra detail, extra slay. โจ-yโ Report TTY devices activity. The following values are displayed:rcvin/sโ Number of receive interrupts per second for current serial line. Serial line number is given in theTTYcolumn.xmtin/sโ Number of transmit interrupts per second for current serial line.framerr/sโ Number of frame errors per second for current serial line.prtyerr/sโ Number of parity errors per second for current serial line.brk/sโ Number of breaks per second for current serial line.ovrun/sโ Number of overrun errors per second for current serial line.
-zโ Tellsarto omit output for any devices for which there was no activity during the sample period. Quiet devices get no screen time. ๐
๐ฟ ENVIRONMENT ๐ฟ
The sar command takes into account the following environment variables:
S_COLORSโ By default statistics are displayed in color when the output is connected to a terminal. Use this variable to change the settings. Possible values for this variable arenever,alwaysorauto(the latter is equivalent to the default settings). Please note that the color (being red, yellow, or some other color) used to display a value is not indicative of any kind of issue simply because of the color. It only indicates different ranges of values. Color = range info, not drama. ๐S_COLORS_SGRโ Specify the colors and other attributes used to display statistics on the terminal. Its value is a colon-separated list of capabilities that defaults to:
C=33;22:I=32;22:N=34;1:R=31;22:W=35;1:X=31;1:Z=34;22+=32;1:-=31;1
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 (eg. network interfaces, CPU number...).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 in the range 10% to 25% depending on the metric's meaning). It is 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 lower than or equal to 10% depending on the metric's meaning). It is also used for negative values lower than or equal to -10.Z=โ SGR substring for zero values.+=โ SGR substring for battery status (full or charging).-=โ SGR substring for battery status (not charging or discharging).
S_REPEAT_HEADERโ This variable contains the maximum number of lines after which a header has to be displayed bysarwhen the output is not a terminal. Header repetition, but make it configurable.S_TIME_DEF_TIMEโ If this variable exists and its value isUTCthensarwill save its data in UTC time (data will still be displayed in local time).sarwill also use UTC time instead of local time to determine the current daily data file located in the/var/log/sadirectory. This variable may be useful for servers with users located across several timezones. ๐S_TIME_FORMATโ If this variable exists and its value isISOthen the current locale will be ignored when printing the date in the report header. Thesarcommand will use the ISO 8601 format (YYYY-MM-DD) instead. The timestamp will also be compliant with ISO 8601 format. Date format glow-up. โจ
๐งช EXAMPLES ๐งช
sar -u 2 5
Report CPU utilization for each 2 seconds. 5 lines are displayed.
sar -I --int=14 -o int14.file 2 10
Report statistics on IRQ 14 for each 2 seconds. 10 lines are displayed. Data are stored in a file called int14.file.
sar -r -n DEV -f /var/log/sa/sa16
Display memory and network statistics saved in daily data file sa16.
sar -A
Display all the statistics saved in current daily data file. All the stats, no crumbs left. ๐
๐ BUGS ๐
/procfilesystem must be mounted for thesarcommand to work. No/proc, no party. ๐ญ
All the statistics are not necessarily available, depending on the kernel version used. sar assumes that you are using at least a 2.6 kernel.
Although sar displays units corresponding to kilobytes (kB), megabytes (MB)..., it actually uses kibibytes (kiB), mebibytes (MiB)... A kibibyte is equal to 1024 bytes, and a mebibyte is equal to 1024 kibibytes. Yes, the labels are a little sus โ the math is still 1024-based.
๐ FILES ๐
/var/log/sa/saDD/var/log/sa/saYYYYMMDD
The standard system activity daily data files and their default location. YYYY stands for the current year, MM for the current month and DD for the current day. ๐๏ธ
/procand/syscontain various files with system statistics.
๐ 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
That's the page, bestie. Source/version line says Linux, date says AUGUST 2026, and this iconic little manual is SAR(1) โ periodt. ๐โจ๐
๐ฆ where this page comes from
- arch rolling: sysstat 12.8.0-1 ยท GPL-2.0-only
- (C) 1999-2026 Sebastien Godard (sysstat <at> orange.fr)
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms