stefanust
By:
stefanust

I can not use monit in aws amazon instance

October 14, 2014 2.6k views

Hi There

I tried to use monit in my aws server.

I have followed below step,
but I can not view http://xxx.xxx.xxx.xxx:2812/

ERR_CONNECTION_REFUSED

Did I miss something?

sudo yum install monit


$ sudo cp /etc/monit.conf /etc/monit.conf.default   
$ sudo vim /etc/monit.conf
  # 監視間隔
  set daemon 60

  # primary, secondly
  set mailserver example.com, second.exsample.com

  set mail-format {
    From: monit@exsample.com
    # あとはデフォルトでもいい気がする
  }   

  set alert hoge@exsample.com

  include /etc/monit.d/*

$ sudo vim /etc/minit.d/sshd.monit

  check process sshd with pidfile /var/run/sshd.pid
  every 2 cycle
  group system
  start programe = "/etc/init.d/sshd start"
  stop programe = "/etc/init.d/sshd stop"
  if 5 restarts within 5 cycles then unmonitor

$ sudo vim /etc/monit.d/nginx.monit

  check process nginx with pidfile /var/run/nginx.pid
    start program = "/etc/init.d/nginx start"
    stop program = "/etc/init.d/nginx stop"
1 comment
  • a bit late but ... make sure on the security group on your ec2 instance make sure tcp port 2812 is open for all or only for the remote ip address from where u r trying http://xxx.xxx.xxx.xxx:2812/
    and have monit listen to 2812 for all ip
    and if xxx.xxx.xxx.xxx is on a network where there is firewall make sure tcp port 2812 for outgoing traffice is allow/pass

1 Answer

This question was answered by @kamthang:

a bit late but ... make sure on the security group on your ec2 instance make sure tcp port 2812 is open for all or only for the remote ip address from where u r trying http://xxx.xxx.xxx.xxx:2812/
and have monit listen to 2812 for all ip
and if xxx.xxx.xxx.xxx is on a network where there is firewall make sure tcp port 2812 for outgoing traffice is allow/pass

View the original comment

Have another answer? Share your knowledge.