I have a private DigitalOcean server that I use for my own website and some small clients that don't get many visitors to their sites. Each site is a small WordPress installation installed using Ubuntu and Nginx .
Lately, the memory and CPU has been spiking at random intervals or when I visit the WordPress dashboards of certain sites and is causing all of the sites to go down, making me need to SSH into the servers to restart mysql to get all of the sites back up again. This has been happening more often as well.

**My question is how best to analyze the server and see what the problem is and because is falling and after restarting mysql it does everything perfectly again?**

Probably something overloaded the server and it crashes, is there any documentation on how to analyze this.
Thanks in advance