Skip to content

About

A simple Bash script that checks system health indicators

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

How to Run

chmod +x system_health_check.sh

Basic run (saves log to /var/log/system_health.log)

sudo bash system_health_check.sh

Custom log path

bash system_health_check.sh --log ~/my_health.log

No color output (useful for piping/redirecting)

bash system_health_check.sh --no-color

Custom ping target

bash system_health_check.sh --host 1.1.1.1

Tip: If run without sudo, the script automatically falls back to saving the log in your home directory (~/system_health.log) instead of crashing.

What Each Section Does Section What it checks Alert condition System Info Hostname, OS, kernel, uptime — CPU Usage Real-time usage via /proc/stat, top 5 processes ⚠ ≥70% · ✘ ≥90% Memory RAM/Swap used vs. total via free -h ⚠ ≥75% · ✘ ≥90% Disk Usage All real partitions via df -h ⚠ any partition ≥80% Network All IPs, gateway, DNS, ping test ✘ if ping fails Services Checks sshd, apache2, nginx, cron, ufw ⚠ if inactive Load Average 1/5/15-minute load from uptime ⚠ if load > core count Key Design Choices

Dual output — every line prints to terminal (with color) and appends clean plain text to the log file simultaneously via a shared $REPORT variable.
Graceful fallbacks — uses /proc/stat instead of fragile top parsing; falls back to /etc/os-release if lsb_release isn't installed; handles missing systemctl.
Timestamped logs — each run appends (not overwrites) to the log with a full timestamp header, so you get a history.
Configurable — threshold, services list, ping host, and log path are all variables at the top, easy to customize.

About

A simple Bash script that checks system health indicators

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages