• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Is there a way to monitor additional services with psa-watchdog?

Maarten.

Golden Pleskian
Plesk Guru
Server operating system version
AlmaLinux 8.6 (Sky Tiger)
Plesk version and microupdate number
Plesk Obsidian Version 18.0.46
Hi,

Is there a way to monitor amavisd or any additional service and restart it when it goes down?
I tried to add an amavisd config file to /usr/local/psa/etc/modules/watchdog/service.d/, but it gets deleted after a while.

Next, I tried to install monit (I know psa-watchdog is based on monit), but that seems to clash with the monit.service:

Error: Transaction test error:
file /usr/lib/systemd/system/monit.service from install of monit-5.30.0-1.el8.x86_64 conflicts with file from package psa-watchdog-18.0-2.redhat.8+p18.0.46.0+t220811.0319.x86_64

It would help if Plesk renamed /usr/lib/systemd/system/monit.service to /usr/lib/systemd/system/psa-watchdog.service
 
I fixed this by manually adding a new service to the PSA database:

Note: I've tested this on an Almalinux 8.6 server.

Make sure you have a backup of the PSA database before you continue:
Code:
# plesk db dump psa > /root/psa_dump.sql

Add the new service to the module_watchdog_service table:
SQL:
INSERT INTO `module_watchdog_service` (name, label, sort_val, connection_timeout, start_cmd, stop_cmd) VALUES
('amavis', 'Amavis email filter', 51, 5, '/bin/systemctl start amavisd.service', '/bin/systemctl stop amavisd.service');

Watchdog needs to know there is a new service available.
These services are defined in /usr/local/psa/etc/modules/watchdog/monitrc.tpl, so let's make a copy before we change it:
Code:
# cp /usr/local/psa/etc/modules/watchdog/monitrc.tpl /usr/local/psa/etc/modules/watchdog/monitrc.tpl.bak

Add the following code to the end of the file /usr/local/psa/etc/modules/watchdog/monitrc.tpl
Code:
# Amavis
check process amavis
    with pidfile "/var/run/amavisd/amavisd.pid"
    start = "<amavis_start>"
    stop = "<amavis_stop>"
    if <amavis_timeout_restarts> restarts within <amavis_timeout_cycles> cycles then timeout
    every <amavis_cycles> cycles
    mode <amavis_mode>

Open the Watchdog extension and stop and start the watchdog service. You should see the new amavis service.
Click on the amavis link and enable the amavis check.

To test if it works, stop the amavis daemon and check the log file until the watchdog starts amavis again.

Code:
# systemctl stop amavisd.service
# tail -f /var/log/plesk/modules/monit.log

Note: I'm unsure if this change will survive a Plesk or a watchdog extension update. Let's wait and see what happens.
 
Back
Top