Rspamd monitoring with Monit
Rspamd should be monitored by Monit and restarted automatically if the service stops running.
If Rspamd comes without a PID file, a suitable configuration for Monit would be like this:
Create config file
vi /etc/monit/conf-avaliable/rspamd
check process rspamd
matching 'rspamd: main process'
start program = "/sbin/service rspamd start"
stop program = "/sbin/service rspamd stop"
if cpu is greater than 40% for 2 cycles then alert
if cpu > 60% for 5 cycles then alert
if memory > 80% for 4 cycles then alert
if totalmem > 512 MB for 5 cycles then alert
Enable monitoring for Rspamd
ln -s /etc/monit/conf-available/rspamd /etc/conf-enabled/rspamd
Restart Monit
service monit restart
Monit summary
monit summary
Monit 5.26.0 uptime: 0m
┌─────────────────────────────────┬────────────────────────────┬───────────────┐
│ Service Name │ Status │ Type │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ rspamd │ OK │ Process │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
Monit status
monit status
Process 'rspamd'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
pid 1809392
parent pid 1
uid 121
effective uid 121
gid 129
uptime 26m
threads 1
children 4
cpu 0.0%
cpu total 0.0%
memory 2.0% [75.1 MB]
memory total 10.4% [400.8 MB]
security attribute unconfined
disk read 0 B/s [42.7 MB total]
disk write 0 B/s [34 MB total]