Postinger.com runs on a micro EC2 instance from amazon. Occasionally the database uses too much CPU, memory or iops and crashes. I’m sure I should be running on a instance with more resources. I’ve adjusted swap, memory usage and threads apache uses but still occasionally the database crashes.
“Error establishing a database connection”
I have a PRTG instance running at home monitoring my internal network. I know PRTG has the ability to check for a word from an external webpage. So here is the solution.
Add an HTTP Advanced Web Sensor, checking for a word that will appear on your wordpress page(the word “WordPress” is a good choice for this)
Install the puTTY msi on your prtg server(or copy puTTY and plink.exe to it.
In your Path to your PRTG install’s notification\exe directory (E:\PRTG Network Monitor\Notifications\EXE) Add a batch file with the following line:
echo yes | plink -ssh [email protected] -i e:\path\to\key.ppk sudo shutdown -r now #echo yes, answers the prompt to trust the signature, the key is generated via PuTTYgen
Add a notification to execute a program, select the batch file you saved in the above referenced path.
Add a state trigger referencing your notification and set the appropriate timing.
That should do it. My batch file restarts the whole instance which for me is fine, but you may want to tweak the batch file only to restart the database or whatever else you see fit.