sixfive
sixfive

Reputation: 105

mmonit not using remote server IP, using localhost instead

I've got an install of mmonit with various servers reporting into it. The monitoring is working, but trying to restart any servers results in it trying to contact itself (on localhost) and not the origin server IP.

I face a similar issue on ec2 via autoscaling, where the internal IP is assigned, not the public IP. Thus we get the same error, but it shows the AWS internal ec2 IP.

mmonit trying to connect to remote server on localhost:2812 and showing connection refused

Our mmonit file is super simple, and doesn't mention localhost:

set httpd port 2812
     allow xxx.xxx.xxx.xxx
     allow monitcli:xxxxxxxxxxxxxxxx

In the monit host settings, it shows localhost, or the ec2 internal IP, and sure, I can manually override this, but that's a PITA.

mmonit host settings showing localhost as the server address

Is there a way to push the correct external IP address from monit > mmonit in the config file?

Anyone have any insights here?

Upvotes: 1

Views: 454

Answers (1)

lutzmad
lutzmad

Reputation: 374

Use a proper hostname or ipaddress in the Monit monitrc files.

set httpd port 2812 and
  use address 1.2.3.4
  allow localhost
  allow 1.2.3.0/24

The "use address" address used by Monit should be reachable by your M/Monit system. And the "allow" address mask should include the M/Monit system and the Monit system, you can add multiple address masks.

Upvotes: 1

Related Questions