📑 Daftar Isi
- Step 1: Install Atop on Your Linux Server
- Step 2: Configure the Systemd Service for Atop Recording
- Step 3: Set Up a Systemd Timer for Continuous Recording
- Step 4: Configure Storage Path and Retention
- Step 5: Add a Cron Job for Additional Cleanup
- Step 6: Analyze Historical Data with Atop Replay Mode
- Troubleshooting: Common Atop Configuration Issues
- Best Practice: Building a Complete Monitoring Stack
Let me tell you about a night I’ll never forget. It was 2 AM, my phone buzzed with an alert — production server CPU at 100%. I groggily SSH’d in, ran top, and… everything looked normal. The spike was already over. Whatever caused it, it came and went in the span of a few minutes. But I had zero evidence of what happened. No logs, no snapshots, nothing. The next morning, the client asked what caused the slowdown. My answer? “I’m not sure.”
That was the night I discovered atop’s historical recording feature. And honestly, it changed the way I do server monitoring forever. You see, most of us rely on real-time monitoring tools — top, htop, glances, even Grafana dashboards. They’re great for now. But the moment something happens and you need to look back? You’re out of luck. Atop solves that by continuously recording system snapshots to disk, creating a time-travel log of everything that happened on your server. Here’s what worked for me — a complete, no-fluff guide to configuring Linux atop historical monitoring.
Here’s the thing most sysadmins don’t realize until it’s too late: real-time monitoring is only half the picture. When a production incident happens at 3 AM and you’re scrambling to figure out what went wrong, having historical data isn’t just nice to have — it’s the difference between resolving an issue with confidence and shooting in the dark. Think about it. A memory leak that grows slowly over weeks won’t trigger any real-time alert until it’s too late. A cron job conflict that causes a 5-minute CPU spike every Tuesday at 2:30 AM? You’ll never catch it with top. Even a brief DDoS attack that lasts 30 seconds and then vanishes — without historical snapshots, it’s like it never happened. Top historical monitoring with atop gives you the ability to rewind time, inspect exactly what was consuming resources, which processes were active, and what the system state looked like at any point in the past.
And it’s not just about reactive debugging. Historical data lets you spot trends — maybe your application’s memory usage has been creeping up 2% every week, or disk I/O latency spikes every time your backup cron runs. These patterns are invisible in real-time but crystal clear when you look at data spanning days or weeks. That’s the power of continuous system recording, and that’s exactly what atop delivers.
Step 1: Install Atop on Your Linux Server
First things first — you need atop installed. On most distros, it’s a one-liner:
# Debian/Ubuntu
sudo apt update && sudo apt install atop -y
# RHEL/Rocky/CentOS
sudo dnf install atop -y
# Arch Linux
sudo pacman -S atop
Verify the installation:
atop -v
# Output: atop version 2.10.0
On Debian/Ubuntu, the package usually sets up systemd services automatically. On other distros, you might need to configure them manually. Let’s check what we have:
systemctl status atop-rotate.service
systemctl status atop.service
If the services already exist, great — move on to configuration. If not, don’t worry. We’ll set everything up from scratch. The key thing to understand is that atop has two modes: interactive mode (the live view when you type atop) and recording mode (the background daemon that saves snapshots to disk). We want the second one running continuously.

