All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Method of monitoring one's CPU load?
Being on a particular provider's VPS so far, I decided to buy another LEB and migrate my sites to it temporarily, for the benefit of having a SolusVM panel. So after painstakingly migrating all my backups, reinstalling my control panel, and setting up virtual domains, I let everything run as usual overnight.
Early morning on trying to open my sites, I found that none of them would open. Having some DNS woes due to personal nameservers, initially I didnt give it much thought. But when I thought of opening a ticket with my provider, to my surprise I found one from my provider, addressed to me (for a change). Apparently my VPS had been suspended for a high CPU load. I was nonplussed for a while because I had never received such a warning from MyRSK and UGVPS my previous hosts.
On contacting the provider, they were decent enough to provide me a screenshot of a graph which showed that CPU spikes on the VPS were occuring at a regular frequency of 4 hours. Because I had a cron job scheduled for every 4 hours, I could immediately address the issue and disable a job which regularly checked for and downloaded Wordpress plugin updates from wordpress.org, via a perl script. Thitherto, I'd never thought of checking scripts for CPU load.
So, coming to the topic proper, what are the methods of monitoring for CPU load on one's container in an OpenVZ and KVM system? What methods due you use to keep track, and possibly notify yourself when your container uses excess CPU load? The methods I know of include uptime
, and the SolusVM graphs. But when many providers do not have SolusVM, is there an alternate systematic approach to monitoring CPU load?
Comments
How big were the spikes?
The provider shouldn't give you access to CPU cores you're not supposed to use.
Pretty big.
http://s9.postimg.org/478nfsfmn/load_average.png
You should install webmin and configure an alert on the status tool they have. Then enable the schedule every 2 minutes to check for load, free memory, disk space etc. email alerts to yourself and your cell. also lock down the webmin port to your home IP (iptables) and enable force webmin SSL
http://doxfer.webmin.com/Webmin/SystemAndServerStatus
That sounds like a good option. But my control panel is an open source panel named i-mscp. I'm rather comfortable with it, and would prefer to use it if possible. Does anyone know how to implement something similiar to how webmin does it?
No, @Jack, it's a Servermania LEB.
@joelgm You can still use their status plugin it basically just enables a cron job and give you a nice interface. Doesnt require you to use any other aspect or tie up resources. I think it's a cleaner approach than bash scripts to maintain and debug
Good. I'll give it a go. Hope it doesnt increase my RAM usage too much. It's already almost at the 1GB limit.
@joelgm Another free tip. You can run service webmin stop when your done setting up your status monitoring to free up a few Mb of ram. Simply start it back up when you need to login to webmin.
@joelgm seems nice that software... how do you feel using it?
It's awesome. I wouldnt think of switching from this to cpanel.
@joelgm Never used this Panel before but impressed with the screenshots and demo... NGINX working with this one?
Yes it is, though since it was added recently to the latest RC, I believe there might be some extra configuration required. I have lazily continued using apache.
I just discovered why there was a surge in CPU load. In my crontab,
Instead of:
0 */4 * * * /root/wordpress_plugin_updater/updater_vps.pl
I had this:
* */4 * * * /root/wordpress_plugin_updater/updater_vps.pl
:P No wonder it pulled down the node!
You could just set up a cron job with commands like, free -m, df -h, mpstat (You would need to install the sysstat package), which all output to a file, or just e-mail them straight to you.
Install Newrelic and set custom alerts. It takes 2 minutes to setup and install.
What I'm trying to monitor is not a web app, but a perl script.
Yea, I'm thinking of writing something similiar to that. Maybe have it output to a file, which is periodically monitored by my script, which terminates when load goes high.
Anyway, it seemed that a one character typo in the crontab causes a massive spawning of my script, one every ,minute, for an hour. One instance itself takes around 5 minutes to complete, so I can imagine how it led to a massive increase in CPU load. Anyway, it's all been fixed now. The suspension was lifted, a test run over 12 hours has not revealed any CPU load. The average is below 0.02.
as @ncrlsn said use new relic/scalextreme - don't think it matters what the process is
Simple and easy.
Add a cron to run this every 10 minutes. It will send you an alert if the load touches the threshold.
https://www.dropbox.com/s/8wvdyw25nfnudmv/load.sh
That's pretty cool. I modified it a bit.
http://pastebin.com/vifmECLN
Thank you.
Anytime.
Newrelic doesn't just monitor apps, it also monitors servers.
Is the cpu load shown in
uptime
specific to the VPS, or is it the load of the node?@bcrlsn Thanks!
@joelgm vps load
Isn't it 1/5/15 rather than 5/10/15 like your scripts show?