OPNsense Forum

English Forums => 25.1, 25.4 Series => Topic started by: opnsenseuser on June 18, 2025, 04:48:55 PM

Title: Monit Service won't start
Post by: opnsenseuser on June 18, 2025, 04:48:55 PM
For some time now, I've been having the problem that the Monit Service won't start. The log shows the following:

Quote/usr/local/etc/monitrc:14: syntax error 'Das'

Any ideas?

Regards rené
Title: Re: Monit Service won't start
Post by: Patrick M. Hausen on June 18, 2025, 05:30:09 PM
Show your generated config, possibly?
Title: Re: Monit Service won't start
Post by: opnsenseuser on June 18, 2025, 09:29:29 PM
What config do you mean? Monit config?
The problem is, i can´t apply the settings.
I can only do this when disable the monit service.
Title: Re: Monit Service won't start
Post by: Patrick M. Hausen on June 18, 2025, 09:50:19 PM
The config file generated by the UI seems to have a syntax error. You need to find that config file - via SSH/CLI - and investigate. I don't run monit, so I have no idea where the plugin keeps it.
Title: Re: Monit Service won't start
Post by: cookiemonster on June 18, 2025, 11:17:00 PM
please check /usr/local/etc/monitrc
Title: Re: Monit Service won't start
Post by: opnsenseuser on June 19, 2025, 06:21:46 AM
monitrc:

Quote# DO NOT EDIT THIS FILE -- OPNsense auto-generated file

set httpd unixsocket /var/run/monit.sock
    allow localhost

set daemon 120 with start delay 120

set logfile syslog facility log_daemon



set mailserver 127.0.0.1 port 25   

set alert mail@mymail.com  { connection,data,permission } mail-format { Das $SERVICE auf $HOST ist fehlgeschlagen. }






include /usr/local/etc/monit.opnsense.d/*.conf

i also reinstalled the monit package. but doesn´t fix the problem either.
Maybe there is something wrong with the core package?
Title: Re: Monit Service won't start
Post by: Patrick M. Hausen on June 19, 2025, 09:04:57 AM
Not a problem with the package - your mail-format is wrong. That's why it's complaining about "Das". Broken config file --> no startup.

See the monit documentation for what mail-format must look like:

https://mmonit.com/monit/documentation/monit.html#Message-format
Title: Re: Monit Service won't start
Post by: opnsenseuser on June 19, 2025, 09:14:37 AM
Thx. I will Look at this.
Title: Re: Monit Service won't start
Post by: Patrick M. Hausen on June 19, 2025, 09:17:09 AM
Quote from: cookiemonster on June 18, 2025, 11:17:00 PMplease check /usr/local/etc/monitrc

The path was in the error message - how could I overlook that? Thanks.
Title: Re: Monit Service won't start
Post by: opnsenseuser on June 19, 2025, 09:21:17 AM
but i can´t see any problems. i didn´t change anything in the monitrc file itself. this is all generated by opnsense via gui.
and the syntax is right.
Title: Re: Monit Service won't start
Post by: opnsenseuser on June 19, 2025, 09:25:36 AM
if i delete the word "Das" in the settings of monit the error message changes from "Das" to

Quote2025-06-19T09:23:47    Error    monit    monit exiting due to parsing errors in the configuration file.   
2025-06-19T09:23:47    Error    monit    /usr/local/etc/monitrc:14: syntax error '$SERVICE'

The text in the Mail Format field was automatically generated by Opnsense. I never changed anything here.
Title: Re: Monit Service won't start
Post by: opnsenseuser on June 19, 2025, 09:31:53 AM
i deleted the whole text and made a new text. but it doesn´t work
Title: Re: Monit Service won't start
Post by: Patrick M. Hausen on June 19, 2025, 09:35:03 AM
You cannot enter just text there. See the linked documentation. You must use the format specified:

from: Monit Support <monit@foo.bar>
reply-to: support@domain.com
subject: $SERVICE $EVENT at $DATE
message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
         Yours sincerely,
         monit

So at the very least add the "message:" keyword.
Title: Re: Monit Service won't start
Post by: opnsenseuser on June 19, 2025, 09:40:33 AM
so i changed it like it will be shown in the info text. but this doesn´t work either.
Title: Re: Monit Service won't start
Post by: opnsenseuser on June 19, 2025, 09:51:03 AM
At least the service is back up and running. Still,

I find it strange, since I never changed anything here.

Now i get failed to load widget. Deleted the widget and readded it. but still get the failed message.

strange