1

Подскажите пожалуйста правильный конфиг для monit

set daemon  60              
set logfile syslog facility log_daemon
set mailserver localhost 
set mail-format {
      from: monit@$HOST
   subject: monit alert --  $EVENT $SERVICE
   message: $EVENT Service $SERVICE
                 Date:        $DATE
                 Action:      $ACTION
                 Host:        $HOST
                 Description: $DESCRIPTION

              Your faithful employee,
              Monit
}

set mail-format { from: monit@localhost}
set alert root@localhost                       # receive all alerts
set httpd port 2812 and
    use address 192.168.1.250  # only accept connection from localhost   
    allow admin:admin      # require user 'admin' with password 'monit'
    allow @monit           # allow users of group 'monit' to connect (rw)
    allow @users readonly  # allow users of group 'users' to connect readonly

check process apache with pidfile /usr/local/apache/logs/httpd.pid
    start program = "/usr/bin/systemctl start httpd.service" with timeout 60 seconds
    stop program  = "/usr/bin/systemctl stop httpd.service"

    if failed host server.my port 80 protocol http
    and request "/monit/apache.php"
    then restart
    if 3 restarts within 5 cycles then timeout#
include /etc/monit.d/*
[MSK Jan 20 19:01:25] info     : 'apache' trying to restart
[MSK Jan 20 19:01:25] info     : 'apache' start: /usr/bin/systemctl
[MSK Jan 20 19:02:26] error    : 'apache' failed to start
[MSK Jan 20 19:03:26] error    : 'apache' process is not running
[MSK Jan 20 19:03:26] info     : 'apache' trying to restart
[MSK Jan 20 19:03:26] info     : 'apache' start: /usr/bin/systemctl

2 (21.01.2015 08:17:51 отредактировано Eof)

решено

3

Если решил - пиши и решение, вдруг кому пригодится.

4

Правильный путь /var/run/httpd/httpd.pid
Старт и стоп systemctl start httpd.service и systemctl stop httpd.service соответственно