ဆောင်းပါးလမ်းညွှန်
CentOS 6 အသုံးပြုပုံစောင့်ကြည့်ရေး?
Linux ကိုmonit သင်ခန်းစာကို ထည့်သွင်းပြီး ဖြုတ်ပါ။
Monit စောင့်ကြည့်ရေးပရိုဂရမ်သည် Linux လည်ပတ်မှုစနစ်အတွက် ပွင့်လင်းသော အရင်းအမြစ်စောင့်ကြည့်ရေးကိရိယာတစ်ခုဖြစ်သည်။ ၎င်းသည် သင့်အား ဝဘ်ဘရောက်ဆာတစ်ခုအား အသုံးပြု၍ စနစ်လုပ်ငန်းစဉ်များကို စောင့်ကြည့်ရန် ကူညီပေးနိုင်ပါသည်။ ပရိုဂရမ် သို့မဟုတ် ဝန်ဆောင်မှုတစ်ခု ပျက်ကွက်သောအခါ၊ monit သည် ၎င်းကို အလိုအလျောက် ပြန်လည်စတင်နိုင်သည်။
monit ကို command line တွင်တိုက်ရိုက်လုပ်ဆောင်နိုင်ပြီး၊ သင်သည် monit tasks အများအပြားကို တာဝန်ပေးအပ်နိုင်သည် (စောင့်ကြည့်ရုံသာမက)၊ ထို့ကြောင့် အချို့သောဝန်ဆောင်မှုများသည် စစ်ဆေးမှုပျက်ကွက်ပါက၊ သင်သည် monit ၏သတိပေးချက်ကို ကျော်ဖြတ်နိုင်သည် သို့မဟုတ် တစ်ခုခုလုပ်ဆောင်နိုင်သည် (အချို့ဝန်ဆောင်မှုများကို ပြန်လည်စတင်ကြည့်ပါ)။
ဤဆောင်းပါးတွင် သင်သည် အနည်းဆုံး Linux ၏ အခြေခံများကို သိပြီး၊ SSH ကို အသုံးပြုပုံကို သိပြီး အရေးအကြီးဆုံးမှာ သင့်ဝဘ်ဆိုဒ်ကို သင့်ကိုယ်ပိုင် VPS တွင် လက်ခံဆောင်ရွက်ပေးကြောင်း ယူဆပါသည်။
Monit စောင့်ကြည့်ရေးပရိုဂရမ်ကို တပ်ဆင်ခြင်းသည် အမှန်တကယ်ပင် အလွန်ရိုးရှင်းပါသည်၊ ကျွန်ုပ်သည် CentOS 6 တွင် Monit တပ်ဆင်ခြင်းကို အဆင့်ဆင့်ပြသပါမည်။
အဆင့် 1- EPEL repository ကိုဖွင့်ပါ။
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 သည် 32-bit EPEL repositories ကိုမပံ့ပိုးပါ၊ ထို့ကြောင့် RHEL/CentOS 6 32-bit ကိုသုံးပါ။
အဆင့် 2- monit ကို install လုပ်ပါ။
yum update yum install -y libcrypto.so.6 libssl.so.6 yum install monit
အဆင့် 3- Monit ကို စီစဉ်သတ်မှတ်ပါ။
ထည့်သွင်းပြီးသည်နှင့်၊ ပင်မဖွဲ့စည်းပုံဖိုင်ကို တည်းဖြတ်ပြီး သင်၏ကိုယ်ပိုင်အသုံးပြုသူအမည်နှင့် စကားဝှက်ကို သတ်မှတ်ပါ၊ အောက်ပါ ဥပမာကို ကြည့်ပါ။
nano /etc/monit.conf
Monit configuration ဖိုင်ကို တည်းဖြတ်ပါ-
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
Monit ကို ဘယ်လို configure လုပ်ရမယ်ဆိုတဲ့ အသေးစိတ်အတွက် ကျေးဇူးပြုပြီး ဒီကိုရှာကြည့်ပါ"monit.conf ဖိုင်ကို ဘယ်လိုစသတ်မှတ်မလဲ။ Monit configuration ဖိုင်နမူနာဖော်ပြချက်"ဆောင်းပါး။
သင်ဖွဲ့စည်းပုံအသစ်ကို ပြင်ဆင်ပြီးသည်နှင့်၊ သင်သည် monit ဝန်ဆောင်မှု၏ ပြန်လည်စတင်ခြင်းဆက်တင်များကို ဖွင့်ထားရန် လိုအပ်သည်-
/etc/init.d/monit start
monit standard start၊ stop၊ restart commands-
/etc/init.d/monit start /etc/init.d/monit stop /etc/init.d/monit restart
အဆင့် 4- monit စောင့်ကြည့်ရေးဝန်ဆောင်မှုကို စီစဉ်သတ်မှတ်ပါ။
ကနဦးဖွဲ့စည်းမှု ပြီးမြောက်ပြီးနောက်၊ ကျွန်ုပ်တို့ စောင့်ကြည့်လိုသော ဝန်ဆောင်မှုအချို့ကို ပြင်ဆင်သတ်မှတ်နိုင်ပါသည်။
ဤသည်မှာ Monit အတွက် အသုံးဝင်သော ဖွဲ့စည်းမှုပုံစံအချို့ ဥပမာများဖြစ်သည်။
# # 监控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
လိုအပ်သော configuration ဖိုင်များကိုဖန်တီးပြီးနောက်၊ syntax အမှားများကိုစမ်းသပ်ပါ။
monit -t
စာရိုက်ရုံဖြင့် monit ကို စတင်ပါ။
monit
စနစ်ဖြင့်စတင်ရန် monit ကိုသတ်မှတ်ရန် /etc/inittab ဖိုင်၏အဆုံးတွင် ထည့်ပါ။
# Run monit in standard run-levels mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc
မှတ်စုများကို စောင့်ကြည့်ပါ။
Monit ကို daemon လုပ်ငန်းစဉ်အဖြစ်သတ်မှတ်ထားသောကြောင့်၊ စနစ်ဖြင့်စတင်သည့်ဆက်တင်များကို inittab တွင်ထည့်သွင်းထားသောကြောင့် monit လုပ်ငန်းစဉ်ရပ်သွားပါက init လုပ်ငန်းစဉ်သည် ၎င်းကိုပြန်လည်စတင်မည်ဖြစ်ပြီး၊ monit သည် အခြားသောဝန်ဆောင်မှုများကိုစောင့်ကြည့်မည်၊ ဆိုလိုသည်မှာ monit monitors ဝန်ဆောင်မှုများသည် ဝန်ဆောင်မှုများမဖြစ်နိုင်ပါ။ ပုံမှန်နည်းလမ်းများကို မသုံးတော့ဘဲ ရပ်လိုက်သည်နှင့် တစ်ပြိုင်နက် monit သည် ၎င်းတို့ကို ပြန်စတင်လိမ့်မည်ဖြစ်သည်။
Monit မှ စောင့်ကြည့်သည့် ဝန်ဆောင်မှုကို ရပ်ရန်၊ သင်ကဲ့သို့ တစ်ခုခုကို အသုံးပြုသင့်သည်။monit stop အမည်ဥပမာအားဖြင့်၊ nginx ကို ရပ်တန့်ရန် ဤကဲ့သို့သော command တစ်ခု။
monit stop nginx
Monit အသုံးပြုမှုဖြင့် စောင့်ကြည့်ထားသော ဝန်ဆောင်မှုအားလုံးကို ရပ်ရန်-
monit stop all
ဝန်ဆောင်မှုတစ်ခုစတင်ရန် သင်အသုံးပြုနိုင်ပါသည်။monit စတင်အမည်အဲဒီလို အမိန့်ပေးတယ်။
အားလုံးကို စတင်ပါ-
monit start all
Monit ကို ဖြုတ်ပါ-
yum remove monit
တိုးချဲ့ဖတ်ခြင်း
- "monit.conf ဖိုင်ကို ဘယ်လိုစသတ်မှတ်မလဲ။ Monit configuration ဖိုင်နမူနာဖော်ပြချက်"
- "monit ပရိုဂရမ်သည် mysqld ၏ပျက်ကွက်မှုကိုစောင့်ကြည့်ပါကဘာလုပ်သင့်သနည်း။ linux ဒေတာဘေ့စ်၏ပျက်ကွက်မှုအတွက်ဖြေရှင်းချက်"
မျှော်လင့်ခြင်း Chen Weiliang ဘလော့ဂ် ( https://www.chenweiliang.com/ ) shared "CentOS 6 သည် Monit monitoring ကို မည်သို့အသုံးပြုရမည်နည်း။ Monit Tutorial ၏ Linux တပ်ဆင်ခြင်းနှင့် ဖြုတ်ချခြင်း" သည် သင့်အား ကူညီပေးပါမည်။
ဤဆောင်းပါး၏ link ကိုမျှဝေရန်ကြိုဆိုပါတယ်:https://www.chenweiliang.com/cwl-159.html
နောက်ဆုံးထွက်မွမ်းမံမှုများကို ရယူရန် Chen Weiliang ၏ တယ်လီဂရမ်ချန်နယ်မှ ကြိုဆိုပါသည်။
📚 ဤလမ်းညွှန်တွင် တန်ဖိုးကြီးကြီးမားမားပါရှိသည်၊ 🌟ဒါက ရှားပါးအခွင့်အရေးပါ၊ လက်လွတ်မခံပါနဲ့။ ⏰⌛💨
ကြိုက်ရင် Share ပြီး Like လုပ်ပါ။
သင်၏မျှဝေခြင်းနှင့် လိုက်ခ်များသည် ကျွန်ုပ်တို့၏ စဉ်ဆက်မပြတ်လှုံ့ဆော်မှုဖြစ်သည်။