ಲೇಖನ ಡೈರೆಕ್ಟರಿ
ಮೊದಲುಚೆನ್ ವೈಲಿಯಾಂಗ್ಬ್ಲಾಗ್ ಹಂಚಿಕೊಂಡಿದ್ದಾರೆCentOS 6 ಮಾನಿಟ್ ▼ ಅನ್ನು ಸ್ಥಾಪಿಸಲು ಮತ್ತು ಕಾನ್ಫಿಗರ್ ಮಾಡಲು ಟ್ಯುಟೋರಿಯಲ್
ಆದಾಗ್ಯೂ, CentOS 7 ಸಂರಚನೆಯಲ್ಲಿಮಾನಿಟ್ ಮಾನಿಟರಿಂಗ್CentOS 6 ನಿಂದ ಕೆಲವು ವ್ಯತ್ಯಾಸಗಳೊಂದಿಗೆ ಪ್ರೋಗ್ರಾಂ ನಿಖರವಾಗಿ ಒಂದೇ ಆಗಿರುವುದಿಲ್ಲ.
ನಿಮ್ಮ ವೇಳೆಲಿನಕ್ಸ್ಹೋಸ್ಟ್ CentOS 7 ಸಿಸ್ಟಮ್ ಅನ್ನು ಬಳಸುತ್ತದೆ. Vesta CP ಪ್ಯಾನೆಲ್ನಲ್ಲಿ Monit ಅನ್ನು ಸ್ಥಾಪಿಸಿದ ನಂತರ, Monit ಮಾನಿಟರಿಂಗ್ ಪ್ರೋಗ್ರಾಂ ಅನ್ನು ಕಾನ್ಫಿಗರ್ ಮಾಡಲು ನೀವು ಈ ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ಅನುಸರಿಸಬಹುದು.
ಮಾನಿಟ್ ಮಾನಿಟರಿಂಗ್ ಪ್ರಕ್ರಿಯೆ ಸೇವೆ
ಮಾನಿಟ್ ಮಾನಿಟರಿಂಗ್ ಪ್ರಕ್ರಿಯೆಯ ಸೇವಾ ಕಾನ್ಫಿಗರೇಶನ್ ವಿಷಯವು ಕೆಳಕಂಡಂತಿದೆ (ಕೆಲವು ಕಡಿಮೆ-ಬಳಸಿದ ಮಾನಿಟರಿಂಗ್ ಸೇವೆಗಳನ್ನು ಅಳಿಸಿ):
-
ಬಿಗಿಯಾದ - ಕ್ರೌಂಡ್
- ಪಾರಿವಾಳ
- exim
- httpd
-
ಮೆಮ್ಕಾಚೆಡ್ - MySQL
- nginx
-
ಸ್ಪಮಾಸ್ಸಾಸಿನ್ - ssh
- ವೆಸ್ಟಾ-ಎನ್ಜಿಎನ್ಎಕ್ಸ್
- vesta-php
- vsftpd
-
ಸ್ಥಳ ಮತ್ತು ಐನೋಡ್ಗಳನ್ನು ಮೇಲ್ವಿಚಾರಣೆ ಮಾಡಿ -
ಸಿಸ್ಟಮ್ ಸಂಪನ್ಮೂಲಗಳನ್ನು ಮೇಲ್ವಿಚಾರಣೆ ಮಾಡಿ (RAM, ಸ್ವಾಪ್, CPU, ಲೋಡ್)
ಮಾನಿಟ್ ಮಾನಿಟರಿಂಗ್ ಕಾನ್ಫಿಗರೇಶನ್
Monit ಕಾನ್ಫಿಗರೇಶನ್ ಫೈಲ್ ಹೆಸರುಗಳು CentOS 6 ಮತ್ತು 7 ಗೆ ವಿಭಿನ್ನವಾಗಿವೆ:
- CentOS 6 ಗಾಗಿ Monit ಕಾನ್ಫಿಗರೇಶನ್ ಫೈಲ್ನ ಹೆಸರು "monit.conf"
- CentOS 7 ಗಾಗಿ Monit ಕಾನ್ಫಿಗರೇಶನ್ ಫೈಲ್ನ ಹೆಸರು "monitrc"
SFTP ಯೊಂದಿಗೆ 软件ನಿಮ್ಮ ಲಿನಕ್ಸ್ ಸರ್ವರ್ ಅನ್ನು ನಮೂದಿಸಿದ ನಂತರ, ಮಾನಿಟ್ ಕಾನ್ಫಿಗರೇಶನ್ ಫೈಲ್ ಅನ್ನು ಎಡಿಟ್ ಮಾಡಿ ▼
/etc/monitrc
ಈ "monitrc" ಫೈಲ್ ▼ ಗೆ ಕೆಳಗಿನ ಕಾನ್ಫಿಗರೇಶನ್ ವಿಷಯವನ್ನು ಸೇರಿಸಿ
## ## 陈沩亮博客示例monit配置文件说明: ## 1. 域名以 www.etufo.org 为例。 ## 2. 后面带xxx的均是举例用的名字,需要根据自己的需要修改。 ## ################################################## ############################# ## Monit control file ################################################## ############################# # # 检查周期,默认为2分钟,对于网站来说有点长,可以根据需要自行调节,这改成30秒。 set daemon 30 include /etc/monit.d/* # 日志文件 set logfile /var/log/monit.log # # 邮件通知服务器 # #set mailserver mail.example.com set mailserver localhost with timeout 30 seconds # # 通知邮件的格式设置,下面是默认格式供参考 # ## Monit by default uses the following alert mail format: ## ## --8<-- ## From: monit@$HOST # sender ## Subject: monit alert -- $EVENT $SERVICE # subject ## ## $EVENT Service $SERVICE # ## # ## Date: $DATE # ## Action: $ACTION # ## Host: $HOST # body ## Description: $DESCRIPTION # ## # ## Your faithful employee, # ## monit # ## --8<-- ## ## You can override the alert message format or its parts such as subject ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc. ## are expanded on runtime. For example to override the sender: # # 简单的,这只改了一下发送人,有需要可以自己修改其它内容。 set mail-format { from: admin@xxxx } # 设置邮件通知接收者。建议发到gmail,方便邮件过滤。 set alert xxx@xxxx set httpd port 2812 and #设置http监控页面的端口 use address www.etufo.org # http监控页面的IP或域名 ##allow localhost # 允许本地访问 ##allow 203.82.90.239 # 允许指定IP访问 allow user:password # 访问用户名密码 ################################################## ############################# ## Services ################################################## ############################# # # 系统整体运行状况监控,默认的就可以,可以自己去微调 # # 系统名称,可以是IP或域名 #check system www.etufo.org # if loadavg (1min) > 4 then alert # if loadavg (5min) > 2 then alert # if memory usage > 75% then alert # if cpu usage (user) > 70% then alert # if cpu usage (system) > 30% then alert # if cpu usage (wait) > 20% then alert # 可选的ssl端口的监控,如果有的话 # if failed port 443 type tcpssl protocol http # with timeout 15 seconds # then restart # 监控mariadb check process mysql with pidfile /var/run/mariadb/mariadb.pid start program = "/usr/bin/systemctl start mariadb" stop program = "/usr/bin/systemctl stop mariadb" if failed host 127.0.0.1 port 3306 for 2 cycles then restart if 2 restarts within 4 cycles then timeout # 监控httpd check process httpd with pidfile /var/run/httpd/httpd.pid start program = "/usr/bin/systemctl start httpd" stop program = "/usr/bin/systemctl stop httpd" # if children > 120 for 2 cycles then restart # if failed host localhost port 8080 protocol http for 2 cycles then restart # if 4 restarts within 10 cycles then timeout # 监控nginx check process nginx with pidfile /var/run/nginx.pid start program = "/usr/bin/systemctl start nginx" stop program = "/usr/bin/systemctl stop nginx" # if failed host localhost port 443 protocol http for 2 cycles then restart # if 4 restarts within 10 cycles then timeout # 监控sshd check process sshd with pidfile /var/run/sshd.pid start program = "/usr/bin/systemctl start sshd" stop program = "/usr/bin/systemctl stop sshd" if failed host localhost port 22 protocol ssh for 2 cycles then restart if 4 restarts within 10 cycles then timeout # 监控vesta-nginx check process vesta-nginx with pidfile /var/run/vesta-nginx.pid start program = "/usr/bin/systemctl start vesta" stop program = "/usr/bin/systemctl stop vesta" if failed host localhost port 8083 protocol https for 2 cycles then restart if 4 restarts within 10 cycles then timeout # 监控vesta-php check process vesta-php with pidfile /var/run/vesta-php.pid start program = "/usr/bin/systemctl start vesta" stop program = "/usr/bin/systemctl stop vesta" if failed host localhost port 8083 protocol https for 2 cycles then restart if 4 restarts within 10 cycles then timeout # 监控vsftpd check process vsftpd with match vsftpd start program = "/usr/bin/systemctl start vsftpd" stop program = "/usr/bin/systemctl stop vsftpd" if failed host localhost port 21 protocol ftp for 2 cycles then restart if 4 restarts within 10 cycles then timeout #监控crond check process crond with pidfile /var/run/crond.pid start program = "/usr/bin/systemctl start crond" stop program = "/usr/bin/systemctl stop crond" if 5 restarts within 5 cycles then timeout #监控dovecot check process dovecot with pidfile /var/run/dovecot/master.pid start program = "/usr/bin/systemctl start dovecot" stop program = "/usr/bin/systemctl stop dovecot" if failed host localhost port 143 protocol imap for 2 cycles then restart if 4 restarts within 10 cycles then timeout #监控exim check process exim with pidfile /var/run/exim.pid start program "/usr/bin/systemctl start exim" stop program "/usr/bin/systemctl stop exim" if failed host localhost port 25 protocol smtp for 2 cycles then restart if 4 restarts within 10 cycles then timeout
ನೀವು MONIT ಕಾನ್ಫಿಗರೇಶನ್ ವಿಷಯವನ್ನು ಮಾರ್ಪಡಿಸಿದ್ದರೆ, ಪರಿಣಾಮ ಬೀರಲು ನೀವು Monit ಸೇವೆಯನ್ನು ಮರುಪ್ರಾರಂಭಿಸಬೇಕಾಗುತ್ತದೆ▼
systemctl restart monit
ಜುಲೈ 2018, 5 ನವೀಕರಿಸಿ:
- ಮೇಲಿನ ಕಾನ್ಫಿಗರೇಶನ್ ವಿಷಯ ▲ ಅನ್ನು ಬಳಸಲು ಶಿಫಾರಸು ಮಾಡಲಾಗಿದೆ
- ಮಾನಿಟ್ ಮಾನಿಟರಿಂಗ್ ಸೇವೆಗಾಗಿ ಫೈಲ್ಗಳನ್ನು ರಚಿಸಲು ಕೆಳಗಿನ SSH ಆಜ್ಞೆಗಳನ್ನು ಶಿಫಾರಸು ಮಾಡುವುದಿಲ್ಲ.
cd /etc/monit.d/
git clone https://github.com/infinitnet/vesta-centos7-monit.git ./ && rm -f README.md
myip=1.2.3.4
sed -i 's/host localhost/host '$myip'/g' /etc/monit.d/*.conf
systemctl restart monit
- ನಿಮ್ಮ ಹಂಚಿದ IP ನೊಂದಿಗೆ ಬದಲಾಯಿಸಿ1.2.3.4.
git bash ಆಜ್ಞೆಯನ್ನು ಕಂಡುಹಿಡಿಯಲಾಗಲಿಲ್ಲ ಏಕೆಂದರೆ ದೋಷ ಸಂಭವಿಸಬಹುದು ▼
ಈ ಆಜ್ಞೆಯನ್ನು ನಮೂದಿಸಿದ ನಂತರ ▼ ಎಂದು ಸಹ ಕಾಣಿಸಬಹುದು
sed -i 's/host localhost/host '$myip'/g' /etc/monit.d/*.conf
ಕೆಳಗಿನ ದೋಷ ಸಂದೇಶವು ಕಾಣಿಸಿಕೊಳ್ಳುತ್ತದೆ ▼
sed: can't read /etc/monit.d/*.conf: No such file or directory
ಮಾನಿಟ್ ಲಾಗ್ ವೀಕ್ಷಣೆ ದೋಷ
SSH ವೀಕ್ಷಿಸಿ monit.log ಲಾಗ್ ಫೈಲ್ ಆಜ್ಞೆ▼
tailf /var/log/monit.log
- monit.log ಫೈಲ್ ಅನ್ನು ವೀಕ್ಷಿಸಲು SSH, ಲಾಗ್ಗಳ ಕೊನೆಯ 10 ಸಾಲುಗಳನ್ನು ಮಾತ್ರ ಪ್ರದರ್ಶಿಸಬಹುದು.
SFTP ಲಾಗಿನ್ ಅನ್ನು ಶಿಫಾರಸು ಮಾಡಲಾಗಿದೆ /var/log/monit.log
ಹಿಂದಿನ monit.log ಲಾಗ್ ಫೈಲ್ನ ಸ್ಥಿತಿಯನ್ನು ಸಂಪೂರ್ಣವಾಗಿ ವೀಕ್ಷಿಸಲು.
ಇಮೇಲ್ ಕಳುಹಿಸುವಲ್ಲಿ ದೋಷ
ಮಾನಿಟ್ ಮೇಲ್ ಕಳುಹಿಸಲಾಗದಿದ್ದರೆ, ಈ ಕೆಳಗಿನ ದೋಷ ಸಂದೇಶವು ▼ ಕಾಣಿಸಿಕೊಳ್ಳುತ್ತದೆ
error : Cannot open a connection to the mailserver localhost:25 -- Operation now in progress error : Mail: Delivery failed -- no mail server is available
ಇಮೇಲ್ ಕಳುಹಿಸುವ ದೋಷಗಳನ್ನು ಸರಿಪಡಿಸಿ
ಚೆನ್ ವೈಲಿಯಾಂಗ್ಬಳಸಲು ಶಿಫಾರಸು ಮಾಡಲಾಗಿದೆಜಿಮೈಲ್ SMTP ▼
set mailserver smtp.gmail.com port 587 username "[email protected]" password "password" using tlsv1 with timeout 30 seconds
ಮಾನಿಟ್ ಕಾನ್ಫಿಗರೇಶನ್ ಫೈಲ್ನಲ್ಲಿ ಸೆಟ್ ಮೇಲ್ ಸರ್ವರ್ ಅನ್ನು ಬದಲಾಯಿಸುವುದು ಪರಿಹಾರವಾಗಿದೆ, ದಯವಿಟ್ಟು ವಿವರಗಳಿಗಾಗಿ ಈ ಟ್ಯುಟೋರಿಯಲ್ ಅನ್ನು ಪರಿಶೀಲಿಸಿ ▼
ಫೈಲ್ ಸಿಸ್ಟಮ್ ಅಂಕಿಅಂಶ ದೋಷ
monit.log ಲಾಗ್ ಫೈಲ್ ▼ ನಲ್ಲಿ ಈ ಕೆಳಗಿನ ದೋಷಗಳನ್ನು ನೀವು ಕಂಡುಕೊಂಡರೆ
filesystem statistic error: cannot read /proc/diskstats -- No such file or directory
- ಬಹುಶಃ Linux ಕನಿಷ್ಠ ಅನುಸ್ಥಾಪನೆಗೆ ಡೀಫಾಲ್ಟ್ ಆಗಿರುವುದರಿಂದ ವೆಸ್ಟಾಸಿಪಿಫಲಕ, ಅಸ್ತಿತ್ವದಲ್ಲಿಲ್ಲ
/proc/diskstats
ಡಿಸ್ಕ್ ಸ್ಥಿತಿ ಮಾನಿಟರಿಂಗ್ ಫೈಲ್.
ಫೈಲ್ ಸಿಸ್ಟಮ್ ಅಂಕಿಅಂಶ ದೋಷಗಳನ್ನು ಪರಿಹರಿಸಿ
ಹಂತ 1:SSH ನಲ್ಲಿ /etc/monit.d
ಕ್ಯಾಟಲಾಗ್ ▼
cd /etc/monit.d
ಹಂತ 2:ಮಾನಿಟ್ ಮಾನಿಟರಿಂಗ್ ಸೇವಾ ಫೈಲ್ "root-space.conf" ▼ ಅನ್ನು ಅಳಿಸಿ
rm -rf root-space.conf
ಹಂತ 3:SSH ಮರುಪ್ರಾರಂಭಿಸಿ ಮಾನಿಟ್ ಮಾನಿಟರಿಂಗ್ ▼
systemctl restart monit.service
ಮಾನಿಟ್ ಕಮಾಂಡ್ (CentOS 7 ಗಾಗಿ ವಿಶೇಷ)
ಮಾನಿಟ್ ಆರಂಭಿಕ ಸ್ಥಿತಿಯನ್ನು ವೀಕ್ಷಿಸಿ ▼
systemctl status monit.service
ಮಾನಿಟ್ ಸೇವೆಯನ್ನು ಪ್ರಾರಂಭಿಸಿ ▼
systemctl start monit.service
ಮಾನಿಟ್ ಸೇವೆಯನ್ನು ಮುಚ್ಚಿರಿ▼
systemctl stop monit.service
ಮಾನಿಟ್ ಸೇವೆಯನ್ನು ಮರುಪ್ರಾರಂಭಿಸಿ ▼
systemctl restart monit
ಬೂಟ್ ▼ ನಲ್ಲಿ ಮಾನಿಟ್ ಸೇವೆಯನ್ನು ಪ್ರಾರಂಭಿಸಿ
systemctl enable monit.service
ಮಾನಿಟ್ ಸೇವೆಯನ್ನು ಆನ್ ಮತ್ತು ಆಫ್ ಮಾಡಿ ▼
systemctl disable monit.service
ಹೋಪ್ ಚೆನ್ ವೈಲಿಯಾಂಗ್ ಬ್ಲಾಗ್ ( https://www.chenweiliang.com/ ) ಹಂಚಿಕೊಂಡಿದ್ದಾರೆ "CentOS 7 ಸಿಸ್ಟಂನ ವೆಸ್ಟಾ ಸಿಪಿ ಪ್ಯಾನೆಲ್ನಲ್ಲಿ ಮಾನಿಟ್ ಪ್ರಕ್ರಿಯೆಯನ್ನು ಹೇಗೆ ಕಾನ್ಫಿಗರ್ ಮಾಡುವುದು? , ನಿನಗೆ ಸಹಾಯ ಮಾಡಲು.
ಈ ಲೇಖನದ ಲಿಂಕ್ ಅನ್ನು ಹಂಚಿಕೊಳ್ಳಲು ಸ್ವಾಗತ:https://www.chenweiliang.com/cwl-730.html
ಇತ್ತೀಚಿನ ನವೀಕರಣಗಳನ್ನು ಪಡೆಯಲು ಚೆನ್ ವೈಲಿಯಾಂಗ್ ಅವರ ಬ್ಲಾಗ್ನ ಟೆಲಿಗ್ರಾಮ್ ಚಾನಲ್ಗೆ ಸುಸ್ವಾಗತ!
📚 ಈ ಮಾರ್ಗದರ್ಶಿಯು ದೊಡ್ಡ ಮೌಲ್ಯವನ್ನು ಹೊಂದಿದೆ, 🌟ಇದು ಅಪರೂಪದ ಅವಕಾಶವಾಗಿದೆ, ಇದನ್ನು ತಪ್ಪಿಸಿಕೊಳ್ಳಬೇಡಿ! ⏰⌛💨
ಇಷ್ಟವಾದಲ್ಲಿ ಶೇರ್ ಮಾಡಿ ಮತ್ತು ಲೈಕ್ ಮಾಡಿ!
ನಿಮ್ಮ ಹಂಚಿಕೆ ಮತ್ತು ಇಷ್ಟಗಳು ನಮ್ಮ ನಿರಂತರ ಪ್ರೇರಣೆ!