Is it possible to set up an alert (email) for when a particular services stops running?
I have alerts set up for when the MySQL or Apache goes down (set from System and Server Status), but there is a particular Service that keeps stopping every now and then and I’d like to be alerted when it does, so I can check log files at the time to see why. The service is rh-redis5-redis.service.
Hmm, if its not directly managed via webmin then I think you need to write a little script which checks the status every few minutes (via cron). There are quite some out there, which you can find easily with a quick google/whatever search.
systemctl check if the wanted service gives back an “ok”. If not, automatically restart via systemctl command.
You could easily send a mail with that too.
You can either use a monitor type of Bootup Action or Check Process. For Check Process, you need to give it the exact process name of the program (I don’t know what that is, but it’s definitely not the systemd unit file…that’s a configuration file that tells systemd how to start the process, it is not the process). Bootup action may be simpler, but it’s not always reliable…depends on how well the systemctl status command or service _name_ status command woks.
Bootup Action is what you want, if you want to specify the systemd unit file (because it uses systemd to check the status).
That monit example uses initscripts, which is no longer used on any system currently supported by Virtualmin (though it’s possible your redis configuration is using an initscript, I dunno…Webmin still has an initscript, but it’s just that we haven’t had time to update it). You’d want to use systemctl commands, most likely.