Trigger an action via CSF when server load is high on VPS or Server

ConfigServer Firewall works well by default. But if you customize it some, it can be even more poweful of a tool. When your load is high, you usually receive an alert from CSF. However, those reports contain a limited amount of information. If your receive these high server alerts often and want more information about what is actually going on when high load averages occur, then do the following. You can have lfd send you custom reports by using the PT_LOAD_ACTION option within the CSF configuration.First, login to shell.

Finally, edit /etc/csf/csf.conf and goto the section labeled “PT_LOAD_ACTION”. Add “/etc/csf/load.sh” so that it now looks like this:

PT_LOAD_ACTION = “/etc/csf/load.sh”

Restart csf:
csf -r

That’s it! Now when you receive a high CPU load alert, you will also receive an email with a lot more information in it. If you want CSF to automatically restart apache too, you can add the following line to the end of the load.sh file: