Posted by mysql Fri 2nd Mar 2007 09:04 - Syntax is Python - 46 views
Download | New Post | Modify | Hide line numbers
  1. ###############################################################################
  2. ## Monit control file
  3. ###############################################################################
  4. ##
  5. ## Comments begin with a '#' and extend through the end of the line. Keywords
  6. ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
  7. ##
  8. ## Bellow is the example of some frequently used statements. For information
  9. ## about the control file, a complete list of statements and options please
  10. ## have a look in the monit manual.
  11. ##
  12. ##
  13. ###############################################################################
  14. ## Global section
  15. ###############################################################################
  16. ##
  17. ## Start monit in background (run as daemon) and check the services at 2-minute
  18. ## intervals.
  19. #
  20. set daemon  35
  21. #
  22. #
  23. ## Set syslog logging with the 'daemon' facility. If the FACILITY option is
  24. ## omited, monit will use 'user' facility by default. You can specify the
  25. ## path to the file for monit native logging.
  26. #
  27. # set logfile syslog facility log_daemon
  28. #
  29. #
  30. ## Set list of mailservers for alert delivery. Multiple servers may be
  31. ## specified using comma separator. By default monit uses port 25 - it is
  32. ## possible to override it with the PORT option.
  33. #
  34. # set mailserver mail.bar.baz,               # primary mailserver
  35. #                backup.bar.baz port 10025,  # backup mailserver on port 10025
  36. #                localhost                   # fallback relay
  37. #
  38. #
  39. ## By default monit will drop the event alert, in the case that there is no
  40. ## mailserver available. In the case that you want to keep the events for
  41. ## later delivery retry, you can use the EVENTQUEUE statement. The base
  42. ## directory where undelivered events will be stored is specified by the
  43. ## BASEDIR option. You can limit the maximal queue size using the SLOTS
  44. ## option (if omited then the queue is limited just by the backend filesystem).
  45. #
  46. # set eventqueue
  47. #     basedir /var/monit  # set the base directory where events will be stored
  48. #     slots 100           # optionaly limit the queue size
  49. #
  50. #
  51. ## Monit by default uses the following alert mail format:
  52. ##
  53. ## --8<--
  54. ## From: monit@$HOST                         # sender
  55. ## Subject: monit alert --  $EVENT $SERVICE  # subject
  56. ##
  57. ## $EVENT Service $SERVICE                   #
  58. ##                                           #
  59. ##     Date:        $DATE                   #
  60. ##     Action:      $ACTION                 #
  61. ##     Host:        $HOST                   # body
  62. ##     Description: $DESCRIPTION            #
  63. ##                                           #
  64. ## Your faithful employee,                   #
  65. ## monit                                     #
  66. ## --8<--
  67. ##
  68. ## You can override the alert message format or its parts such as subject
  69. ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc.
  70. ## are expanded on runtime. For example to override the sender:
  71. #
  72. # set mail-format { from: }
  73. #
  74. #
  75. ## You can set the alert recipients here, which will receive the alert for
  76. ## each service. The event alerts may be restricted using the list.
  77. #
  78. # set alert                        # receive all alerts
  79. # set alert only on { timeout }  # receive just service-
  80. #                                                # timeout alert
  81. #
  82. #
  83. ## Monit has an embedded webserver, which can be used to view the
  84. ## configuration, actual services parameters or manage the services using the
  85. ## web interface.
  86. #
  87. # set httpd port 2812 and
  88. #     use address localhost  # only accept connection from localhost
  89. #     allow localhost        # allow localhost to connect to the server and
  90. #     allow admin:monit      # require user 'admin' with password 'monit'
  91. #
  92. #
  93. ###############################################################################
  94. ## Services
  95. ###############################################################################
  96. ##
  97. ## Check the general system resources such as load average, cpu and memory
  98. ## usage. Each rule specifies the tested resource, the limit and the action
  99. ## which will be performed in the case that the test failed.
  100. #
  101. #  check system myhost.mydomain.tld
  102. #    if loadavg (1min) > 4 then alert
  103. #    if loadavg (5min) > 2 then alert
  104. #    if memory usage > 75% then alert
  105. #    if cpu usage (user) > 70% then alert
  106. #    if cpu usage (system) > 30% then alert
  107. #    if cpu usage (wait) > 20% then alert
  108. #
  109. #   
  110. ## Check a file for existence, checksum, permissions, uid and gid. In addition
  111. ## to the recipients in the global section, customized alert will be send to
  112. ## the additional recipient. The service may be grouped using the GROUP option.
  113. #   
  114. #  check file apache_bin with path /usr/local/apache/bin/httpd
  115. #    if failed checksum and
  116. #       expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
  117. #    if failed permission 755 then unmonitor
  118. #    if failed uid root then unmonitor
  119. #    if failed gid root then unmonitor
  120. #    alert on {
  121. #           checksum, permission, uid, gid, unmonitor
  122. #        } with the mail-format { subject: Alarm! }
  123. #    group server
  124. #
  125. #   
  126. ## Check that a process is running, responding on the HTTP and HTTPS request,
  127. ## check its resource usage such as cpu and memory, number of childrens.
  128. ## In the case that the process is not running, monit will restart it by
  129. ## default. In the case that the service was restarted very often and the
  130. ## problem remains, it is possible to disable the monitoring using the
  131. ## TIMEOUT statement. The service depends on another service (apache_bin) which
  132. ## is defined in the monit control file as well.
  133. #   
  134.   check process httpd with pidfile /var/run/httpd.pid
  135.     start program = "/etc/init.d/httpd start"
  136.     stop program  = "/etc/init.d/httpd stop"
  137. #    if cpu > 60% for 2 cycles then alert
  138. #    if cpu > 80% for 5 cycles then restart
  139. #    if totalmem > 200.0 MB for 5 cycles then restart
  140. #    if children > 250 then restart
  141. #    if loadavg(5min) greater than 10 for 8 cycles then stop
  142.     if failed host localhost  port 80 protocol http
  143. #       and request "/monit/doc/next.php"
  144.        then restart
  145. #    if failed port 443 type tcpssl protocol http
  146. #       with timeout 15 seconds
  147. #       then restart
  148. #    if 3 restarts within 5 cycles then timeout
  149. #    depends on apache_bin
  150. #    group server
  151. #   
  152.  
  153. check process mysqld with pidfile /var/run/mysqld/mysqld.pid
  154. start program = "/etc/init.d/mysqld start"
  155. stop program = "/etc/init.d/mysqld stop"
  156. if failed host 127.0.0.1 port 3306 then restart
  157.  
  158.  
  159. ## Check the device permissions, uid, gid, space and inode usage. Other
  160. ## services such as databases may depend on this resource and automatical
  161. ## graceful stop may be cascaded to them before the filesystem will become
  162. ## full and the data will be lost.
  163. #
  164. #  check device datafs with path /dev/sdb1
  165. #    start program  = "/bin/mount /data"
  166. #    stop program  = "/bin/umount /data"
  167. #    if failed permission 660 then unmonitor
  168. #    if failed uid root then unmonitor
  169. #    if failed gid disk then unmonitor
  170. #    if space usage > 80% for 5 times within 15 cycles then alert
  171. #    if space usage > 99% then stop
  172. #    if inode usage > 30000 then alert
  173. #    if inode usage > 99% then stop
  174. #    group server
  175. #
  176. #
  177. ## Check a file's timestamp: when it becomes older then 15 minutes, the
  178. ## file is not updated and something is wrong. In the case that the size
  179. ## of the file exceeded given limit, perform the script.
  180. #
  181. #  check file database with path /data/mydatabase.db
  182. #    if failed permission 700 then alert
  183. #    if failed uid data then alert
  184. #    if failed gid data then alert
  185. #    if timestamp > 15 minutes then alert
  186. #    if size > 100 MB then exec "/my/cleanup/script"
  187. #
  188. #
  189. ## Check the directory permission, uid and gid.  An event is triggered
  190. ## if the directory does not belong to the user with the  uid 0 and
  191. ## the gid 0.  In the addition the permissions have to match the octal
  192. ## description of 755 (see chmod(1)).
  193. #
  194. #  check directory bin with path /bin
  195. #    if failed permission 755 then unmonitor
  196. #    if failed uid 0 then unmonitor
  197. #    if failed gid 0 then unmonitor
  198. #
  199. #
  200. ## Check the remote host network services availability and the response
  201. ## content.  One of three pings, a successfull connection to a port and
  202. ## application level network check is performed.
  203. #
  204. #  check host myserver with address
  205. #    if failed icmp type echo count 3 with timeout 3 seconds then alert
  206. #    if failed port 3306 protocol mysql with timeout 15 seconds then alert
  207. #    if failed url
  208. #       http://user::8080/?querystring
  209. #       and content == 'action="j_security_check"'
  210. #       then alert
  211. #
  212. #
  213. ###############################################################################
  214. ## Includes
  215. ###############################################################################
  216. ##
  217. ## It is possible to include the configuration or its parts from other files or
  218. ## directories.
  219. #
  220. #  include /etc/monit.d/*
  221. #
  222. #
  223.  

PermaLink to this entry https://pastebin.co.uk/11286
Posted by mysql Fri 2nd Mar 2007 09:04 - Syntax is Python - 46 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0