VitaGuard: My First Real-Time Linux System Health Monitor in Bash
Source: Dev.to

What the script does
VitaGuard provides a continuously updating overview of system health:
Resource usage
- CPU usage with visual progress bars
- Memory usage (used vs total)
- Disk usage for the root filesystem
- Automatic warnings for high‑usage thresholds
System information
- System uptime and load average
- Active network interfaces
Processes
- Top 5 processes by CPU usage
- Clean, readable table output
Logs
Scans recent system logs for critical issues, filtering for errors such as:
- Kernel issues
- Failed services
- OOM events
Reduces common log noise and limits output to the most recent entries.
Services
Checks the status of common services:
sshddockernginx
All of this runs in an auto‑refreshing loop, updating every 5 seconds until you exit.
Why I built it
I wanted a lightweight tool that mirrors what I actually check when supporting or troubleshooting a Linux system—CPU, memory, disk, processes, and critical log entries—without any over‑engineering. The goals were:
- Turn raw system metrics into a readable output
- Build visual progress bars and color‑based alerts
- Filter noisy logs to surface useful signals
- Write Bash that is structured, readable, and safe
- Create something practical that can be dropped onto a server and used immediately
Challenges & Fixes
- Progress bar colors weren’t showing up initially. Fixed by using
printf "%b"to make the escape codes work. - Syslog noise: added
grep -vfilters to remove junk like “workqueue” and “drm”. - Process table alignment: used
awkwith fixed widths to align everything nicely.
What I learned
- Pulling system info (CPU, memory, disk) from commands like
top,free, anddfand cleaning it up withawk. - Using terminal color codes to make warnings stand out (green for good, red for bad).
- Writing Bash scripts that don’t break easily by adding checks, handling empty results, and keeping the code readable.
What’s next
Planned improvements for VitaGuard:
- Configurable refresh interval
- Optional non‑interactive / one‑shot mode
- Improved compatibility across Linux distributions
- Optional HTML/JS dashboard for remote monitoring
Source code
The full script is available on GitHub:
Repository:
VitaGuard is a lightweight Bash‑based system health monitor that provides real‑time insights into CPU, memory, disk usage, processes, logs, network interfaces, and service status on Linux systems.
🛡️ VitaGuard
Quickly monitor your Linux server’s vital signs straight from the terminal.
🛠️ Technologies
- Bash scripting
- Core Linux tools:
top,free,df,ps,grep,awk,tail
🚀 Features
- Real‑time updates (refreshes every 5 seconds)
- Color‑coded progress bars for CPU, memory, disk
- Uptime and load average display
- Top 5 processes by CPU usage (clean table)
- Recent critical errors from syslog (filtered, max 3 lines)
- ASCII art header
🔍 How it works
The script runs in an infinite loop that:
- Clears the terminal screen.
- Collects system metrics using standard Linux utilities.
- Renders color‑coded progress bars and warnings.
- Displays process, log, and service information.
- Sleeps for the configured interval (default 5 seconds) before repeating.
