Hello, pelase check the Monit log. he most likely root cause is, that Monit was started before the network interface was enabled, so the specific bind to "10.4.4.4" failed, as the interface was not available yet.
I'd suggest to remove the following option: "use address 10.4.4.4" (monit will listen on any interface, so when 10.4.4.4 is enabled after monit is started, it'll work). Additional notes for the configuration: 1.) the "telnet 10.4.4.4 2812" test will fail if you're testing it from the 10.4.4.4 machine locally (source and destination IP will be 10.4.4.4 in such case), as there is not "allow 10.4.4.4" 2.) because the "use address 10.4.4.4" is used, the "allow localhost" has no effect If you'll remove the "use address 10.4.4.4" as suggested above, the "allow localhost" will have effect (as "monit status" will be able to connect via localhost), also the listening problem should be fixed. For the "telnet 10.4.4.4 2812" to work from the same machine you'll need to add "allow 10.4.4.4" to the config (but technically it's not necessary, as the connection from 10.4.4.4 to 10.4.4.4 won't be necessary if the specific bind is dropped). Regards, Martin On Aug 15, 2013, at 9:17 PM, Ted Fines <[email protected]> wrote: > Problem: When Monit starts at boot on some systems, the monit process is > started, but is not listening on port 2812. > > I have 8 systems, all running Scientific Linux 6.4 (a free version of RHEL, > like CentOS). > > I had installed Monit 5.5.1 on each and had registered each with M/Monit. > Monit is started using upstart, using the included sample init script, which > works great. > > I recently rebooted them. Monit started up on all of them, but on about > one-half of the systems Monit is not listening on http port 2812, as defined > in /etc/monitrc. As a result when I try to view the system from M/Monit, I > only get “Cannot connect to Monit – Connection refused.” > > Below, you can see from my commands and the output that Monit is running but > not listening on the port: > # status monit > monit start/running, process 1211 > # ps -efwww | grep monit > root 1211 1 0 Aug14 ? 00:00:18 /usr/local/bin/monit -c > /etc/monitrc > # telnet 10.4.4.4 2812 > Trying 10.4.4.4... > telnet: connect to address 10.4.4.4: Connection refused > # lsof -i -P | grep monit > # > > Here’s /etc/monitrc: > # grep -v "^#" /etc/monitrc > set daemon 60 # check services at 1-minute intervals > set eventqueue basedir /var/monit slots 1000 > set mmonit https://admin:********@10.4.4.1:8443/collector > set httpd port 2812 and > use address 10.4.4.4 # Listen on main interface > allow localhost # allow localhost to connect to the server and > allow 10.4.4.1 # allow M/Monit to connect to the server and > allow admin:******** # require user 'admin' with password 'monit' > > Now see how if I just stop & start monit again, it is listening on the port. > It is then also immediately available from M/Monit. > # stop monit && start monit && lsof -i -P | grep monit > monit stop/waiting > monit start/running, process 4217 > monit 4217 root 5u IPv4 315056 0t0 TCP 10.4.4.4:2812 > (LISTEN) > # > > This is problematic, having the monitoring agent think it is running > correctly when it is not. Anyone else run into this? What did you do? > > Thanks, > Ted > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
