1

Everytime I do

# monit reload
M/Monit enabled but no httpd allowed -- please add 'set httpd' statement
Reinitializing monit daemon

I get the error about I don't have set httpd. This is my /etc/monitrc.

set daemon 60 with start delay 20

set logfile /var/log/monit.log
set pidfile /var/run/monit.pid
set idfile /root/.monit.id
set statefile /tmp/.monit.state

set eventqueue basedir /var/monit slots 100

set mmonit https://xxx:xxx@monit.example.com/collector

include /etc/monit.d/*

Question

I am not interesting in having the httpd on the clients, which monit complains about. Is it possible to get rid of the error message?

Jasmine Lognnes
  • 2,490
  • 8
  • 31
  • 51
  • 1
    If you enable http support, the error message will disappear. HTTP interface is used by CLI commands, so you are getting this error. If you are concerned about remote HTTP access, you can bind HTTP to localhost – Khaled Feb 13 '18 at 15:02

2 Answers2

1

You can't explicitly disable the httpd (other than not setting it in your config), because the monit cli depends on it:

Note that if HTTP support is disabled, the Monit CLI interface will have reduced functionality, as most CLI commands (such as "monit status") needs to communicate with the Monit background process via the HTTP interface. We strongly recommend having HTTP support enabled. If security is a concern, bind the HTTP interface to local host only or use Unix Socket so Monit is not accessible from the outside.

Per default it only binds to 127.0.0.1:2812. You can set it to UNIX socket mode, so it has very little impact on your system.

Lenniey
  • 5,090
  • 2
  • 17
  • 28
  • Does this mean I need to first install httpd? My ubuntu seems to not have httpd. Can I still use its http support? – doraemon Jan 14 '22 at 01:37
1

It's a warning, not an error, and it's hard-coded in the source code.

            } else {
                    LogWarning("M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n");
            }

So you'll either need to filter where those warnings go to hide that warning, or to compile a custom version with that line commented out if you're dead set on not running the http and not simply ignoring the warning.

thrig
  • 1,626
  • 9
  • 9