北京SEO

monit配置监控启动nginx php mysql redis mongodb 服务器

2019/10/10/17:47:16  阅读:1841  来源:谷歌SEO算法  标签: SEO教程

下面来看一个整理的monit配置监控启动nginx php mysql redis mongodb 服务器例子,我们这样监控之后可以保证服务器永不宕机,是不是非常的不错呀.

启动:monit -Ic /etc/monitrc &

crontab -e

*/600 * * * * /usr/local/bin/monit -Ic /etc/monitrc &

conf 配置:

  1. —————nginxphpmysqlredismongodb配置完美OK——————–
  2. #nginx
  3. checkprocessnginxwithpidfile/usr/local/nginx/logs/nginx.pid
  4. startprogram=“/usr/local/nginx/sbin/nginx”
  5. stopprogram=“/usr/bin/killallnginx”
  6. iffailedhost127.0.0.1port80thenrestart
  7. ifcpuisgreaterthan40%for2cyclesthenalert
  8. ifcpu>60%for5cyclesthenrestart
  9. if10restartswithin10cyclesthentimeout
  10. #php5-fpm
  11. checkprocessphp-fpmwithpidfile/var/run/php-fpm.pid
  12. startprogram=“/usr/local/php5.3/sbin/php-fpm”
  13. stopprogram=“/usr/bin/killallphp-fpm”
  14. iffailedport9000thenrestart
  15. ifcpuisgreaterthan40%for2cyclesthenalert
  16. ifcpu>60%for5cyclesthenrestart
  17. if10restartswithin10cyclesthentimeout#php5-fpmbinary.
  18. checkfilephp5-fpm-tcp_binwithpath/usr/local/php5.3/sbin/php-fpm
  19. if10restartswithin10cyclesthentimeout
  20. iffailedchecksumthenunmonitor
  21. iffailedpermission755thenunmonitor
  22. iffaileduidrootthenunmonitor
  23. iffailedgidrootthenunmonitor
  24. alertroot@localhost#Testtheinitscripts.
  25. checkfilephp5-fpm-tcp_initwithpath/usr/local/php5.3/sbin/php-fpm
  26. iffailedchecksumthenunmonitor
  27. iffailedpermission755thenunmonitor
  28. iffaileduidrootthenunmonitor
  29. iffailedgidrootthenunmonitor
  30. alertroot@localhost
  31. #mysql
  32. checkprocessmysqlwithpidfile/var/lib/mysql/localhost.localdomain.pid
  33. groupdatabase
  34. startprogram=“/sbin/servicemysqlstart”
  35. stopprogram=“/sbin/servicemysqlstop”
  36. iffailedport8306thenrestart
  37. if3restartswithin10cyclesthentimeout
  38. #redis
  39. checkprocessrediswithpidfile/var/run/redis.pid
  40. startprogram=“/usr/local/redis/redis-server/usr/local/redis/redis.conf”
  41. stopprogram=“/usr/bin/killallredis-server”
  42. iffailedhost127.0.0.1port6379thenrestart
  43. ifcpuisgreaterthan40%for2cyclesthenalert
  44. ifcpu>60%for5cyclesthenrestart
  45. if10restartswithin10cyclesthentimeout
  46. #mongodb
  47. checkprocessmongodwithpidfile/usr/local/mongodb/data/mongod.lock
  48. startprogram=“/usr/local/mongodb/bin/mongod–dbpath=/usr/local/mongodb/data/”
  49. stopprogram=“/usr/bin/killallmongod”
  50. iffailedport27017protocolhttpandrequest“/”withtimeout10secondsthenrestart
  51. if10restartswithin10cyclesthentimeout
  52. —————-end——————-
  53. /usr/local/mmonit/bin/mmonit-c/usr/local/mmonit/conf/server.xml-t
  54. /usr/local/mmonit/bin/mmonit-c/usr/local/mmonit/conf/server.xmlstart
  55. monit-t
  56. killallmonit
  57. monit-Ic/etc/monitrc&
  58. telinitq
  59. psaux|grepmonit
  60. kill-11
  61. psaux|grepredis-server
  62. killallredis-server
  63. ll/var/run/redis.pid
  64. /usr/local/redis/redis-server/usr/local/redis/redis.conf&
  65. psaux|grepphp-fpm
  66. killallphp-fpm
  67. /usr/local/php5.3/sbin/php-fpm
  68. psaux|grepmongod
  69. killallmongod
  70. /usr/local/mongodb/bin/mongod–dbpath=/usr/local/mongodb/data/&
  71. setmmonithttp://monit:monit@142.4.48.50:8080/collector
  72. setnginxport80and
  73. useaddress142.4.48.50
  74. allowlocalhost
  75. allow142.4.48.50
  76. http://mmonit.com/wiki/Monit/Nginx
  77. location/monit/{
  78. rewrite^/monit/(.*)/$1break;
  79. proxy_ignore_client_aborton;
  80. proxy_passhttp://192.168.1.10:2812;
  81. proxy_redirecthttp://192.168.1.10:2812/monit;
  82. }
  83. https://gist.github.com/franck
  84. #include/etc/monit.d/*
  85. #mysql
  86. checkprocessmysqldwithpidfile/var/lib/mysql/localhost.localdomain.pid
  87. groupdatabase
  88. startprogram=“/etc/init.d/mysqlstart”
  89. stopprogram=“/etc/init.d/mysqlstop”
  90. iffailedhost127.0.0.1port8306thenrestart
  91. if5restartswithin5cyclesthentimeout
  92. #nginx
  93. checkprocessnginxwithpidfile/usr/local/nginx/logs/nginx.pid
  94. startprogram=“/usr/local/nginx/sbin/nginx”
  95. stopprogram=“/usr/bin/killallnginx”
  96. iffailedhost127.0.0.1port80thenrestart
  97. ifcpuisgreaterthan40%for2cyclesthenalert
  98. ifcpu>60%for5cyclesthenrestart
  99. if10restartswithin10cyclesthentimeout
  100. #redis
  101. checkprocessrediswithpidfile/var/run/redis.pid
  102. startprogram=“/usr/local/redis/redis-server/usr/local/redis/redis.conf”
  103. stopprogram=“/usr/bin/killallredis-server”
  104. if10restartswithin10cyclesthentimeout
  105. checkfiledump.rdbwithpath/usr/local/redis/dump.rdb
  106. ifsize>100MBthenalert
  107. #php5-fpm
  108. checkprocessphp-fpmwithpidfile/var/run/php-fpm.pid
  109. startprogram=“/usr/local/php5.3/sbin/php-fpm”
  110. stopprogram=“/usr/bin/killallphp-fpm”
  111. iffailedhost127.0.0.1port9000thenrestart
  112. ifcpuisgreaterthan40%for2cyclesthenalert
  113. ifcpu>60%for5cyclesthenrestart
  114. if10restartswithin10cyclesthentimeout
  115. #php5-fpmbinary.
  116. checkfilephp5-fpm-tcp_binwithpath/usr/local/php5.3/sbin/php-fpm
  117. if10restartswithin10cyclesthentimeout
  118. iffailedchecksumthenunmonitor
  119. iffailedpermission755thenunmonitor
  120. iffaileduidrootthenunmonitor
  121. iffailedgidrootthenunmonitor
  122. alertroot@localhost
  123. #Testtheinitscripts.
  124. checkfilephp5-fpm-tcp_initwithpath/usr/local/php5.3/sbin/php-fpm
  125. iffailedchecksumthenunmonitor
  126. iffailedpermission755thenunmonitor
  127. iffaileduidrootthenunmonitor
  128. iffailedgidrootthenunmonitor
  129. alertroot@localhost
  130. #mysql
  131. checkprocessmysqldwithpidfile/var/lib/mysql/localhost.localdomain.pid
  132. groupdatabase
  133. startprogram=“/sbin/servicemysqlstart”
  134. stopprogram=“/sbin/servicemysqlstop”
  135. iffailedhost127.0.0.1port8306thenrestart
  136. if2restartswithin6cyclesthentimeout
  137. #mongodb
  138. checkprocessmongodwithpidfile/usr/local/mongodb/data/mongod.lock
  139. startprogram=“/usr/local/mongodb/bin/mongod–dbpath=/usr/local/mongodb/data/”
  140. stopprogram=“/usr/bin/killallmongod”
  141. iffailedport27017protocolhttpandrequest“/”withtimeout10secondsthenrestart
  142. if10restartswithin10cyclesthentimeout
  143. #mongodb
  144. checkprocessmongodwithpidfile“/usr/local/mongodb/data/mongod.lock”
  145. startprogram=“/usr/local/mongodb/bin/mongod–dbpath=/usr/local/mongodb/data/”
  146. stopprogram=“/usr/bin/killallmongod”
  147. iffailedport27017protocolhttpandrequest“/”withtimeout10secondsthenrestart
  148. if5restartswithin5cyclesthentimeout
  149. #tomcat
  150. checkprocesstomcatwithpidfile/var/run/tomcat/tomcat.pid
  151. startprogram=“/etc/init.d/tomcatstart”
  152. asuidsolrgidsolr
  153. stopprogram=“/etc/init.d/tomcatstop”
  154. asuidsolrgidsolr//phpfensi.com
  155. iffailedport8080thenalert
  156. iffailedport8080for5cyclesthenrestart
  157. setmmonithttp://monit:monit@142.4.48.50:8080/collector
  158. sethttpdport12112and
  159. useaddress142.4.48.50//monit主机的IP
  160. allowlocalhost
  161. allow142.4.48.50//mmonit主机的IP

广告内容

monit配置监控启动nginx php mysql redis mongodb 服务器 monit配置监控启动nginx php mysql redis mongodb 服务器 monit配置监控启动nginx php mysql redis mongodb 服务器

相关阅读

热门评论

木木老贼 木木老贼

互联网营销达人~

总篇数181

精选文章

RMAN中catalog和nocatalog区别介绍 小技巧:为Linux下的文件分配多个权限 zimbra8.5.1安装第三方签名ssl证书的步骤 解决mysql不能远程连接数据库方法 windows服务器mysql增量备份批处理数据库 mysql中slow query log慢日志查询分析 JavaScript跨域问题总结 Linux下负载均衡软件LVS配置(VS/DR)教程 mysql中权限参数说明 MYSQL(错误1053)无法正常启动

SEO最新算法