Monitoring your server's performance is essential to ensure stability and prevent resource overuse. Nubius Solutions offers 360 Monitoring as a reliable monitoring solution. Additionally, for customers who prefer a free, manual option, a Simple Resource Monitoring Script can be used.
Option 1: 360 Monitoring for Servers (Recommended)
360 Monitoring provides real-time insights into your server’s health, including:
-
CPU, RAM, and Disk Usage Monitoring
-
Real-time Alerts for unusual spikes in usage
-
Comprehensive Reports for performance trends
How to Get 360 Monitoring
-
Log in to the Nubius Customer Portal.
-
Navigate to Store → 360 Monitoring or go directly to https://portal.nubius.io/store/360monitoring
-
Select a monitoring plan and complete the order.
-
Follow the instructions in the setup email to configure your monitoring dashboard.
For more details, refer to the 360 Monitoring Documentation.
Option 2: Manual Monitoring with a Resource Monitoring Script
For those who do not wish to purchase monitoring, a simple script can be set up to track performance and send email alerts.
What This Script Does:
-
Checks CPU Load, Memory Usage, and Disk Space.
-
Sends an email alert if usage exceeds predefined thresholds.
-
Runs at scheduled intervals via cron jobs.
Installing the Monitoring Script
-
Log in to your server via SSH as
root
. -
Navigate to the root directory:
cd /root
-
Create a new script file:
vim load-alert.sh
-
Copy and paste the script below into the file:
#-------------- COPY BELOW HERE ---------------------------------------#
#!/bin/bash
#
# Script to notify admin user if their eApps VPS load has crossed a
# certain limit. It will send an email notification to the designated
# admin user.
#
# This script is based on one found at http://bash.cyberciti.biz/ and
# modified to fit the needs of eApps customers.
#
# This is a free script under GNU GPL version 2.0 or above.
# http://www.gnu.org/licenses/gpl-3.0.txt
# This software is offered AS IS, with NO WARRANTIES
#
#----------------------------------------------------------------------#
#
# CONFIGURATION
#
# The values for NOTIFY, NOTIFY2 and EMAIL are the only values that should be
# changed. Change NOTIFY to the load average you want to alert on. Change
# NOTIFY2 to the memory usage you want to alert on. Change EMAIL to the
# admin e-mail address that the alerts should go to.
#
# Set load average threshold. A value of 1.00 equals 100% of your CPU
NOTIFY="0.00"
# Memory usage threshold. Set value in KB (Kilobytes)
NOTIFY2="000000"
#
# Set e-mail address to send alerts to
EMAIL="user@example.com"
#
# Subject line for the e-mail alerts
SUBJECT="Alert $(hostname) load average $(date)"
#
#----------------------------------------------------------------------#
#
OS="$(uname)"
TRUE="1"
TEMPFILE="$(mktemp)"
FTEXT='load average:'
# get first 5 min load
F5M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f1)"
# 10 min
F10M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f2)"
# 15 min
F15M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f3)"
# Free memory
FMEM="$(grep "^MemFree" /proc/meminfo|awk '{print $2}')"
#
#----------------------------------------------------------------------#
#
# E-MAIL MESSAGE
#
echo "Load average crossed specified limit: $NOTIFY" >> $TEMPFILE
echo "Hostname: $(hostname)" >> $TEMPFILE
echo "Local Date & Time : $(date)" >> $TEMPFILE
echo "Memory usage crossed specified limit: $NOTIFY2 kb" >> $TEMPFILE
# Look if it crossed limit
# compare it with last 15 min load average and last memory average
RESULT=$(echo "$F15M >= $NOTIFY" | bc)
RESULT2=$(echo "$FMEM <= $NOTIFY2" | bc)
# if so send an email
if [ "$RESULT" == "$TRUE" ]; then
echo "-------------------------------------------" >> $TEMPFILE
echo "System snapshot from top:" >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
top -b -n1 >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
echo "System snapshot for memory:" >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
free -m >> $TEMPFILE
echo "Process list by memory usage:" >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
ps -e -orss=,args= | sort -b -k1,1n >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
echo "Disk space usage:" >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
df -h >> $TEMPFILE
mail -s "$SUBJECT" "$EMAIL" < $TEMPFILE
fi
#
#----------------------------------------------------------------------#
#
# CLEAN UP
#
rm -f $TEMPFILE
#
#--------------- COPY ABOVE HERE --------------------------------------# -
Save and exit the file (
ESC + :wq
invim
). -
Make the script executable:
chmod 755 load-alert.sh
Setting Up Automated Monitoring (Cron Job)
-
Open the cron editor:
crontab -e
-
Add a line to run the script every 5 minutes:
*/5 * * * * /root/load-alert.sh > /dev/null 2>&1
-
Save and exit the file.
Modifying the Script for Custom Alerts
-
To change the CPU threshold, modify
NOTIFY="0.00"
. -
To change the memory threshold, modify
NOTIFY2="000000"
. -
To send alerts to multiple emails, add multiple addresses separated by spaces:
mail -s "$SUBJECT" "$EMAIL" "otheruser@example.com" < $TEMPFILE
Testing the Script
To manually test if the script is working:
/root/load-alert.sh
This should generate an email if thresholds are exceeded.
Disabling or Removing the Script
To disable the script, remove the cron job:
crontab -e # Remove the line running load-alert.sh
To delete the script completely:
rm -rf /root/load-alert.sh
Which Option Should You Choose?
-
If you need real-time alerts, dashboards, and professional monitoring, we recommend 360 Monitoring.
-
If you prefer a free, basic option, the manual monitoring script can help track performance but requires technical setup.
For further assistance, contact Support via the portal or email support@support.nubius.io.