fbpx

Servcheck

A quick bash script for sanity checks of a Linux web server.

Run:

curl -L https://git.io/fpcqY | bash

Description of the checks

1. Out of memory conditions

This checks whether the Linux kernel had killed a process due to reaching the OOM (Our of Memory) condition.
It typically indicates severe misconfiguration on the server.
Solutions include allocating swap space, lowering the number of worker processes for Apache or PHP-FPM, reducing MySQL buffers, etc.

To check this manually, on CentOS 7, you can run:

journalctl --no-pager --priority=err --dmesg | grep "Out of memory"

On CentOS 8, you can run:

journalctl --no-pager --priority=err --dmesg --grep="Out of memory"

Example output, indicating Redis service was killed due to OOM:

Sep 24 20:37:43 host.example.com kernel: Out of memory: Kill process 20775 (redis-server) score 817 or sacrifice child

2. Broken outgoing email

This is a performance sanity check: telnet to 25 of external mail servers works ?
Note that it is common for Amazon AWS (blocked outgoing port 25 can yield very poor WP performance when SMTP plugins are in use).

3. Missing swap allocation

Swap space is very essential to have on most servers. This check will find if your server is lacking swap space.
If it does, make sure to set up swap space.