CentOS 6 e sebelisa Monit joang ho beha leihlo? Ho kenya Linux le ho tlosa lithuto tsa Monit

CentOS 6 Mokhoa oa ho sebelisamonit monitoring?

LinuxKenya le ho tlosa monit tutorial

Monit monitoring program ke sesebelisoa se bulehileng sa ho beha leihlo bakeng sa sistimi ea ts'ebetso ea Linux.E ka u thusa ho sebelisa sebatli sa marang-rang ho beha leihlo lits'ebetso tsa sistimi Ha lenaneo kapa ts'ebeletso e hloleha, monit e ka e qala bocha

monit e ka sebetsoa ka kotloloho moleng oa taelo, o ka abela mesebetsi e mengata ea monit (eseng feela ho beha leihlo), kahoo haeba ts'ebeletso e itseng e hloleha ho hlahloba, o ka fetisa tlhokomeliso ea monit kapa oa etsa ho hong (leka ho qala lits'ebeletso tse ling hape).

Sengoliloeng sena se nka hore u tseba bonyane metheo ea Linux, u tseba ho sebelisa SSH, mme sa bohlokoa le ho feta, hore o amohela sebaka sa hau sa marang-rang ho VPS ea hau.

Ho kenya lenaneo la ho beha leihlo la Monit ha e le hantle ho bonolo haholo, ke tla u bontša mohato ka mohato ho kenya monit ho CentOS 6.

Mohato oa 1: Numella polokelo ea EPEL

RHEL/CentOS 7 64-bit:

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm

RHEL/CentOS 6 32-bit:

wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
 rpm -ivh epel-release-6-8.noarch.rpm
  • CentOS 7 ha e tšehetse polokelo ea 32-bit EPEL, kahoo sebelisa RHEL/CentOS 6 32-bit.

Mohato oa 2: Kenya monit

yum update
yum install -y libcrypto.so.6 libssl.so.6
yum install monit

Mohato oa 3: Lokisa monit

Ha e se e kentsoe, hlophisa faele ea mantlha ea tlhophiso 'me u ipehele lebitso la hau la mosebelisi le password, bona mohlala o ka tlase:

nano /etc/monit.conf

Fetola faele ea tlhophiso ea monit:

 set httpd port 2812 and  # # set the listening port to your desire.
 use address localhost    # only accept connection from localhost
 allow localhost          # allow localhost to connect to the server and
 allow admin:monit        # require user 'admin' with password 'monit'
 allow @monit             # allow users of group 'monit' to connect (rw)
 allow @users readonly # allow users of group 'users' to connect readonly

Bakeng sa lintlha tse mabapi le mokhoa oa ho hlophisa monit, ka kopo sheba sena "Mokhoa oa ho seta faele ea monit.conf? monit configuration faele tlhaloso tlhaloso"sengoloa.

Hang ha u se u fetotse tlhophiso e ncha, u hloka ho nolofalletsa litlhophiso tsa ho kenya hape tsa tšebeletso ea monit:

/etc/init.d/monit start

monit standard qala, emisa, qala hape litaelo:

/etc/init.d/monit start
/etc/init.d/monit stop
/etc/init.d/monit restart

Mohato oa 4: Lokisa tšebeletso ea ho beha leihlo monit

Ka mor'a hore tlhophiso ea pele e phethe, re ka hlophisa litšebeletso tse ling tseo re batlang ho li beha leihlo.

Mehlala e meng ea tlhophiso ea monit ke ena:

  #
  # 监控apache
  #
  check process apache with pidfile /usr/local/apache/logs/httpd.pid
  start program = "/etc/init.d/httpd start"
  stop program = "/etc/init.d/httpd stop"
  if failed host www.ufo.org.in port 80 protocol http then restart
  if 3 restarts within 5 cycles then timeout
  group server

  #
  #监控mysql(1)
  #
  check process mysqld with pidfile /var/run/mysqld/mysqld.pid
  start program = "/etc/init.d/mysqld start"
  stop program = "/etc/init.d/mysqld stop"
  if failed host localhost port 3306 for 3 times within 4 cycles then alert
  #若在四个周期内,三次 3306(我的Mysql)端口都无法连通,则邮件通知
  if 5 restarts within 5 cycles then timeout

  #
  #检测nginx服务
  #
  check process nginx with pidfile /usr/local/nginx/logs/nginx.pid
  start program = "/etc/init.d/nginx start"
  stop program = "/etc/init.d/nginx stop"
  if failed host localhost port 80 protocol http
  then restart

Kamora ho theha lifaele tsa tlhophiso tse hlokahalang, leka liphoso tsa syntax:

monit -t

Qala monit ka ho ngola feela:

monit

Ho beha monit ho qala ka sistimi, eketsa qetellong ea faele ea /etc/inittab:

# Run monit in standard run-levels
  mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc

Monit Notes

Kaha monit e behiloe joalo ka ts'ebetso ea daemon, 'me litlhophiso tse qalang ka sistimi li kenyellelitsoe ho inittab, haeba ts'ebetso ea monit e emisa, ts'ebetso ea init e tla e qala hape, ebe e lekola lits'ebeletso tse ling, ho bolelang hore lits'ebeletso tsa monit li ke ke tsa etsoa. e emisitse ho sebelisa mekhoa e tloaelehileng, hobane hang ha e emisitsoe, monit e tla qala hape.

Ho emisa tšebeletso e shebiloeng ke Monit, u lokela ho sebelisa ntho e kanglebitso la monit stopTaelo e kang ena, mohlala, ho emisa nginx:

monit stop nginx

Ho emisa lits'ebeletso tsohle tse shebiloeng ka tšebeliso ea monit:

monit stop all

Ho qala tšebeletso eo u ka e sebelisangmonit qala lebitsotaelo e joalo.

Qala tsohle:

monit start all

Tlosa monit:

yum remove monit

Palo e atolositsoeng:

Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) o arolelane "CentOS 6 mokhoa oa ho sebelisa leihlo la Monit? Ho kenya Linux le ho tlosoa ha Monit Tutorial" ho tla u thusa.

Rea u amohela ho arolelana sehokelo sa sengoloa sena:https://www.chenweiliang.com/cwl-159.html

Rea u amohela ho mocha oa Telegraph oa blog ea Chen Weiliang ho fumana lintlha tsa morao-rao!

🔔 Eba oa pele oa ho fumana Tataiso ea Tšebeliso ea "ChatGPT Content Marketing AI" ea bohlokoa bukeng ea holimo ea seteishene! 🌟
📚 Tataiso ena e na le boleng bo boholo, 🌟Ona ke monyetla o sa tloaelehang, se ke oa o fetoa! ⏰⌛💨
Share le rata haeba u rata!
Ho arolelana le lintho tseo u li ratang ke khothatso ea rona e tsoelang pele!

 

Comments

Aterese ea hau ea lengolo tsoibila e ke ke ea phatlalatsoa. Ho sebelisoa masimo a hlokahalang * Letšoao

tsamaisetsa hodimo