Step 2: Configure the Systemd Service for Atop Recording
This is where things get interesting — and where most guides either overcomplicate or skip entirely. Let me break it down.
Create the main atop service file:
sudo nano /etc/systemd/system/atop.service
Here’s what I use:
[Unit]
Description=Atop system monitor recording
After=local-fs.target
[Service]
Type=simple
ExecStart=/usr/bin/atop -a 120 600
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
Let me explain those parameters because they matter:
-a— adaptive mode. Atop only saves data that changed since the last snapshot. This is crucial for disk efficiency. Without it, you’re recording everything every interval, which eats storage fast.120— snapshot interval in seconds. Every 2 minutes, atop captures a full system state. For most servers, 120 seconds is the sweet spot between detail and storage usage.600— total recording duration in seconds before the process exits. We set this to 600 (10 minutes) because our systemd timer will restart it — more on that next.
Enable and start it:
sudo systemctl daemon-reload
sudo systemctl enable atop.service
sudo systemctl start atop.service
sudo systemctl status atop.service
Look for active (running). If you see an error, check the journal:
sudo journalctl -u atop.service -f
Step 3: Set Up a Systemd Timer for Continuous Recording
Okay so here’s the thing — just running the service isn’t enough for truly continuous historical monitoring. You need a mechanism to restart the recording process periodically. That’s where systemd timers come in.
Create the timer file:
sudo nano /etc/systemd/system/atop-rotate.timer
[Unit]
Description=Atop recording rotation timer
[Timer]
OnBootSec=5min
OnUnitActiveSec=10min
Persistent=true
[Install]
WantedBy=timers.target
The Persistent=true line is important — it ensures the timer fires even if the system was off during a scheduled interval. The OnBootSec=5min means it starts 5 minutes after boot, giving the system time to settle.
Now the rotation service:
sudo nano /etc/systemd/system/atop-rotate.service
[Unit]
Description=Rotate atop recordings
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/libexec/atop/atop-rotate
ExecStartPost=/bin/systemctl restart atop.timer
[Install]
WantedBy=multi-user.target
Enable everything:
sudo systemctl daemon-reload
sudo systemctl enable atop-rotate.timer
sudo systemctl start atop-rotate.timer
sudo systemctl list-timers --all | grep atop
You should see atop-rotate.timer listed as active. Every 10 minutes, it rotates the recording files, and your historical data gets saved to /var/log/atop/ with filenames like atop_YYYYMMDD.
Step 4: Configure Storage Path and Retention
By default, atop saves everything to /var/log/atop/. If your /var/log partition is small or you want to store data on a separate disk, you’ll need to change this.
Edit the atop configuration file:
# Debian/Ubuntu
sudo nano /etc/default/atop
# RHEL/Rocky
sudo nano /etc/sysconfig/atop
Set these values:
LOGPATH=/data/atop-logs
LOGINTERVAL=120
LOGGENERATIONS=28
What each setting does:
LOGPATH— where historical data files are stored. Make sure this directory exists and atop has write permissions.LOGINTERVAL— how often (in seconds) a snapshot is taken. 120 = every 2 minutes. Lower values give more detail but use more disk.LOGGENERATIONS— how many days of data to keep before auto-deletion. 28 = about 4 weeks. Adjust based on your disk space and compliance requirements.
If you’re using a custom path, create it first:
sudo mkdir -p /data/atop-logs
sudo chown root:root /data/atop-logs
sudo chmod 755 /data/atop-logs
Then restart everything:
sudo systemctl restart atop.service
sudo systemctl restart atop-rotate.timer
Step 5: Add a Cron Job for Additional Cleanup
Even with LOGGENERATIONS set, I like having an extra safety net — a cron job that aggressively cleans up old files. Better safe than sorry, especially on servers with tight disk budgets.
sudo crontab -e
Add this line:
# Cleanup atop logs older than 14 days
30 2 * * * find /var/log/atop/ -name "atop_*" -type f -mtime +14 -delete
Simple, effective, and your disk will thank you. If you want to track when cleanups happen (useful for auditing), add a second line to log the action:
30 2 * * * echo "$(date): Cleaned old atop logs" >> /var/log/atop-cleanup.log
Step 6: Analyze Historical Data with Atop Replay Mode
Alright, now the fun part. All that setup pays off when you actually need to investigate something. Atop’s replay mode (-r flag) lets you travel back in time and inspect system state at any point.
# Replay today's data
sudo atop -r
# Replay a specific date
sudo atop -r /var/log/atop/atop_20260815
# Jump to a specific time
sudo atop -r /var/log/atop/atop_20260815 -b 14:30
# Replay a specific time window
sudo atop -r /var/log/atop/atop_20260815 -b 14:30 -e 15:00
Once you’re in replay mode, navigation is straightforward:
| Key | Action |
|---|---|
| t | Next snapshot (forward 1 interval) |
| T | Previous snapshot (backward 1 interval) |
| b | Jump to a specific timestamp |
| g | Jump to a timestamp with duration |
| s | Sort by a specific field (CPU, MEM, DSK, etc.) |
| P | Process view |
| D | Disk view |
| N | Network view |
| C | Show command line per process |
| m | Memory details per process |
Real-world example: last week, a client reported intermittent slowdowns between 2-3 PM. Here’s exactly how I investigated it:
# 1. Open the day's recording
sudo atop -r /var/log/atop/atop_20260815 -b 13:50
# 2. Press 't' to step through snapshots every 2 minutes
# 3. Watch CPU and memory columns for anomalies
# 4. When you spot the spike, press 'P' to see process breakdown
# 5. Press 'C' to see which commands were running
# 6. Press 'm' to check memory details for suspicious processes
What I found: a Java application was running full garbage collection cycles every 15 minutes, causing 30-second CPU spikes that users experienced as lag. Without atop historical data, this would’ve been nearly impossible to diagnose — the spikes were too brief to catch in real-time.

