8

I'm having post-mortem atop log on Ubuntu machine, which I'm able to view with

atop -r

The problem is that log files are shown in 10 minute intervals with t and Shift+t, while I would prefer 1 minute intervals. When current time is changed with b, it is quantized to nearest 10 minute point.

I have a line in /etc/init.d/atop, but I'm not sure if it affects anything here:

INTERVAL=60

How can I make atop logs to be browsed with 1 minute accuracy with t and Shift+t?

Is the information between these 10 minute intervals already lost?

What are the possible workarounds if this is not possible?

9 Answers 9

8

On recent versions the configuration file used by systemd is /usr/share/atop/atop.daily (see /etc/systemd/system/multi-user.target.wants/atop.service).

Here you can change the variable INTERVAL and restart the atop service.

1
  • That was the one comment helping me out on Ubuntu 18.04, thank you! As one can see on /usr/share/atop/atop.daily it isn't really sourcing the /etc/atoprc. And even if the program itself respects it, specifying the INTERVAL via a command line parameter will probably have a higher priority (as it is done in the above script). Commented Jun 11, 2019 at 12:28
7

Add the following line to /etc/atoprc, if the file doesn't exist create it:

interval 60

atop no longer uses the /etc/default/atop file.

Unless you are using an older version of atop. Then you might want to change INTERVAL=600 to INTERVAL=60 in /etc/default/atop.

2
  • Thanks a lot! Indeed, only editing /etc/default/atop could help. Commented Feb 23, 2017 at 20:29
  • Your welcome. I find atop to be a very useful utility. Commented Feb 24, 2017 at 1:29
4

Try to edit the file /usr/share/atop/atop.daily and change INTERVAL=.

Then:

service atop restart
3

I just installed atop 2.4.0 today on CentOS 7. I tried several things to change the interval of the running service, including the accepted answer here but no change to the service status.

I eventually saw success by editing /usr/share/atop/atop.daily to change LOGINTERVAL=600 to LOGINTERVAL=60 , which I confirmed via systemctl status atop

I know there is already an accepted answer but here is my experience with CentOS 7. I suppose I will find out later if this does what I want.

2

For CentOS 7...

echo "LOGINTERVAL=60" >> /etc/sysconfig/atop

This file is being read by /usr/share/atop/atop.daily, but $LOGINTERVAL variable is used to modify time interval, so that simple command may fix.

2

The new way to do this is by setting the interval from the environment file that overrides current definitions.

EnvironmentFile path will differ from distro to distro, but now you know where to apply the change:

# systemctl cat atop
...
[Service]
...
Environment=LOGINTERVAL=600
...
---> EnvironmentFile=/etc/sysconfig/atop <---
...

# sed -i '/LOGINTERVAL=600/LOGINTERVAL=60/' /etc/sysconfig/atop

# systemctl daemon-reload

# systemctl restart atop
1

For Debian/Proxmox/Ubuntu and Centos 7 the below will do it perfectly.

sed -i 's/600/60/' /usr/share/atop/atop.daily
systemctl daemon-reload && systemctl restart atop && service atop status

Before:

root@coby:~# service atop status
● atop.service - Atop advanced performance monitor
   Loaded: loaded (/lib/systemd/system/atop.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-06-02 18:34:27 CEST; 27s ago
     Docs: man:atop(1)
 Main PID: 30801 (atop)
   CGroup: /system.slice/atop.service
           └─30801 /usr/bin/atop -a -R -w /var/log/atop/atop_20200602 600

Jun 02 18:34:27 coby systemd[1]: Started Atop advanced performance monitor.
root@coby:~# 

After:

root@coby:~# sed -i 's/600/60/' /usr/share/atop/atop.daily
root@coby:~# systemctl daemon-reload
root@coby:~# systemctl restart atop
root@coby:~# service atop status
● atop.service - Atop advanced performance monitor
   Loaded: loaded (/lib/systemd/system/atop.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-06-02 18:37:55 CEST; 4s ago
     Docs: man:atop(1)
 Main PID: 7186 (atop)
    Tasks: 1 (limit: 4915)
   Memory: 8.6M
      CPU: 840ms
   CGroup: /system.slice/atop.service
           └─7186 /usr/bin/atop -a -R -w /var/log/atop/atop_20200602 60

Jun 02 18:37:55 coby systemd[1]: Started Atop advanced performance monitor.
root@coby:~#
0
  1. Edit the file " /etc/default/atop ", setting INTERVAL=60
  2. Restart atop systemctl restart atop.service
1
  • If you look at any recent /etc/default/atop, you’ll see the comment “this file is no longer used and will be removed in a future release”, so I doubt your answer will work. Commented Oct 13, 2017 at 12:16
0

I found this file: /etc/sysconfig/atop

I'm on Centos6. Changing interval from 600 to 60 and then restarting the atop service:

service atop restart
2
  • 1
    Welcome to the site, and thank you for your contribution. However, please note that your post seems to mostly reiterate what this other answer already stated. If you want to add more details or context, please consider submitting an edit suggestion to that answer instead.
    – AdminBee
    Commented Oct 7, 2021 at 8:26
  • As AdminBee has pointed out, as well as being similar to user3347420's answer, your answer is also more or less the same as Yegolev's answer too Commented Oct 7, 2021 at 16:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .