SADC(8)
๐ SADC(8) ๐
okay so bestie, let me introduce you to sadc โ the System activity data collector from the Linux User's Manual, AUGUST 2023 edition. this one's a backend baddie, not your main character, but she's literally the reason your sar data exists. no cap. ๐ซถ
โจ NAME โจ
sadc โ System activity data collector. that's it, that's the vibe. she collects. she samples. she writes binary. iconic behavior only. ๐
๐ธ SYNOPSIS ๐ธ
/usr/lib/sa/sadc [ -C comment ] [ -D ] [ -F ] [ -f ] [ -L ] [ -V ] [ -S
{ keyword[,...] | ALL | XALL } ] [ interval [ count ] ] [ outfile ]
like, she's got a lot of options but she's lowkey chill about it. let me walk you through it. ๐
๐ฆ DESCRIPTION ๐ฆ
so here's the tea: sadc samples system data a specified number of times (count) at a specified interval measured in seconds (interval). she writes in binary format to the specified outfile or to standard output. if outfile is set to -, then sadc uses the standard system activity daily data file โ see below, i gotchu. in this case, if the file already exists, sadc will overwrite it if it's from a previous month. like, out with the old, in with the new. periodt. ๐๏ธโจ
by default sadc collects most of the data available from the kernel. but there are also optional metrics โ for which the relevant options must be explicitly passed to sadc to be collected (see option -S below). so yeah, she doesn't just give you everything unless you ask. consent is key. ๐๐
the standard system activity daily data file is named saDD unless option -D is used, in which case its name is saYYYYMMDD, where YYYY stands for the current year, MM for the current month and DD for the current day. by default it is located in the /var/log/sa directory. yet it is possible to specify an alternate location for it: if outfile is a directory (instead of a plain file) then it will be considered as the directory where the standard system activity daily data file will be saved. so like, you can move her whole setup if you want. flexible queen. ๐ง
when the count parameter is not specified, sadc writes its data endlessly. literally forever. no stopping her. when both interval and count are not specified, and option -C is not used, a dummy record โ which is used at system startup to mark the time when the counter restarts from 0 โ will be written. for example, one of the system startup script may write the restart mark to the daily data file by the command entry:
/usr/lib/sa/sadc -
the sadc command is intended to be used as a backend to the sar command. she's the support system, the backbone, the stage crew of your system monitoring. respect her. ๐
Note: The sadc command only reports on local activities. she's not nosy about your network drama. she stays in her lane. ๐
๐ OPTIONS ๐
okay bestie, here's the full menu. every single flag, no skips, no skips, no cap. ๐
-C commentโ When neither theintervalnor thecountparameters are specified, this option tellssadcto write a dummy record containing the specifiedcommentstring. this comment can then be displayed with option-Cofsar. it's giving "leave a note for future you" energy. ๐-Dโ UsesaYYYYMMDDinstead ofsaDDas the standard system activity daily data file name. so like, full date vibes instead of just day. very organized. very demure. ๐๏ธ-Fโ The creation ofoutfilewill be forced. if the file already exists and has a format unknown tosadcthen it will be truncated. this may be useful for daily data files created by an older version ofsadcand whose format is no longer compatible with current one. basically she's like "i don't know her" and starts fresh. no apologies. ๐ฅ-fโfdatasync()will be used to ensure data is written to disk. this differs from the normal operation in that a sudden system reset is less likely to result in thesaDDdatafiles being corrupted. however, this is at the expense of performance within thesadcprocess as forward progress will be blocked while data is written to underlying disk instead of just to cache. so like, safer but slower. trade-offs, bestie. ๐-Lโsadcwill try to get an exclusive lock on theoutfilebefore writing to it or truncating it. failure to get the lock is fatal, except in the case of trying to write a normal (i.e. not a dummy and not a header) record to an existing file, in which casesadcwill try again at the next interval. usually, the only reason a lock would fail would be if anothersadcprocess were also writing to the file. this can happen whencronis used to launchsadc. if the system is under heavy load, an oldsadcmight still be running whencronstarts a new one. without locking, this situation can result in a corrupted system activity file. so like, lock it or lose it. ๐จ-S { keyword[,...] | ALL | XALL }โ Possible keywords areDISK,INT,IPV6,POWER,SNMP,XDISK,ALLandXALL. specify which optional activities should be collected bysadc. some activities are optional to prevent data files from growing too large. theDISKkeyword indicates thatsadcshould collect data for block devices. theINTkeyword indicates thatsadcshould collect data for system interrupts. theIPV6keyword indicates that IPv6 statistics should be collected bysadc. thePOWERkeyword indicates thatsadcshould collect power management statistics. theSNMPkeyword indicates that SNMP statistics should be collected bysadc. theALLkeyword is equivalent to specifying all the keywords above and therefore all previous activities are collected. theXDISKkeyword is an extension to theDISKone and indicates that partitions and filesystems statistics should be collected bysadcin addition to disk statistics. this option works only with kernels2.6.25and later. theXALLkeyword is equivalent to specifying all the keywords above (including keyword extensions) and therefore all possible activities are collected.
Important note: The activities (including optional ones) saved in an existing data file prevail over those selected with option-S. as a consequence, appending data to an existing data file will result in option-Sbeing ignored. so like, she's gonna do what the file says, not what you say. respect the file. ๐
-Vโ Print version number then exit. she's like "here's my version, bye." short and sweet. ๐
๐ ENVIRONMENT ๐
the sadc command takes into account the following environment variable:
S_TIME_DEF_TIMEโ If this variable exists and its value isUTCthensadcwill save its data in UTC time.sadcwill also use UTC time instead of local time to determine the current daily data file located in the/var/log/sadirectory. so like, she can be on UTC time if you tell her to. world traveler vibes. ๐โจ
๐ EXAMPLES ๐
bestie, here are some real-life slay moments. ๐
/usr/lib/sa/sadc 1 10 /tmp/datafile
write 10 records of one second intervals to the /tmp/datafile binary file. so like, one second, ten times, boom. done. ๐ฆ
/usr/lib/sa/sadc -C "Backup Start" /tmp/datafile
insert the comment "Backup Start" into the file /tmp/datafile. it's giving "note to self" energy. ๐
๐ BUGS ๐
okay so heads up, bestie:
- the
/procfilesystem must be mounted for thesadccommand to work. if it's not, she's not gonna work. no cap. ๐ญ - all the statistics are not necessarily available, depending on the kernel version used.
sadcassumes that you are using at least a2.6kernel. so like, if you're on some ancient kernel, she might be missing some tea. ๐
๐ง 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. very demure, very mindful. ๐โจ
/procand/syscontain various files with system statistics. she reads these. she's nosy but in a cute way. ๐
๐ AUTHOR ๐
Sebastien Godard (sysstat <at> orange.fr). shoutout to the king who made this happen. ๐ซถ
๐ SEE ALSO ๐
sar(1), sa1(8), sa2(8), sadf(1), sysstat(5)
iykyk, these are the other tools you'll wanna know. go check 'em out. ๐ฅ
this page is from the Linux User's Manual, AUGUST 2023 edition. periodt. ๐โจ
๐ฆ where this page comes from
- alpine 3.24: sysstat-doc 12.7.8-r0 ยท GPL-2.0-or-later
- arch rolling: sysstat 12.8.0-1 ยท GPL-2.0-only
- (C) 1999-2020 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