• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx

  • We are developing a new feature in Plesk that will help you promote your websites or business on social media. We want to conduct a one-hour online UX test to present the prototype and collect feedback. If you are interested in the feature, please book a meeting via this link.
    Thank you in advance!
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Update Watchdog configuration for Spamassassin (Ubuntu 16.04)

B_P

Regular Pleskian
TITLE:
Update Watchdog configuration for Spamassassin (Ubuntu 16.04)
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:
Plesk 17.5 for Linux
Ubuntu 16.04
PROBLEM DESCRIPTION:
The watchdog configuration for Spamassassin on Ubuntu 16.04 contains an outdated file name for Spamassassin's PID file. Thus, Watchdog cannot find the PID file and assumes that Spamassassin is not running even though it is.

The file name needs to be changed from spamd.pid to spamassassin.pid.
This issue is also reported in Issue - Spamassasin not monitored.​
STEPS TO REPRODUCE:
1. Install Ubuntu 16.04 & Plesk 17.5
2. Setup Plesk to use Postfix & Spamassassin
3. Install the Watchdog Add-On & Enable it
4. Wait for some time and check the Watchdog page on Plesk panel or check the admin e-mails...​
ACTUAL RESULT:
Plesk should announce Spamassassin as not running...​
EXPECTED RESULT:
Spamassassin is reported as running.​
ANY ADDITIONAL INFORMATION:
Make sure that /opt/psa/etc/modules/watchdog/monitrc contains the correct filename.

Current config (outdated):
# SpamAssassin
check process psa_spamassassin
with pidfile "/var/run/spamd.pid"
start = "/opt/psa/admin/bin/spammng --start"
stop = "/opt/psa/admin/bin/spammng --stop"
if failed host localhost port 783 send "PING SPAMC/1.2\r\n\r\n" expect "SPAMD/[0-9]+(\.[0-9]+)* 0 PONG" with timeout 180 seconds then restart
if 1000 restarts within 1000 cycles then timeout
every 1 cycles
mode active


New config (recommended change):
# SpamAssassin
check process psa_spamassassin
with pidfile "/var/run/spamassassin.pid"
start = "/opt/psa/admin/bin/spammng --start"
stop = "/opt/psa/admin/bin/spammng --stop"
if failed host localhost port 783 send "PING SPAMC/1.2\r\n\r\n" expect "SPAMD/[0-9]+(\.[0-9]+)* 0 PONG" with timeout 180 seconds then restart
if 1000 restarts within 1000 cycles then timeout
every 1 cycles
mode active
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
Confirm bug
 
I have checked this issue on Plesk Onyx 17.8.8 and found:

# SpamAssassin
check process psa_spamassassin
with pidfile "/var/run/spamassassin.pid"
start = "/opt/psa/admin/bin/spammng --start"
stop = "/opt/psa/admin/bin/spammng --stop"
if failed host localhost port 783 send "PING SPAMC/1.2\r\n\r\n" expect "SPAMD/[0-9]+(\.[0-9]+)* 0 PONG" with timeout 180 seconds then restart
if 5 restarts within 5 cycles then timeout
every 1 cycles
mode active

So, I suppose it is fixed there.
 
Hi,

I can confirm that. But the change in "/opt/psa/etc/modules/watchdog/monitrc" only doesn't do the trick when the Watchdog service for spamassassin is reenabled, because the file "/opt/psa/etc/modules/watchdog/monitrc" is generated again with the old line "with pidfile "/var/run/spamd.pid"".

The line "with pidfile "/var/run/spamd.pid"" has to be changed to with pidfile "/var/run/spamassassin.pid" in the following folies:

/opt/psa/etc/modules/watchdog/monitrc
/opt/psa/etc/modules/watchdog/monitrc_vz.tpl
/opt/psa/etc/modules/watchdog/monitrc.tpl

Then it works as expected.

Best wishes,

Josch
 
One could also create a link from /run/spamassassin.pid to /run/spamd.pid but it would be required to be recreated at every boot.
I found that there was a mismatch on Ubuntu with spamassassin's pidfile between /etc/default/spamassasssin and the systemd service in /lib/systemd/system/spamassassin.service.
May be that is the reason for plesk using the wron pid file.
 
I have checked this issue on Plesk Onyx 17.8.8 and found:

