Users of WHM/cPanel can utilize the chkservd monitoring service to detect if Elasticsearch is not running and to restart it automatically. Here's my method: I use AlmaLinux 8 with Elasticsearch v8.16, which should be similar for Rocky Linux as well.
After installing or upgrading Elasticsearch, ensure that it is set to run as a service. This guarantees that Elasticsearch will automatically start whenever you reboot your server manually.
sudo systemctl enable elasticsearch.service
Edit the /etc/chkserv.d/chkservd.conf file. Add...
elasticsearch:1
Create a file called elasticsearch in the /etc/chkserv.d directory.
sudo touch /etc/chkserv.d/elasticsearch
Add the following:
service[elasticsearch]=9200,curl -XGET,HTTP/1.0 400 Ba,systemctl start elasticsearch
Restart chkserv
sudo /scripts/restartsrv_chkservd
Enable elasticsearch monitoring in the WHM service manager (check both boxes)

Done!
I manually stopped the service to test it.

The service resumes instantly when chkserv detects it down, but the notification email confirming the service is back up is typically received about 5 minutes later.

After installing or upgrading Elasticsearch, ensure that it is set to run as a service. This guarantees that Elasticsearch will automatically start whenever you reboot your server manually.
sudo systemctl enable elasticsearch.service
Edit the /etc/chkserv.d/chkservd.conf file. Add...
elasticsearch:1
Create a file called elasticsearch in the /etc/chkserv.d directory.
sudo touch /etc/chkserv.d/elasticsearch
Add the following:
service[elasticsearch]=9200,curl -XGET,HTTP/1.0 400 Ba,systemctl start elasticsearch
Restart chkserv
sudo /scripts/restartsrv_chkservd
Enable elasticsearch monitoring in the WHM service manager (check both boxes)

Done!
I manually stopped the service to test it.

The service resumes instantly when chkserv detects it down, but the notification email confirming the service is back up is typically received about 5 minutes later.

Last edited: