Автоматический рестарт MySQL и Apache
Re: Автоматический рестарт MySQL и Apache
C'est la vie, камрад :)Mr.Erbutw wrote:«Огород не огород» точнее нужно было формулировать вопрос автору ... а вышло совсем подругому.
Re: Автоматический рестарт MySQL и Apache
Огромное спасибо !!!skurudo wrote:В принципе да, но я уже просто удаляю все лишнее и ставлю свое. Давайте я покажу, так будет визуально поменятнее:Kirill wrote: Подскажите в конфиге monit просто нужное раскомментировать. Допустим для для Apache и MySQL:
/etc/monit.confShowhost 192.168.0.1 - может быть ваш адрес или сайтCode: Select all
set daemon 60 set logfile /var/log/monit.log set logfile syslog facility log_daemon set mailserver localhost set alert [email protected] with mail-format { from: [email protected] subject: OVH8 - $SERVICE $EVENT at $DATE message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION. ZA RABOTU! } set httpd port 10001 and #SSL ENABLE #PEMFILE /var/certs/monit.pem allow sku:password4monit check filesystem hdd with path / if space usage > 70% then alert if inode usage > 80% then alert check system domain.com if loadavg (1min) > 7 then alert if loadavg (5min) > 5 then alert if memory usage > 85% then alert if cpu usage (user) > 90% then alert if cpu usage (system) > 90% then alert if cpu usage (wait) > 80% then alert check process proftpd with pidfile /var/run/proftpd.pid start program = "/etc/init.d/proftpd start" stop program = "/etc/init.d/proftpd stop" if failed port 21 protocol ftp for 32 cycles then alert #if failed port 21 protocol ftp for 64 cycles then restart if 15 restarts within 15 cycles then timeout check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/sshd start" stop program "/etc/init.d/sshd stop" if failed port 22 protocol ssh for 7 cycles then alert if failed port 22 protocol ssh for 15 cycles then restart if 15 restarts within 15 cycles then timeout check process mysql with pidfile /var/run/mysqld/mysqld.pid start program = "/etc/init.d/mysqld start" stop program = "/etc/init.d/mysqld stop" if failed host 127.0.0.1 port 3306 for 5 cycles then alert if cpu usage > 30% for 10 cycles then alert if cpu usage > 50% for 10 cycles then alert if 15 restarts within 15 cycles then timeout check process httpd with pidfile /var/run/httpd.pid start program = "/etc/init.d/httpd start" stop program = "/etc/init.d/httpd stop" if failed host 192.168.0.1 port 80 for 5 cycles then alert if 15 restarts within 15 cycles then timeout
Можно делать и отдельными модулями там, но я предпочитаю в одном файле, особенно когда проверок не так много. Вариант, о котором вы говорите, это когда много сервисов проверяется, чтобы все в одном конфиге не городить.Kirill wrote:Файл /etc/monit.d/httpd необходимо тоже создать для записи директив для перезагрузки? Или не надо его создавать.
-
- Posts: 10
- Joined: Tue Jul 15, 2014 1:34 pm
Re: Автоматический рестарт MySQL и Apache
skurudo wrote:В принципе да, но я уже просто удаляю все лишнее и ставлю свое. Давайте я покажу, так будет визуально поменятнее:Kirill wrote: Подскажите в конфиге monit просто нужное раскомментировать. Допустим для для Apache и MySQL:
/etc/monit.confShowhost 192.168.0.1 - может быть ваш адрес или сайтCode: Select all
set daemon 60 set logfile /var/log/monit.log set logfile syslog facility log_daemon set mailserver localhost set alert [email protected] with mail-format { from: [email protected] subject: OVH8 - $SERVICE $EVENT at $DATE message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION. ZA RABOTU! } set httpd port 10001 and #SSL ENABLE #PEMFILE /var/certs/monit.pem allow sku:password4monit check filesystem hdd with path / if space usage > 70% then alert if inode usage > 80% then alert check system domain.com if loadavg (1min) > 7 then alert if loadavg (5min) > 5 then alert if memory usage > 85% then alert if cpu usage (user) > 90% then alert if cpu usage (system) > 90% then alert if cpu usage (wait) > 80% then alert check process proftpd with pidfile /var/run/proftpd.pid start program = "/etc/init.d/proftpd start" stop program = "/etc/init.d/proftpd stop" if failed port 21 protocol ftp for 32 cycles then alert #if failed port 21 protocol ftp for 64 cycles then restart if 15 restarts within 15 cycles then timeout check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/sshd start" stop program "/etc/init.d/sshd stop" if failed port 22 protocol ssh for 7 cycles then alert if failed port 22 protocol ssh for 15 cycles then restart if 15 restarts within 15 cycles then timeout check process mysql with pidfile /var/run/mysqld/mysqld.pid start program = "/etc/init.d/mysqld start" stop program = "/etc/init.d/mysqld stop" if failed host 127.0.0.1 port 3306 for 5 cycles then alert if cpu usage > 30% for 10 cycles then alert if cpu usage > 50% for 10 cycles then alert if 15 restarts within 15 cycles then timeout check process httpd with pidfile /var/run/httpd.pid start program = "/etc/init.d/httpd start" stop program = "/etc/init.d/httpd stop" if failed host 192.168.0.1 port 80 for 5 cycles then alert if 15 restarts within 15 cycles then timeout
Можно делать и отдельными модулями там, но я предпочитаю в одном файле, особенно когда проверок не так много. Вариант, о котором вы говорите, это когда много сервисов проверяется, чтобы все в одном конфиге не городить.Kirill wrote:Файл /etc/monit.d/httpd необходимо тоже создать для записи директив для перезагрузки? Или не надо его создавать.
how do I access the url in my browser, I'm trying to access http://mydomain.com:10001
more is not opening the page monit
I installed according to the manual up, but it seems that is lacking something to be able to open in the browser page monitmsokolov wrote:Можно конфиги для Ubuntu 14.04 выложить
skid wrote:Извините пожалуйста, поторопился.
Code: Select all
yum -y install monit chkconfig monit on # Vesta Control Panel wget http://c.vestacp.com/0.9.8/rhel/monit/vesta-nginx.conf -O /etc/monit.d/vesta-nginx.conf wget http://c.vestacp.com/0.9.8/rhel/monit/vesta-php.conf -O /etc/monit.d/vesta-php.conf # Nginx wget http://c.vestacp.com/0.9.8/rhel/monit/nginx.conf -O /etc/monit.d/nginx.conf # Apache wget http://c.vestacp.com/0.9.8/rhel/monit/httpd.conf -O /etc/monit.d/httpd.conf # MySQL wget http://c.vestacp.com/0.9.8/rhel/monit/mysql.conf -O /etc/monit.d/mysql.conf # Exim wget http://c.vestacp.com/0.9.8/rhel/monit/exim.conf -O /etc/monit.d/exim.conf # Dovecot wget http://c.vestacp.com/0.9.8/rhel/monit/dovecot.conf -O /etc/monit.d/dovecot.conf # ClamAV wget http://c.vestacp.com/0.9.8/rhel/monit/clamd.conf -O /etc/monit.d/clamd.conf # Spamassassin wget http://c.vestacp.com/0.9.8/rhel/monit/spamassassin.conf -O /etc/monit.d/spamassassin.conf # OpenSSH wget http://c.vestacp.com/0.9.8/rhel/monit/sshd.conf -O /etc/monit.d/sshd.conf service monit start
Re: Автоматический рестарт MySQL и Apache
You forgot about firewall, I think.rogerio.dobler wrote:I installed according to the manual up, but it seems that is lacking something to be able to open in the browser page monit
PS: In future try to make another post in english part of forum ;-)