Sysstat Time Options and Command Differences
0
votes
1
answer
1147
views
I would like to track total CPU and memory use on an Ubuntu 20.04 machine. For that purpose, I am about to install the sysstat library. I read the manuals of and posts on
sar
and related functions, but am still confused about the syntax.
**What I would like to do**: Record total CPU and memory use every five seconds. Export the data once a day as CSV and delete the binary data.
**What confuses me**: 1. There are multiple settings specifying time intervals. sar -u %system -r %memused 5
records CPU and memory use every five seconds. On top of that, the package generates "activity reports" every ten minutes as defined by 5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
in /etc/cron.d/sysstat
. I am confused about what happens every five seconds and what happens every ten minutes. Does the program first cache the data every five seconds and then writes it to a file every ten minutes? 2. Multiple functions write to disk. Which of them do I need? sar -u %system -r %memused -o 5
, sadc -u %system -r %memused 5 -
, or sa1
? 3. Do I need to execute the code that generates a daily CSV file (sadf -d /var/log/sysstat/sa$(date +%d -d yesterday) > /home/some_user/sar_data.csv
) as a chron job?
As a side note: if anyone knows of a solution that would be computationally more efficient than this sysstat approach, feel free to suggest it.
Asked by user
(71 rep)
Jul 18, 2021, 12:04 PM
Last activity: Jul 18, 2021, 04:17 PM
Last activity: Jul 18, 2021, 04:17 PM