Anyè Atik
- 1 Ki sa ki Monit siveyans?
- 2 Poukisa enstale Monit siveyans?
- 3 Ki jan yo enstale ak enstale lojisyèl siveyans Monit nan CWP 7?
- 4 Monit ajoute sèvis siveyans
- 5 Yon lòt fason pou Monit kontwole sèvis yo (rekòmande)
- 6 Monit siveyans kòmandman debaz yo
- 7 Rezoud pwoblèm nan ke sèvis Monit toujou pa siveye
- 8 Monit Command (espesyal pou CentOS 7)
- 9 Monit Nòt
Nan leson patikilye sa a nou pral montre w koumanCentOS CentOS Webpanel (CWP7) enstalasyon sou 7Monit siveyans.
Ki sa ki Monit siveyans?
Monit siveyans se yon sous gratis epi ouvè软件, li se yon trè itilLinuxpwogram siveyans.
- Li ka otomatikman kontwole ak jere pwosesis sèvè, fichye, anyè, pèmisyon checksum, sistèm dosye ak sèvis nan UNIX/Linux.
- Pou egzanp: Apache, Nginx,Miskl, FTP, SSH, Postfix, elatriye...
- Jesyon sistèm ki baze sou sistèm ki bay ekselan kapasite siveyans pou administratè sistèm yo.
Poukisa enstale Monit siveyans?
Ou ka itilize siveyans Monit pou diminye tan an, wiE-commerceSit wèbSEO和Maketing Entènètse yon efè oksilyè.
Paske lè nenpòt sèvis ki desann, Monit tcheke li epi li kòmanse sèvis la otomatikman.
Pou egzanp: si sèvis Apache oswa Nginx ou a desann san okenn rezon, Lè sa a, monit pral tcheke, epi si li jwenn yo dwe desann, Lè sa a, monit pral otomatikman kòmanse sèvis ki gen rapò yo.
Yon bagay enteresan se ke monit kouri pwòp sèvis httpd li yo.
Si sèvis apache ou a desann, monit ap kouri ak pwòp sèvis li.
Ki jan yo enstale ak enstale lojisyèl siveyans Monit nan CWP 7?
Pou w konplete leson patikilye sa a, w ap bezwen kondisyon sa yo:
- CentOS Linux vèsyon 7 (nwayo)
- CWP7
- CSF Firewall
Etap 1: SSHMete ajou depo YUM ou a, epi enstale Monit monitoring▼
yum update -y
yum install monit
Etap 2:Louvri pò 2812 sou firewall CSF ▼
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"
Etap 3: Rekòmanse CSF Firewall▼
csf -r
Etap 4:ak SFTP软件Apre w fin antre nan sèvè Linux la, edite fichye konfigirasyon Monit la/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'
Etap 5:Tcheke sentaks Monit pou erè ▼
# monit -t Control file syntax OK
Si w manke, kreye dosye sa yo:
# touch /var/run/monit.pid # touch /var/log/moinit.log
Si Redis enstale, ou ka bezwen manyèlman konfigirasyon adrès kote dosye Redis la ▼
Monit ajoute sèvis siveyans
Koulye a, nou pral kontwole kèk sèvis tankouamavisd, clamd, crond, php-fpm ak cwpsrv.Louvri fichye konfigirasyon monit la/etc/monitrc
, epi ajoute kòd sa a nan fen liy lan:
Siveye 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 timeout
Siveye 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
Siveye 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"
Siveye 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
kontwole 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
Yon fwa konfigirasyon, monit ta dwe rechaje epi reli fichye konfigirasyon an, epi koòdone entènèt la ap disponib:
monit reload
查询baz done MySQLPou metòd pwosesis pidfile, tanpri tcheke leson patikilye ki anba a ▼
Monit Siveyans SèvisYon lòt fason (rekòmande)
1) Telechaje dosye sèvis siveyans Monit ▼
- Nan paj telechaje a, klike sou bouton "Telechaje kounye a" nan telechaje nòmal la pou telechaje dosye sèvis siveyans Monit pou gratis.
- (Kod aksè: 5588)
2) Dekonprime ak telechaje nan /etc/monit.d/ anyè.
- si nanMonit fichye konfigirasyon Gen yon sèvis siveyans ak menm konfigirasyon an nan /etc/monitrc, ki bezwen yo dwe在Monit fichye konfigirasyon /etc/monitrc efase, sinon yon erè ap fèt.
Apre ou fin kreye dosye konfigirasyon ki nesesè yo, teste pou erè sentaks▼
monit -t
Si èd memwa sa a parèt ▼
monit -t /etc/monit.d/cwp.mariadbd:1: Service name conflict, mysql already defined '"/usr/sbin/mariadbd"'
- Sa vle di sa
/etc/monit.d/cwp.mariadbd:1:
Konfli non sèvis; mysql deja defini'"/usr/sbin/mariadbd"'
- isit la se deskripsyon an
cwp.mariadbd
Fichye a deja egziste, jis efase licwp.mysqld
dosye.
Si pa gen okenn erè, aktive epi rekòmanse sèvis monitè a ▼
systemctl enable monit systemctl restart monit
Kòmanse sèvis Monit nan bòt ▼
systemctl enable monit.service
Koulye a tcheke jounal siveyans ▼
tail -f /var/log/monit.log
Monit siveyans kòmandman debaz yo
Kòmanse monitè ak kòmandman an ▼
monit
Tcheke sitiyasyon Monit ▼
monit status
Rechaje li pou chanjman yo pran efè▼
monit reload
Kòmanse kouri tout pwogram ki kontwole pa Monit▼
monit start all
Rekòmanse tout sèvis siveyans lè Monit▼
monit restart all
Pou kòmanse, sispann ak rekòmanse sèvis espesifik, ou ka itilizemonit start name
Tankou yon lòd ▼
monit start httpd
monit stop sshd
monit restart nginx
Rezime Siveyans Monit▼
monit summary
Kounye a, konekte sou sèvè monit la lè l sèvi avèk non itilizatè ak modpas Monit ou te fikse anvan an.
URL konekte:http://SERVER_FQDN:2812
Rezoud pwoblèm nan ke sèvis Monit toujou pa siveye
Monit gen ladan kòmandman pou pèmèt ak enfim siveyans tout oswa sèvis espesifik.
Si sèvis Monit la toujou pa siveye, ou ka itilize lòd sa a▼
monit monitor mysql
Oswa re-aktive tout siveyans ▼
monit monitor all
- Remake byen ke ou dwe aktive koòdone Monit HTTP pou kòmandman sa yo travay.
Monit Command (espesyal pou CentOS 7)
Gade sitiyasyon demaraj Monit▼
systemctl status monit.service
Kòmanse sèvis Monit la ▼
systemctl start monit.service
Fèmen sèvis Monit ▼
systemctl stop monit.service
Rekòmanse sèvis Monit la▼
systemctl restart monit
Kòmanse sèvis Monit nan bòt ▼
systemctl enable monit.service
Limen ak etenn sèvis Monit la
systemctl disable monit.service
Monit Nòt
Monit kontwole sèvis pwosesis, ki vle di ke sèvis kontwole pa Monit pa ka sispann lè l sèvi avèk metòd nòmal, paske yon fwa sispann, Monit pral rekòmanse yo.
Pou sispann yon sèvis ki kontwole pa Monit, ou ta dwe itilize yon bagay tankoumonit stop name
Tankou yon lòd, pou egzanp yo sispann nginx ▼
monit stop nginx
Pou sispann tout sèvis Monit kontwole, antre lòd sa a▼
monit stop all
Dezenstale pwogram siveyans Monit ▼
yum remove monit
Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) pataje "Ki jan yo enstale lojisyèl siveyans Monit sou CentOS Webpanel (CWP7)? , pou ede w.
Byenvini pataje lyen atik sa a:https://www.chenweiliang.com/cwl-1443.html
Byenveni nan chanèl Telegram blog Chen Weiliang a pou jwenn dènye mizajou yo!
📚 Gid sa a gen anpil valè, 🌟Sa a se yon opòtinite ki ra, pa rate li! ⏰⌛💨
Pataje epi like siw renmen!
Pataje w ak renmen ou se motivasyon kontinyèl nou!