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.
Graphs droplet DigitalOcean
These graphs can still be added with Load, Memory, and Disk Usage monitoring by installing the Metric agent.
Download the do-agent installer.[INPUT]
1 curl -sSL https://repos.insights.digitalocean.com/install.sh -o /tmp/install.sh
Run the installer.[INPUT]
1 sudo bash /tmp/install.sh
Check the do-agent installation results.[INPUT]
1 /opt/digitalocean/bin/do-agent –version
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.
Create alert policy
Finally, at *Name and create alert policy*, enter a name for the alert policy, and click Create alert policy.
Name of 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.[INPUT]
1 sudo apt install stress
Install stress on CentOS.[INPUT]
1 sudo yum install stress
Run stress for CPUs with 1 core.[INPUT]
1 stress –cpu 1
Stress will make the CPU work up to 100%. See CPU usage in Graphs.
Graphs – CPU Usage
The notification will be sent after 5 minutes.
Email notification – monitoring triggered
To stop Stress, press CTRL + C.
Another notification is sent when the CPU usage is below 80%.
Email notification – monitoring resolved
/Get a $ 100 free credit for every new account creation at DigitalOcean, *register via this link*/.
Good luck ð