# SpamAssassin
check process psa_spamassassin
with pidfile "/var/run/spamassassin.pid"
start = "/opt/psa/admin/bin/spammng --start"
stop = "/opt/psa/admin/bin/spammng --stop"
if failed host localhost port 783 send "PING SPAMC/1.2\r\n\r\n" expect "SPAMD/[0-9]+(\.[0-9]+)* 0 PONG" with timeout 180 seconds then restart
if 5 restarts within 5 cycles then timeout
every 1 cycles
mode active

So, I suppose it is fixed there.

@IgorG,

The bug persists.

In the setup

Product version: Plesk Onyx 17.8.11 Update #14
Update date: 2018/07/21 04:37
Build date: 2018/07/03 05:11
OS version: Ubuntu 16.04
Revision: c6ad07c3f39fbcd61cf36968c6a1fe0bded17d3c
Architecture: 64-bit
Wrapper version: 1.2

the monitrc contains:

with pidfile "/var/run/spamd.pid"

on line 73.

A quick patch would be appreciated!

Kind regards.........

PS In addition, it is recommended that Rootkit Hunter is upgraded (to version 1.4.6) AND that the rkhunter.conf is adjusted (the latter to suppress a whole lot of very unnecessary warnings).
 
My workaround to the problem is a symlink via cron entry like this
crontab -e
@Reboot ln -s /run/spamassassin.pid /run/spamd.pid

That is not a good idea, for many reasons.

Note that creating a symlink would be problematic, since you are pointing to a file that may or may not exist: the whole concept of a symlink to spamd.pid is strange, since this will return unexpected results if spamassassin service is down (read: unexpected results at downtime AND at restart of the spamassassin service) and these unexpected results are even very likely to occur at reboot time (read: if spamassassin service has not been started yet, your symlink creation at reboot time might not be working).

Also note that (in principle) you do not have to recreate a symlink at reboot, since it should be persistent across reboots (read: unless the symlink is deleted somehow and/or the mount point has been deleted or not mounted properly at reboot time).

In short, it is recommended to simply adjust monitrc until the next release of Watchdog.

This recommendation is also update-safe, in the sense that one does not get stuck with the remainder of a dirty work-around: when an update of Watchdog is released, the update can be installed properly, without Watchdog being affected by some left-over symlink that does not have a function anymore or that can even cause issues.

Hope the above helps and explains a bit.

Regards!
 
As I said this is a workaround and it will survive updates of watchdog releases which still may contain the bug.
Also I I doubt that you exactly looked at the issue.
/run is a volatile file system thus it is rebuilt at boot time and so you need to recreate the symlink at every boot.
Also a dangling link is nothing strange and is perfectly allowed.
It may give unexpected results, but in most cases it doesn't and I have made several reboots since I established the workaround without any strange error messages.
If you do a symlinks -r / on any linux system you are likely to find many dangling links which do not harm the system in any way.
You are right though that it is likely to forget about the workaround after the bug has been resolved.
Thus I would set a reminder or only recommend the workaround to someone who knows what he is doing.
 
@PeterKi

I like a bit of discussion, no personal offense taken, not at all.

EDIT - you are right, your (quick) work-around works like a charm (with the exception of some very rare cases, that only occur in very specific scenarios)

However, that is the interesting part of this "discussion".

It seems to be the case that there is some potential issue with Plesk version 17.8.11, a potential bug.

Can you provide me more information about your test setup, OS environment etc?

Regards........
 
Last edited:
@PeterKi

There is more wrong with the default package of Watchdog, I will create another bug report.

It is helpful if you would provide some information about your environment, since that will narrow down the (potential mutiple) problems with the current Watchdog version.

Kind regards...........
 
For everyone else, still encountering this issue in Plesk 17.8.11, I temporarily fixed it with the help of Joschs answer:
Josch said:
But the change in "/opt/psa/etc/modules/watchdog/monitrc" only doesn't do the trick when the Watchdog service for spamassassin is reenabled, because the file "/opt/psa/etc/modules/watchdog/monitrc" is generated again with the old line "with pidfile "/var/run/spamd.pid"".

The line "with pidfile "/var/run/spamd.pid"" has to be changed to with pidfile "/var/run/spamassassin.pid" in the following folies:

/opt/psa/etc/modules/watchdog/monitrc
/opt/psa/etc/modules/watchdog/monitrc_vz.tpl
/opt/psa/etc/modules/watchdog/monitrc.tpl

And you need to disable and enable Watchdog after your change! Then it works.
 
Back
Top