Troubleshooting: Common Atop Configuration Issues
I’ve helped configure atop on dozens of servers, and these are the issues that come up most often:
| Issue | Likely Cause | Fix |
|---|---|---|
| No data files in LOGPATH | Permission issue or wrong path | Run ls -la /var/log/atop/ and verify atop has write access. Check service logs with journalctl -u atop.service |
| Disk fills up quickly | Interval too low or server too busy | Increase LOGINTERVAL to 300-600 seconds. Consider using adaptive mode (-a flag) if not already enabled |
| Atop service won’t start | Systemd conflict or missing binary | Check which atop to verify installation. Check systemctl status atop for detailed error messages |
| Replay shows blank or garbage | Corrupted data file | Check file size: ls -lh /var/log/atop/atop_*. Files under 1KB are likely corrupt — delete and let new data accumulate |
| Wrong timestamps in replay | Timezone mismatch | Verify server timezone: timedatectl. Ensure NTP is synced |
| Timer doesn’t fire | Systemd timer not enabled | Run systemctl list-timers --all and verify status. Re-enable if needed |
Best Practice: Building a Complete Monitoring Stack
Atop historical monitoring is powerful, but it shouldn’t be your only tool. Here’s what I run in production and why each layer matters:
- Atop — deep-dive historical analysis. When you need to know exactly what process caused a spike at a specific time, this is your go-to.
- Netdata or Prometheus + Grafana — real-time dashboards and alerting. These catch problems as they happen and send notifications.
- sysstat/sar — long-term trend analysis. Perfect for capacity planning and spotting gradual degradation over months.
- journalctl + rsyslog — log analysis. Application errors, authentication failures, kernel messages — the narrative layer of system health.
When used together, these four tools give you complete visibility. Netdata alerts you that CPU spiked. Atop tells you which process caused it and for how long. Sar shows you whether this is a new pattern or a recurring issue. And journalctl gives you the error messages that explain why.
Want to go deeper? Check out these related guides: Linux Performance Monitoring with Netdata, Setting Up Prometheus + Grafana for Server Monitoring, and Complete Guide to sysstat/sar for Linux Performance Analysis.
Q: How often should atop record snapshots to disk?
Every 120 seconds (2 minutes) works well for most production servers. If you’re debugging intermittent issues and need finer granularity, drop it to 60 seconds. For servers with limited disk space, 300 seconds (5 minutes) is still plenty for general monitoring. The key is balancing detail against storage consumption — 120 seconds gives you about 720 snapshots per day, which is more than enough to reconstruct most incidents.
Q: How much disk space does atop historical monitoring consume?
It depends on your server’s load and the number of running processes. As a rough guide: a typical server with 50-100 processes, recording every 120 seconds, generates about 5-15MB per day. For a 28-day retention window, you’re looking at roughly 150-400MB total. Heavy-duty servers with hundreds of processes will use more. Always keep an eye on disk usage and adjust LOGINTERVAL or LOGGENERATIONS accordingly.
Q: Can I compare data from two different dates?
Absolutely. Open two terminal sessions, replay each date in a separate window, and compare side by side. For more sophisticated comparisons, you can write a script (Python works great) to parse atop log files and generate a diff report. Some sysadmins also export the data to CSV and compare in a spreadsheet. The replay mode’s timestamp navigation makes it easy to align both views to the same time of day.
Q: Is atop safe to run on production servers?
Completely. Atop’s recording mode has minimal overhead — typically under 1% CPU and negligible memory usage. It takes snapshots at defined intervals rather than continuously polling, so it’s very lightweight. Many large-scale production environments (handling thousands of concurrent users) run atop without any performance impact. Just make sure your recording interval and retention settings are appropriate for your available disk space.
Q: How do I verify that atop recording is actually running?
Run systemctl status atop.service — you should see active (running). Then check the log directory: ls -la /var/log/atop/. You should see files with the atop_YYYYMMDD naming pattern, and their sizes should be growing. If files are missing or stuck at 0 bytes, something’s wrong with the configuration. Also check systemctl list-timers | grep atop to confirm the rotation timer is active.
Look, configuring atop historical monitoring isn’t rocket science, but it does require actually doing it — not just bookmarking this article and forgetting about it. Trust me, the next time something weird happens on your server at 2 AM, you’ll be grateful you set this up. Bookmark this guide, follow the steps, and give your server a time machine. You won’t regret it. And if you’ve found an even better configuration or have a cool use case I haven’t mentioned, drop it in the comments — I’m always looking to learn something new.