Akwụkwọ ndekọ ederede
N'ime nkuzi a, anyị ga-egosi gị otu esi etinye nlekota Monit na CentOS Webpanel (CWP7) na CentOS 7.
Kedu ihe bụ nlekota Monit?
Monit nlekota oru bụ ngwanrọ efu na nke mepere emepe , ọ bụkwa mmemme nlekota oru Linux bara uru nke ukwuu.
- Ọ nwere ike nyochaa ma jikwaa usoro ihe nkesa na-akpaghị aka, faịlụ, akwụkwọ ndekọ aha, ikike checksum, sistemụ faịlụ na ọrụ na UNIX/Linux.
- Dịka ọmụmaatụ: Apache, Nginx,MySQL, FTP, SSH, Postfix, wdg ...
- Njikwa sistemụ dabere na sistemụ na-enye ikike nleba anya dị mma maka ndị na-ahụ maka sistemụ.
Kedu ihe kpatara ịwụnye nlekota Moit?
I nwere ike iji nlekota Monit belata oge ọrụ, nke nwere ike inyere aka na SEO na ahịa ịntanetị nke weebụsaịtị e-commerce .
N'ihi na mgbe ọrụ ọ bụla dara, Monit na-enyocha ya wee malite ọrụ ahụ na-akpaghị aka.
Dịka ọmụmaatụ: ọ bụrụ na ọrụ Apache ma ọ bụ Nginx gị dara n'enweghị ihe kpatara ya, mgbe ahụ, monit ga-elele, ma ọ bụrụ na achọpụta na ọ dị ala, mgbe ahụ monit ga-amalite ọrụ yiri ya ozugbo.
Otu ihe na-adọrọ mmasị bụ na monit na-arụ ọrụ httpd nke ya.
Ọ bụrụ na ọrụ apache gị adalata, monit ga-eji ọrụ nke ya rụọ ọrụ.
Otu esi etinye ma wụnye ngwanrọ nlekota Moit na CWP 7?
Iji mezue nkuzi a, ị ga-achọ ihe ndị a chọrọ:
- CentOS Linux ụdị 7 (isi)
- MMA7
- CSF Firewall
Nzọụkwụ 1: SSH melite ebe nchekwa YUM gị, wee wụnye nlekota Monit ▼
yum update -y
yum install monitnke 2:Mepee ọdụ ụgbọ mmiri 2812 na CSF firewall ▼
vi /etc/csf/csf.conf # Allow incoming TCP ports TCP_IN = "20,21,22,2812,25,53,80,110,143,443,465,587,993,995,2030,2031,2082,2083,2086,2087,2095,2096"
Nzọụkwụ 3: Malitegharịa ekwentị CSF Firewall▼
csf -r nke 4:na SFTP软件Mgbe ịbanye na ihe nkesa Linux, dezie faịlụ nhazi Monit/etc/monitrc▼
set daemon 30 # check services at 30 seconds intervals
set log syslog
set pidfile /var/run/monit.pid
set idfile /var/.monit.id
set statefile /var/.monit.state
include /etc/monit.d/*
set mailserver localhost port 25
set eventqueue
basedir /var/monit # set the base directory where events will be stored
slots 100 # optionally limit the queue size
set alert admin@xxxxx #receive all alerts
set alert admin@xxxxx not on { instance, action }
set httpd port 2812 and use address 0.0.0.0
allow 0.0.0.0/0.0.0.0
allow admin:monit # require user 'admin' with password 'monit'Nzọụkwụ nke 5: Lelee usoro Monit maka njehie ▼
# monit -t Control file syntax OK
Ọ bụrụ na-efu, mepụta faịlụ ndị a:
# touch /var/run/monit.pid # touch /var/log/moinit.log
Ọ bụrụ na etinyere Redis , ị nwere ike ịhazi ebe faịlụ Redis PID dị. ▼
Monit na-agbakwụnye ọrụ nlekota oru
Ugbu a, anyị ga-enyocha ụfọdụ ọrụ dị kaamavisd, cland, crond, php-fpm na cwpsrv.Mepee faịlụ nhazi monit/etc/monitrc, ma tinye koodu a na njedebe nke ahịrị:
Nyochaa CWP.amavisd
# vi /etc/monitrc
check process amavisd with pidfile /var/run/amavisd/amavisd.pid
start program "/usr/bin/systemctl start amavisd.service"
stop program "/usr/bin/systemctl stop amavisd.service"
if failed unixsocket /var/run/amavisd/amavisd.sock then restart
if cpu > 70% for 4 cycles then alert
if cpu > 90% for 8 cycles then restart
if 4 restarts within 8 cycles then timeoutNyochaa CWP.clamd
# vi /etc/monitrc
check process clamd with pidfile /var/run/clamd.amavisd/clamd.pid
start program "/usr/bin/systemctl start clamd.service"
stop program "/usr/bin/systemctl stop clamd.service"
if failed unixsocket /var/run/clamd.amavisd/clamd.sock then restart
if cpu > 70% for 4 cycles then alert
if cpu > 90% for 8 cycles then restart
if 4 restarts within 8 cycles then timeout Nyochaa CWP.crond
# vi /etc/monitrc
check process crond with pidfile /var/run/crond.pid
start program = "/usr/bin/systemctl start crond.service"
stop program = "/usr/bin/systemctl stop crond.service" Nyochaa CWP.cwp-phpfpm
# vi /etc/monitrc
check process cwp-phpfpm matching "cwp-phpfpm"
start program "/usr/bin/systemctl start cwp-phpfpm.service"
stop program "/usr/bin/systemctl stop cwp-phpfpm.service"
if failed unixsocket /usr/local/cwp/php71/var/sockets/cwpsrv.sock then restart
if failed unixsocket /usr/local/cwp/php71/var/sockets/cwpsvc.sock then restart
if failed unixsocket /usr/local/cwp/php71/var/sockets/login.sock then restart
if cpu > 70% for 4 cycles then alert
if cpu > 90% for 8 cycles then restart
if 4 restarts within 8 cycles then timeout nyochaa cwp.cwpsrv
# vi /etc/monitrc
check process cwpsrv with pidfile /usr/local/cwpsrv/var/run/nginx.pid
start program "/usr/bin/systemctl start cwpsrv.service"
stop program "/usr/bin/systemctl stop cwpsrv.service"
if 4 restarts within 8 cycles then timeout Ozugbo ahaziri, monit kwesịrị ibugharị ma gụọ faịlụ nhazi ahụ, interface webụ ahụ ga-adị:
monit reloadMaka ntuziaka maka otu esi ajụ ajụjụ faịlụ PID nke usoro nchekwa data MySQL , biko lee nkuzi dị n'okpuru ▼
Ọrụ nlekota oru MonitỤzọ ọzọ (atụ aro)
1) Budata faịlụ ọrụ nlekota Monit▼
- Na ibe nbudata, pịa bọtịnụ "Budata Ugbu a" na nbudata nkịtị ka ibudata faịlụ ọrụ nlekota Monit n'efu.
- Koodu nzipu ozi: 5588
2) Wepu ma bulite na /etc/monit.d/ directory.
- ọ bụrụ n'imeNyochaa faịlụ nhazi Enwere ọrụ nlekota nke nwere otu nhazi na /etc/monitrc, nke kwesịrị ịdịNaNyochaa faịlụ nhazi /etc/monitrc na-ehichapụ, ma ọ bụghị ya, njehie ga-eme.
Mgbe ịmepụtachara faịlụ nhazi achọrọ, nwalee maka njehie syntax▼
monit -t
Ọ bụrụ na ihe na-esonụ pụtara ▼
monit -t /etc/monit.d/cwp.mariadbd:1: Service name conflict, mysql already defined '"/usr/sbin/mariadbd"'
- Nke a pụtara na
/etc/monit.d/cwp.mariadbd:1:Esemokwu aha ọrụ; mysql akọwapụtalarị'"/usr/sbin/mariadbd"' - ebe a bụ nkọwa
cwp.mariadbdFaịlụ adịlarị, naanị hichapụ yacwp.mysqldfaịlụ.
Ọ bụrụ na enweghị mperi, gbanye ma malitegharịa ọrụ monit ▼
systemctl enable monit systemctl restart monit
Malite ọrụ Monit na buut▼
systemctl enable monit.service
Ugbu a lelee ndekọ nlekota oru ▼
tail -f /var/log/monit.logNyochaa iwu ndị bụ isi
Jiri iwu na-esonụ malite monit ▼
monit
Lelee ọkwa Monit ▼
monit status
Bugharịa ya ka mgbanwe ndị ahụ dị irè▼
monit reload
Malite ịme mmemme niile nke Monit▼ na-enyocha
monit start all
Malitegharịa ọrụ nleba anya ikuku Monit niile▼
monit restart all
Ka ịmalite, kwụsị ma malitegharịa ọrụ ụfọdụ, ị nwere ike ijimonit start nameiwu dị otú ahụ ▼
monit start httpd
monit stop sshd
monit restart nginxMonit nlekota nchịkọta ▼
monit summary

Ugbu a, banye na sava monit site na iji aha njirimara na paswọọdụ Monit ị debere na mbụ.
URL nbanye:http://SERVER_FQDN:2812
Dozie nsogbu ahụ na anaghị enyocha ọrụ Monit mgbe niile
Monit gụnyere iwu maka inye na gbanyụọ nlekota oru niile ma ọ bụ kpọmkwem.
Ọ bụrụ na anaghị elele ọrụ Monit mgbe niile, ịnwere ike iji iwu a▼
monit monitor mysql
Ma ọ bụ megharịa nyocha niile▼
monit monitor all
- Rịba ama na ị ga-emerịrị interface Monit HTTP ka iwu ndị a rụọ ọrụ.
Iwu Monit (Pụrụ iche maka CentOS 7)
Lelee ọkwa mmalite Monit▼
systemctl status monit.service
Malite ọrụ Monit▼
systemctl start monit.service
Mechie ọrụ Monit▼
systemctl stop monit.service
Malitegharịa ọrụ Monit▼
systemctl restart monit
Malite ọrụ Monit na buut▼
systemctl enable monit.service
Gbanyụọ ma gbanyụọ ọrụ Monit▼
systemctl disable monit.service
Ihe ndetu nlekota
Monit na-enyocha usoro ọrụ, nke pụtara na ọrụ Monit na-enyocha enweghị ike ịkwụsị iji usoro nkịtị, n'ihi na ozugbo kwụsịrị, Monit ga-amalitekwa ha ọzọ.
Ka ịkwụsị ọrụ Monit na-enyocha, ị kwesịrị iji ihe dịkamonit stop nameIwu dị otú ahụ, dịka ọmụmaatụ ịkwụsị nginx ▼
monit stop nginx
Ka ịkwụsị ọrụ niile Monit na-enyocha, tinye iwu a▼
monit stop all
Wepu mmemme nlekota Monit ▼
yum remove monit
Enwere m olileanya na isiokwu "Otu esi etinye ngwanrọ nlekota Monit na CentOS Webpanel (CWP7)?" nke e kesara na blọgụ Chen Weiliang ( https://www.chenweiliang.com/ ) ga-abara gị uru.
Nwere onwe gị ịkọrọ njikọ akụkọ a: https://www.chenweiliang.com/cwl-1443.html

