I help out with website suffered regular outages when it is crawled by several bots simultaneously. The website is quite large, but hosted on a small VPS, and our visiting bots
can be quite relentless in their crawling.
When this happens, we used to manually turn on Cloudflare’s Under Attack mode, to make
the bots go away, or at least slow down, while letting human users in.
We got tired of turning UA mode on manually, so I wrote a little script which does this automatically
whenever the load gets high, the free memory gets low, or whenever the DB becomes unreadable.
It is very basic, but does the job for us.
If anyone suffers similar problems feel free to use it.