Linux. History of system usage
There is a way to monitor your system usage and log to a file easily — with atop
command.
On my Ubuntu it can be installed with
1 |
sudo apt-get install atop |
It can be started as a top
command — it’s output almost the same.
But the most interesting feature is that it starts a daemon that logs system usage into a file that can be viewed later on. It stores system usage log for one month by default.
If you run this ps aux|grep atop
, it will output something like /usr/bin/atop -a -w /var/log/atop/atop_20190714 600
.
It means that it logs to /var/log/atop/atop_20190714
and does it every 600 seconds.
You can alter the config, which can be located in several places depending on your system:
/etc/default/atop
, /etc/atoprc
or /usr/share/atop/atop.daily
.
In my config, I decided to change log interval to 60 seconds by replacing 600 to 60 and running service atop restart
.
Now ps aux|grep atop
says /usr/bin/atop -a -w /var/log/atop/atop_20190714 60
.
You can browse logs for a day with command atop -r /var/log/atop/atop_20190714
and go forward in time by pressing t
, while T
makes it go backward.
Further reading:
https://lwn.net/Articles/387202/
https://unix.stackexchange.com/questions/347167/change-atop-log-interval-from-10-minutes-to-1-minute?newreg=2103c93a4e664cffa323312efdac9806
https://atoptool.nl/
Similar Posts
LEAVE A COMMENT
Для отправки комментария вам необходимо авторизоваться.