How to automatically monitor and power cycle a droplet when it's down?

October 18, 2015 1.3k views
PHP Monitoring API Load Balancing System Tools Ubuntu

Hi everyone,

I've been running into issues where my website becomes non-responsive or very slow to load. Currently I'm using an external uptime monitor to notify me when this happens and I manually go into the DO control panel to do a Power Cycle, which fixes the problem. I'm not sure WHY this keeps happening but this fix seems to be working fine. The script I'm running does not have any MySQL connections, it is purely based on PHP.

Looking over the graphs in the DO control panel I notice no significant changes in CPU, bandwidth or disk spikes. The most I've ever been at was around 45% CPU for a short period of time. I don't know what's causing it and the graphs seem to offer me no clues, since even those spikes don't correlate well to the downtime.

The only solution I can think of is to run a cheap $5 droplet which would run a cron say every 30 seconds, to check for downtime, and then execute some PHP code to powercycle the droplet automatically. Problem is I have no idea how to do this! Could anyone provide some guidance?

1 Answer
Have another answer? Share your knowledge.