I've been trying to install monit with an ansible playbook. I'm changing the monitrc file and when the playbook restarts monit, I get :
Jun 8 08:00:30 myserver monit[1857462]: Starting daemon monitor: monit
Jun 8 08:00:30 myserver monit[1857465]: /etc/monit/monitrc:10: invalid mail format '#015'
Jun 8 08:00:30 myserver monit[1857465]: /etc/monit/monitrc:11: syntax error 'subject: $HOST -- $EVENT $SERVICE#015'
Jun 8 08:00:30 myserver monit[1857466]: failed!
Jun 8 08:00:30 myserver systemd[1]: monit.service: Control process exited, code=exited, status=1/FAILURE
Jun 8 08:00:30 myserver systemd[1]: monit.service: Failed with result 'exit-code'.
Jun 8 08:00:30 myserver systemd[1]: Failed to start LSB: service and resource monitoring daemon.
The conflicting lines in monitrc :
set mail-format {
from: Monit <[email protected]>
subject: $HOST -- $EVENT $SERVICE
message: $EVENT Service $SERVICE
Date: $DATE
Action: $ACTION
Host: $HOST
}
Here are the different tests I did :
- Installing monit from playbook ( Installing from apt then copy the monitrc file to its location) : Does not work
- Installing monit manually (installing from apt then copy-pasting the configuration to monitrc) : Works
- Copy-pasting monitrc after the ansible install : Does not work
Monit version is 5.27.2 in both cases and the machine is Debian 11.