System Resources Monitoring
System Resources Monitoring
Section titled “System Resources Monitoring”TL;DR (Quick Start)
Section titled “TL;DR (Quick Start)”For the impatient: view system resources and CPU usage.
/system resource printFor per-process CPU breakdown:
/tool profileOverview
Section titled “Overview”What this does: System Resources provides real-time monitoring of CPU load, memory usage, disk space, uptime, and hardware information. The profiler tool identifies which processes consume CPU resources.
When to use this:
- Monitoring router health and performance
- Troubleshooting high CPU or memory usage
- Verifying hardware specifications
- Capacity planning before adding services
- Diagnosing slow network performance
Prerequisites:
- Access to RouterOS via Winbox, SSH, or WebFig
- Read permissions (no special access required)
Configuration Steps
Section titled “Configuration Steps”Step 1: View System Resources
Section titled “Step 1: View System Resources”Display overall system information and resource usage.
/system resource printExpected output:
uptime: 3d14h52m31s version: 7.16 (stable) build-time: 2024-09-20 13:29:57 factory-software: 7.10 free-memory: 186.5MiB total-memory: 256.0MiB cpu: ARM cpu-count: 2 cpu-frequency: 800MHz cpu-load: 3% free-hdd-space: 12.4MiB total-hdd-space: 16.0MiB write-sect-since-reboot: 4521 write-sect-total: 124589 bad-blocks: 0% architecture-name: arm board-name: hAP ax lite platform: MikroTikStep 2: Monitor Real-Time Usage
Section titled “Step 2: Monitor Real-Time Usage”View live CPU and memory statistics.
/system resource monitor onceExpected output:
cpu-used: 5%cpu-used-per-cpu: 3%,7% free-memory: 186.0MiBFor continuous monitoring (press Ctrl+C to stop):
/system resource monitorStep 3: View Per-Core CPU Usage
Section titled “Step 3: View Per-Core CPU Usage”Check individual CPU core loads.
/system resource cpu printExpected output:
# CPU LOAD IRQ DISK 0 0 2% 1% 0% 1 1 4% 0% 0%Step 4: Identify CPU-Heavy Processes
Section titled “Step 4: Identify CPU-Heavy Processes”Use the profiler to find which processes consume CPU.
/tool profileExpected output:
NAME CPU USAGEidle all 97%networking all 2%management all 1%For per-core breakdown:
/tool profile cpu=allCommon Scenarios
Section titled “Common Scenarios”Scenario: Troubleshoot High CPU Usage
Section titled “Scenario: Troubleshoot High CPU Usage”When CPU load is consistently high, identify the cause:
# Check overall CPU/system resource print
# Identify process consuming CPU/tool profile duration=10Common high-CPU processes:
| Process | Likely Cause |
|---|---|
networking | High packet rate, consider hardware offload |
management | Too many Winbox/SSH sessions, scripts running |
firewall | Complex firewall rules, consider fasttrack |
dns | DNS cache under heavy load |
wireless | Many wireless clients, interference |
encrypting | VPN/IPsec traffic without hardware acceleration |
Scenario: Monitor Memory Usage
Section titled “Scenario: Monitor Memory Usage”Check for memory pressure:
/system resource printCalculate usage percentage:
:local free [/system resource get free-memory]:local total [/system resource get total-memory]:put ("Memory used: " . (($total - $free) * 100 / $total) . "%")Memory guidelines:
- Below 20% free: Consider reducing services or upgrading hardware
- Below 10% free: Risk of instability, immediate action needed
- Out of memory: Router may reboot unexpectedly
Scenario: Check Disk Space
Section titled “Scenario: Check Disk Space”Monitor storage for logs and files:
/system resource printIf disk is full:
# Check file usage/file print
# Clear old logs if needed/system logging action set memory memory-lines=100Scenario: View Hardware Information
Section titled “Scenario: View Hardware Information”List connected hardware devices:
/system resource hardware printFor USB devices:
/system resource usb printScenario: Script-Based Monitoring
Section titled “Scenario: Script-Based Monitoring”Get specific values for scripts or SNMP:
# Get free memory/system resource get free-memory
# Get CPU load/system resource get cpu-load
# Get uptime/system resource get uptimeExample alert script:
:local cpuLoad [/system resource get cpu-load]:if ($cpuLoad > 80) do={ :log warning ("High CPU: " . $cpuLoad . "%")}Scenario: IRQ Load Balancing (Multi-Core)
Section titled “Scenario: IRQ Load Balancing (Multi-Core)”On multi-core systems with high network traffic, distribute IRQ load:
# View current IRQ assignments/system resource irq print
# Check per-core IRQ load/system resource cpu printEnable RPS for better packet distribution (v7+):
/system resource irq rps set [find] rps=yesVerification
Section titled “Verification”Check 1: Verify Resources are Accessible
Section titled “Check 1: Verify Resources are Accessible”/system resource printExpected: Shows uptime, version, memory, and CPU information.
Check 2: Verify CPU is Not Overloaded
Section titled “Check 2: Verify CPU is Not Overloaded”/system resource get cpu-loadExpected: Below 80% under normal operation.
Check 3: Verify Sufficient Free Memory
Section titled “Check 3: Verify Sufficient Free Memory”/system resource get free-memoryExpected: At least 20% of total memory free.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Solution |
|---|---|---|
| CPU constantly at 100% | Overloaded or attack | Use /tool profile to identify process; enable fasttrack for routing |
| Memory slowly decreasing | Memory leak or growing tables | Check connection tracking, DNS cache, address lists; consider reboot |
| ”Out of memory” reboot | Insufficient RAM for workload | Reduce services, clear logs, disable unused packages, upgrade hardware |
| High IRQ usage | Network traffic on single core | Enable hardware offload; use RPS on v7+ |
| Disk space full | Log files or packages | Clear files with /file remove; reduce logging verbosity |
management high CPU | Many concurrent sessions | Limit Winbox sessions; check for runaway scripts |
Profiler shows unclassified | Unknown process | Usually kernel tasks; monitor for patterns |
Common Mistakes
- Don’t ignore gradual memory decline - Memory that never returns may indicate a leak; plan periodic reboots if needed
- Don’t confuse profile total with resource load -
/tool profilepercentages may not match/system resourceexactly - Don’t overlook IRQ distribution - Single-core IRQ handling limits throughput on multi-core routers
- Don’t forget disk writes wear flash - Excessive logging shortens NAND lifespan; use remote syslog for busy routers
Profiler Process Reference
Section titled “Profiler Process Reference”| Process | Description |
|---|---|
idle | Free CPU (higher is better) |
networking | Packet processing |
management | Winbox, SSH, API, web sessions |
firewall | Packet filtering and NAT |
encrypting | IPsec, VPN encryption |
dns | DNS server/cache |
routing | Routing protocol calculations |
wireless | Wireless driver operations |
bridging | Bridge forwarding |
unclassified | Kernel and uncategorized tasks |
Related Topics
Section titled “Related Topics”Monitoring
Section titled “Monitoring”- Health Monitoring - hardware sensors and voltage
- Graphing - enable resource usage graphs
- Netwatch - monitor hosts and trigger alerts
- Logging - configure system logging
Performance
Section titled “Performance”- Profiler - identify CPU-intensive processes
- Torch - real-time traffic analysis
- Scheduler - automate resource monitoring
System Management
Section titled “System Management”- System Backup - backup before changes
- RouterBOARD - hardware information
- Package Installation - manage features
Reference
Section titled “Reference”Properties Reference
Section titled “Properties Reference”| Property | Type | Description |
|---|---|---|
uptime | time | Time since last boot |
version | string | RouterOS version |
cpu-load | percent | Current CPU usage |
free-memory | bytes | Available RAM |
total-memory | bytes | Installed RAM |
free-hdd-space | bytes | Available storage |
total-hdd-space | bytes | Total storage |
cpu-count | integer | Number of CPU cores |
cpu-frequency | MHz | CPU clock speed |
architecture-name | string | CPU architecture (arm, x86, etc.) |
board-name | string | Hardware model |
bad-blocks | percent | NAND bad block percentage |
Command Reference
Section titled “Command Reference”| Command | Description |
|---|---|
/system resource print | Display all resource information |
/system resource monitor | Real-time CPU and memory monitoring |
/system resource cpu print | Per-core CPU statistics |
/system resource irq print | Interrupt assignments |
/system resource hardware print | Connected hardware devices |
/system resource usb print | USB device information |
/system resource get <property> | Get specific value for scripting |
/tool profile | Per-process CPU profiler |
/tool profile cpu=all | Per-core process breakdown |
Summary
Section titled “Summary”System Resources monitoring is essential for router health and troubleshooting:
- View resources with
/system resource printfor CPU, memory, disk, and uptime - Monitor real-time with
/system resource monitorfor live updates - Identify CPU hogs with
/tool profileto see per-process usage - Check per-core with
/system resource cpu printfor load distribution
Key points:
- CPU load below 80% is healthy; above indicates overload or attack
- Keep at least 20% memory free to avoid instability
- Use
/tool profile duration=10for accurate CPU breakdown (brief samples miss spikes) - High
networkingin profiler suggests enabling fasttrack or hardware offload - Multi-core systems benefit from RPS (Receive Packet Steering) in v7+
- Excessive disk writes wear flash storage; use remote syslog for busy routers
- Memory usage per-process isn’t shown; check connection tracking, DNS cache, and address lists
- Gradual memory decline may indicate a leak; plan periodic maintenance reboots if needed