In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use Monit to monitor Linux server". In daily operation, I believe many people have doubts about how to use Monit to monitor Linux server. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use Monit to monitor Linux server". Next, please follow the editor to study!
Monit uses Monit to monitor linux server
Monit is a tool for monitoring the status of the system, not only can be used to monitor processes, services, files, directories, file systems, but also can automatically restart the service when the service down is down or automatically stop the process when a process takes up too many resources, and support Email alarm function, remote server monitoring, web management interface and so on, many functions are very powerful. VPSee uses monit to monitor multiple VPS and independent servers. If a VPS down or a server is short of resources, you can know immediately, and if a service stops, you can automatically restart the service.
Install monit
Install and configure files under CentOS:
The code is as follows:
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm-Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# yum install monit
# vi / etc/monit.conf
Configure monit
Modify the monit configuration file, / etc/monit.conf (CentOS) or / etc/monit/monitrc (Debian), check the system every 120 seconds, and restart the httpd/mysql/sshd service if it stops. For the httpd server, when it is found that the CPU/MEM occupies too much and the loadavg is too high, the corresponding alarm and restart service instructions are executed. If you use the Email alarm feature, you need to configure Email address, mail server and other information:
The code is as follows:
Set daemon 120
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 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/mysqld start"
Stop program = "/ etc/init.d/mysqld stop"
If failed host 127.0.0.1 port 3306 then restart
If 5 restarts within 5 cycles then timeout
Check process nginx with pidfile / var/run/nginx.pid
Start program = "/ etc/init.d/nginx start"
Stop program = "/ etc/init.d/nginx stop"
If failed host www.yanghengfei.com port 80 protocol http
Then restart
Check process php_cgi with pidfile / var/run/php_cgi.pid
Start program = "/ etc/init.d/php_cgi start"
Stop program = "/ etc/init.d/php_cgi stop"
If failed host 127.0.0.1 port 9000 then restart
If 5 restarts within 5 cycles then timeout
Check process apache with pidfile / var/run/httpd.pid
Group www
Start program = "/ etc/init.d/httpd start"
Stop program = "/ etc/init.d/httpd stop"
If failed host www.yanghengfei.com port 8080 protocol http
Then restart
If cpu is greater than 80% for 2 cycles then alert
If cpu > 80% for 5 cycles then restart
If totalmem > 512 MB for 5 cycles then restart
If children > 200 then restart
If loadavg (5min) greater than 10 for 8 cycles then stop
If 3 restarts within 5 cycles then timeout
For more details, please refer to the configuration file, where the comments are written in detail.
Start monit
Start under CentOS and add to the system startup script:
The code is as follows:
# / etc/init.d/monit start
# / sbin/chkconfig monit on
At this point, the study on "how to use Monit to monitor Linux server" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
# Flush all policyiptables-Fiptables-Xiptables-Ziptables-t nat-Fiptables-t nat-Xiptables-t n
© 2024 shulou.com SLNews company. All rights reserved.