Datrys Problemau Gwallau monitro CWP7 : Methodd y cysylltiad nginx wrth fonitro

Y tro diwethaf, pan osododd Chen Weiliang y feddalwedd monitro Monit ym mhanel rheoli CWP (CWP7) , datrysodd y broblem gyda'r broses fonitro Monit yn diflannu wrth gychwyn (methodd monit.service).
Nawr mae gen i broblem newydd - mae monitro Monit wedi methu cysylltiad Nginx ...
Sut i ddatrys methiant nginx Connection yn monit?
Methodd y dull i ddatrys y Cysylltiad nginx mewn problem gwall monitro:
Yn gyntaf, SSH i mewn i'r gorchymyn canlynol ▼
ps -ef|grep nginxWedi dod o hyd i'r ffeil ffurfweddu nginx:
[root@ten ~]# ps -ef|grep nginx root 11550 1 0 02:12 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf nobody 11551 11550 0 02:12 ? 00:00:04 nginx: worker process nobody 11552 11550 0 02:12 ? 00:00:08 nginx: worker process nobody 11553 11550 0 02:12 ? 00:00:02 nginx: worker process nobody 11554 11550 0 02:12 ? 00:00:01 nginx: worker process nobody 11555 11550 0 02:12 ? 00:00:00 nginx: cache manager process root 19827 9820 0 02:37 pts/0 00:00:00 grep --color=auto nginx
Agorwch y ffeil ffurfweddu nginx :
/etc/nginx/nginx.conf
Wedi dod o hyd i leoliad llwybr nginx.pid:
pid /var/run/nginx.pid;
Yn ffeil ffurfweddu rhaglen fonitro Monit, nodwch y ffurfweddiad canlynol ar gyfer monitro nginx▼
check process nginx with pidfile /var/run/nginx.pid
start program "/usr/bin/systemctl start nginx.service"
stop program "/usr/bin/systemctl stop nginx.service"
if failed port 8181 protocol http then restart
if 4 restarts within 8 cycles then timeoutif 4 restarts within 8 cycles then timeoutAilgychwyn rhaglen fonitro Monit▼
systemctl restart monit.serviceGweld statws rhaglen fonitro Monit▼
systemctl status monit.serviceOs cyrhaeddir y cam hwn, mae'r neges gwall yn dal i ymddangos:nginx Connection failed in monit
Ceisiwch addasu rhif porthladd y ffurfweddiad monitro nginx i "8181" neu "80":
if failed port 8181 protocol http then restart if failed port 80 protocol http then restart
Yna, ailgychwynwch raglen fonitro Monit▼
systemctl restart monit.serviceGweld statws rhaglen fonitro Monit▼
systemctl status monit.serviceMae problem nginx Connection wedi methu yn monit yn cael ei datrys o'r diwedd!
Gobeithio y bydd yr erthygl "Datrys y Cysylltiad nginx wedi methu yn y gwall monit" a rennir ar flog Chen Weiliang ( https://www.chenweiliang.com/ ) o gymorth i chi.
Mae croeso i chi rannu'r ddolen erthygl hon: https://www.chenweiliang.com/cwl-1423.html
