Monitoring server resources such as RAM, CPU, disk, and network. This is done to find out how much use of these resources. Based on the resource usage data that we get from the monitoring results, we can easily make decisions to increase or decrease server capacity, especially VPS.
DigitalOcean VPS users can monitor Bandwidth, CPU and Disk I/O usage via the Droplet Name->Graphs page.
These graphs can still be added with Load, Memory, and Disk Usage monitoring by installing the Metric agent.
Download the do-agent installer.
curl -sSL https://repos.insights.digitalocean.com/install.sh -o /tmp/install.sh
Run the installer.
sudo bash /tmp/install.sh
Check the do-agent installation results.
Check the Graphs page again.
Alert Policies is a feature at DigitalOcean that can send notifications to email and Slack when resource usage in a droplet reaches its limit and occurs in an interval of at least 5 minutes to 1 hour.
For example, we want DigitalOcean to send a notification when CPU usage has reached the limit above 80% for 5 minutes.
Open Alert Policies, click the menu Create->Alert Policies.
At Select metric & set threshold, select CPU, is above, 80%, 5 min.
At Select Droplets or Tags, enter a droplet or tag.
At Send alerts via, check the email, and click Connect Slack if you want to send a notification to Slack.
Finally, at Name and create alert policy, enter a name for the alert policy, and click Create alert policy.
Alert Policy Testing
To test the alert policy, whether it successfully sends a notification to the email or not, we have to force the CPU to work up to above 80% for 5 minutes. We can use Stress, a tool for stress testing systems, running large workloads.
Install stress on Debian or Ubuntu.
sudo apt install stress
Install stress on CentOS.
sudo yum install stress
Run stress for CPUs with 1 core.
stress --cpu 1
Stress will make the CPU work up to 100%. See CPU usage in Graphs.
The notification will be sent after 5 minutes.
To stop Stress, press CTRL + C.
Another notification is sent when the CPU usage is below 80%.
If you enjoy what I do, please support me on Ko-fi! https://ko-fi.com/musaamin