This is an how-to to implement basic monitoring and server restart with email notification using WebMin
A server instance can be named (e.g. using a ps -ef command) with an explicit name instead of a generic java with parameters.
The launch script is modified as follows:
(
echo "launching vEhr...."
exec -a ${INSTANCE_NAME} ${JVM} -Xmx256M ...
Variable INSTANCE_NAME can be defined in the script or in env.rc or as a shell variable.
For example, if INSTANCE_NAME is 'ethercis-server-1', the process will be identified as:
[ethercis@EtherCIS1 ~]$ ps -ef | grep ethercis-test
ethercis 8327 1 11 04:08 ? 00:00:09 ethercis-test-1 -Xmx256M ....
We can now use this name to reference the running process in a monitoring framework.
To achieve this goal we are using Webmin.
Webmin comes with a useful module 'System and Server Status' that can be used to perform monitoring with automated actions and notifications.
The monitoring is done as a scheduled monitoring which is configured as follows:
In Email status report to indicate the recipient(s) for the alarm notification
In SMTP server indicate a valid SMTP server used to relay the mail to its recipient(s)
In the above example, the monitoring is done every minutes.
The specific configuration for ethercis is as follows (assuming the process is launched with the name defined above):
If the process is down, it is automatically restarted with the command ~ethercis/ecis-server start and an email is sent to the specified recipient.
The configuration can be done in the Webmin Configuration->Sending Email
For example, using gmail as an SMTP server:
An other possibility involves using Linux monit, the same principles apply.



