Monit is another tool for monitoring, it just do not give you a graphical interface, but it also setup alerts for you when your server use more cpu or ram, or if some service like apache stop, it automatically try to restart it.
Official website: http://mmonit.com/monit/
Documentation: http://mmonit.com/monit/documentation/
Official wiki: http://mmonit.com/wiki/
Yum is ofcourse will be used to install it
yum -y install monit
configuration file is /etc/monit.conf
This file is itself self explanatory
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
set daemon 60 set logfile syslog facility log_daemon set mailserver localhost set mail-format { from: monit@server1.example.com } set alert root@localhost set httpd port 2812 and SSL ENABLE PEMFILE /var/certs/monit.pem allow admin:test 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 then restart if 5 restarts within 5 cycles then timeout check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/ssh start" stop program "/etc/init.d/ssh stop" if failed port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout check process mysql with pidfile /var/run/mysqld/mysqld.pid group database start program = "/etc/init.d/mysql start" stop program = "/etc/init.d/mysql stop" if failed host 127.0.0.1 port 3306 then restart if 5 restarts within 5 cycles then timeout check process apache with pidfile /var/run/apache2.pid group www start program = "/etc/init.d/apache2 start" stop program = "/etc/init.d/apache2 stop" if failed host www.example.com port 80 protocol http and request "/monit/token" then restart if cpu is greater than 60% for 2 cycles then alert if cpu > 80% for 5 cycles then restart if totalmem > 500 MB for 5 cycles then restart if children > 250 then restart if loadavg(5min) greater than 10 for 8 cycles then stop if 3 restarts within 5 cycles then timeout check process postfix with pidfile /var/spool/postfix/pid/master.pid group mail start program = "/etc/init.d/postfix start" stop program = "/etc/init.d/postfix stop" if failed port 25 protocol smtp then restart if 5 restarts within 5 cycles then timeout |
You can change values as per your requirements.
Start monit
1 |
service monit start |
And you can access it at
1 |
http://ip_address:2812 |
If you are running iptables firewall then you will have to configure port in your firewall
1 2 |
iptables -t filter -A OUTPUT -p tcp --dport 2812 -j ACCEPT iptables -t filter -A INPUT -p tcp --dport 2812 -j ACCEPT |
Comment Policy:
Your words are your own, so be nice and helpful if you can. Please, only use your real name, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.