🐧 Linux β€’ CPU/MEM continuous high β€’ Alert on consecutive high & restored

CPU_Alert Linux: Monitor CPU & Memory Usage and Get Alerts (High / Restored)

CPU_Alert Linux monitors CPU and memory utilization and sends alerts only when usage stays consecutively higher than your threshold β€” then sends another alert when the system returns to normal. No alerts for short spikes, and no repeated alerts while utilization remains high.

How it works

  • Monitors CPU and Memory utilization and triggers alerts only when usage stays continuously high for a period of time.
  • Configure consecutive count (1, 2, 3… 50… 200… etc.) and threshold (yy%) as your limits.
  • No alerts for short spikes. Alerts are sent only when status changes: Normal β†’ consecutive high β†’ Normal.
  • Writes high-usage record to a log file with TOP1 program name, PID, and timestamp, and can mail you the log file daily.
  • β€œI am Alive” periodic mail notification option to confirm the monitor is running.

Installation & run (Linux)

Download, unzip, edit the config files, then run the program. After testing OK, you can run in background with silent mode.

# Download and unzip
wget https://www.sms4mail.com/download/cpualert_linux.zip
unzip cpualert_linux.zip
cd cpualert

# Edit config files
nano cpualert_setup.txt
nano cpualert_email.txt   # optional (alternative SMTP)

# Run
./cpualert

# Silent background mode (after testing OK)
./cpualert -s &

Configuration files

These files are included in the Linux download zip.

FilePurpose
cpualert_setup.txtThreshold and SMS/Email alert settings (CPU/MEM yy% and consecutive count xx)
cpualert_email.txtOptional alternative SMTP configuration for email alerts
cpualertLinux executable program
Threshold + consecutive rule
Example concept: alert only when CPU/MEM stays above yy% for xx consecutive checks (no alert for short spikes).

Kill TOP1 option (optional)

  • Optional feature to kill TOP1 process when utilization remains consecutively high beyond a KILLCOUNT number.
  • Alert text will tell you which PID and COMMAND has been killed.
  • Tip: set a small threshold to alert quickly and a bigger KILLCOUNT to kill only when high usage lasts for a long period.

Sample SMS alert text

Alert message includes CPU/MEM usage and TOP1 data (PID, USER, %CPU, %MEM, TIME, COMMAND).

Example
TOP1 data is TOP command output sorted by %CPU/%MEM.
192.168.1.2 SuSe CPU now 100% higher than 75% for 10 times
(TOP1- PID: 31118 USER: root %CPU: 99.6 %MEM: 0.1 TIME: 5:30.60 COMMAND: loopcpu)

SMTP options (Email delivery)

  • SMS and Email alerts can be sent from our server, and you can also configure alternative SMTP to ensure delivery.
  • Local SMTP server
  • Gmail / Yahoo (use App Password instead of email password)
  • SendGrid SMTP relay (API key as password; no security concern)
SMTP setup guides