Advertisement
Guest User

monit default config

a guest
Oct 24th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.69 KB | None | 0 0
  1. # Monit control file
  2. #
  3. # Comments begin with a '#' and extend through the end of the line.
  4. # Blank lines between program entries are ignored. Keywords are case
  5. # insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'
  6. #
  7. # Legal keywords are
  8. # check -- Must be followed by the type of monitored service
  9. # {device|directory|file|process} and a descriptive
  10. # name for the service.
  11. #
  12. # pidfile -- Must be followed by a path to a process pidfile.
  13. # Such a file should contain only one entry, a number
  14. # representing the process pid. (See the apache pid
  15. # file for an example).
  16. #
  17. # path -- Must be followed by a path to the block special file
  18. # for filesystem (device), regular file or directory.
  19. #
  20. # group -- Must be followed by a descriptive name for a monitored
  21. # services group. This statement can be used to group
  22. # together several services. Monit can start/stop/restart a
  23. # group of services.
  24. #
  25. # start -- Must be followed by a full path to a program for
  26. # starting the service. If you need to specify arguments
  27. # to the program, enclose the program and arguments in
  28. # quotes - like: "/local/bin/program -i start".
  29. #
  30. # stop -- Must be followed by a full path to a program for
  31. # stopping the service. If you need to specify arguments
  32. # to the program, enclose the program and arguments in
  33. # quotes - like: "/local/bin/program -i stop".
  34. #
  35. # uid -- Must be followed by a user (name or uid number). This
  36. # statement is an optionally part of the start/stop
  37. # statement described above (if so, it makes monit start
  38. # the program as the user given in the uid). uid can also
  39. # be used as a standalone statement in a file service
  40. # check entry to check for changes in uid.
  41. #
  42. # gid -- Must be followed by a group (name or gid number). This
  43. # statement is an optionally part of the start/stop
  44. # statement described above (if so, it makes monit start
  45. # the program as the group given in the gid). gid can also
  46. # be used as a standalone statement in a file service
  47. # check entry to check for changes in gid.
  48. #
  49. # pid -- This statement is an optionally part of process service
  50. # check entry to override default alert action in the case
  51. # of pid change.
  52. #
  53. # ppid -- This statement is an optionally part of process service
  54. # check entry to override default alert action in the case
  55. # of parent pid change.
  56. #
  57. # host -- Specify a hostname or an ip-address to test port
  58. # connection at. This statement must be followed by a
  59. # port statement.
  60. #
  61. # port(number) -- Must be followed by an integer representing a portnumber.
  62. # The monit program will try to connect to this port to
  63. # to verify that there is a server listening behind the
  64. # portnumber.
  65. #
  66. # unix(socket) -- Must be followed by a string representing a pathname.
  67. # The monit program will try to connect to this socket to
  68. # to verify that there is a server listening behind the
  69. # unix socket.
  70. #
  71. # type -- Must be followed by the keyword udp or tcp. This keyword
  72. # specifies the type of socket the monit program should
  73. # use when testing the connection to the portnumber. If the
  74. # type keyword is omitted, tcp is used.
  75. #
  76. # tcp -- Specifies that monit should use a TCP socket type
  77. # (stream socket) when testing the port
  78. #
  79. # tcpssl -- Specifies that monit should use a TCP socket type
  80. # (stream socket) with ssl when testing the port.
  81. #
  82. # certmd5 -- The md5 sum of a certificate a ssl forged
  83. # server has to deliver.
  84. #
  85. # udp -- Specifies that monit should use a UDP socket type
  86. # (datagram socket) when testing the port
  87. #
  88. # protocol -- Must be followed by a protocol keyword. This keyword
  89. # specifies the type of service found at the port.
  90. # monit knows how to speak many standard protocols, e.g.
  91. # HTTP, SMTP, and FTP. See the monit man file for the
  92. # complete protocol list. If no protocol is specified
  93. # monit will use a default test which in most cases is
  94. # good enough to test if a server is up or down.
  95. #
  96. # request -- Must be followed by a request string specifying a
  97. # document or entity to fetch from the server. Currently
  98. # only the HTTP protocol module supports the request
  99. # statement, such as: "/data/show.php?a=b&c=d"
  100. # send/expect -- These keywords specify a generic protocol. Both require
  101. # a string whether to be sent or to be matched against (as
  102. # extended regex if supported).
  103. #
  104. # timeout -- Part of the timeout statement or used in a connection
  105. # statement for connect timeout.
  106. #
  107. # alert -- Specifies an email address for notification if an
  108. # error occured on a service. This statement is optional.
  109. # More than one alert statement is allowed.
  110. #
  111. # checksum -- Used in a file check entry to test the file for
  112. # checksum changes. See the monit man file for more
  113. # information.
  114. #
  115. # expect -- Specify a md5 string digest monit should expect when
  116. # testing a particular file's checksum. This statement is
  117. # an optional part of the checksum statement.
  118. #
  119. # timestamp -- Must be followed by compare operator, number, optional
  120. # a time unit and an action.
  121. #
  122. # size -- Must be followed by compare operator, number, optional
  123. # a size unit and an action.
  124. #
  125. # every -- Only check the service at every n cycles.
  126. #
  127. # mode -- Must be followed either by the keyword active, passive
  128. # or manual. If active, monit will restart the service
  129. # if it is not running (this is the default behaviour).
  130. # If passive, monit will only monitor and send alerts
  131. # (resource related restart and stop options are ignored
  132. # in this mode also). If manual, monit will enter active
  133. # mode only if service was brough under monit's control
  134. # otherwise the service isn't monitored.
  135. #
  136. # cpu -- Must be followed by a compare operator, a number with
  137. # percent {%|percent}, optionally a maximum number of
  138. # cycles and an action. This statement is used to check
  139. # the cpu usage in percent of a process with its children
  140. # over a number of cycles. If the compare expression
  141. # matches then the action is executed.
  142. #
  143. # mem -- The equivalent to cpu usage for memory of a process
  144. # (w/o children!). The syntax is equivilent to cpu,
  145. # but additionally amount units are accepted, expressed in
  146. # {B|KB|MB|GB|%|byte|kilobyte|megabyte|gigabyte|
  147. # percent}
  148. #
  149. # children -- Must be followed by a number without unit. It
  150. # represents number of child processes. The syntax is
  151. # equivilent to cpu,
  152. #
  153. # totalmem -- The equivalent to mem for memory of a process
  154. # (with children!). The syntax is the same
  155. #
  156. # loadavg -- Must be followed by [1min,5min,15min] in (), a
  157. # compare operator, a number, optionally a
  158. # maximum number of cycles and an action. This statement
  159. # is used to check the system load average over a number
  160. # of cycles. If the compare expression matches then the
  161. # action (restart, alert, exec, stop or unmonitor) is
  162. # executed.
  163. #
  164. # space -- Must be followed by a compare operator, number,
  165. # unit and action, where the unit is expressed in one of
  166. # {B|KB|MB|GB|%|byte|kilobyte|megabyte|gigabyte|percent}
  167. #
  168. # inode(s) -- Must be followed by a compare operator, integer number,
  169. # optionaly by a percent sign (if not, the limit is
  170. # absolute) and an action (required).
  171. #
  172. # perm(ission) -- Must be followed by an octal number describing
  173. # the permissions monit should expect for a file, directory
  174. # or device.
  175. #
  176. # depends -- Must be followed by the name of a service or a list of
  177. # services *this* service depends on to run before it
  178. # services *this* service depends on to run before it
  179. # starts. The list of depend services will be stopped
  180. # before the current service is started and started again
  181. # after.
  182. #
  183. # Legal global option statements are
  184. #
  185. # set daemon -- Must be followed by a number (in seconds)
  186. #
  187. # set init -- If specified, do not background monit. This allows
  188. # init to control and restart monit. To work properly,
  189. # modification of /etc/inittab is required.
  190. # (see the FAQ.txt for details)
  191. #
  192. # set logfile -- Must be followed by either a filename (full path is
  193. # required) or the string 'syslog'. If 'syslog' is used,
  194. # it can be optionally followed by 'facility <facility>'
  195. # where <facility> is one of 'log_local0' - 'log_local7'
  196. # or 'log_daemon'. If no facility is set it will default
  197. # to LOG_USER
  198. #
  199. # set pidfile -- Must be followed by a filename (full path is
  200. # required) specifying the pid file for a monit daemon.
  201. # See the manual for default value if not specified.
  202. #
  203. # set statefile -- Must be followed by a filename (full path is
  204. # required) specifying where monit should store
  205. # its state file. If not defined monit will use
  206. # the file, $HOME/.monit.state
  207. #
  208. # set mailserver -- Must be followed by one or more mail server hostnames.
  209. # If a mailserver is not defined, monit will try to use
  210. # 'localhost' as the smtp-server for sending mail
  211. # notification.
  212. #
  213. # set mail-format - Must be followed by a mail format list containing at
  214. # least one of the keywords; from: subject: or message:
  215. #
  216. # set alert -- Specifies an global email address for notification if an
  217. # error occured on any service. This statement is optional.
  218. # More than one alert statement is allowed.
  219. #
  220. # set httpd port -- Must be followed by a portnumber for the monit http
  221. # set httpd port -- Must be followed by a portnumber for the monit http
  222. # server.
  223. #
  224. # ssl enable -- Enables ssl support for the httpd server.
  225. # It requires the use of the pemfile statement.
  226. #
  227. # ssl disable -- Disables ssl support for the httpd server.
  228. # It is equal to omitting any ssl statement.
  229. #
  230. # signature enable -- Enables http server version signature
  231. #
  232. # signature disable - Disables http server version signature
  233. #
  234. # address -- If specified, the http server will only accept connect
  235. # requests to this addresses This statement is an optional
  236. # part of the set httpd statement.
  237. #
  238. #
  239. # pemfile -- Specifies the file with the private key and the
  240. # certificate for ssl support
  241. #
  242. # allow -- Specify a hostnames or IP addresses allowed to connect
  243. # to the http server (one allow statement per host)
  244. # and/or
  245. # allow -- Specify a username:password in clear text for
  246. # connecting to monit httpd
  247. # and/or
  248. # allow -- Specify a "htpasswd" styled file in clear text,
  249. # MD5 or crypt for for users to connect to monit httpd
  250. # Attention: at least one clear text user credential
  251. # is necessary for the command line interface to
  252. # connect to monit
  253. #
  254. # include -- include a file or files matching the globstring
  255. #
  256. #
  257. # The noise keywords `is', `as', `are', `for', `and', `the', `with',
  258. # `has', `using', `use', `on(ly)', `with(in)', `was', `than`, `usage'
  259. # and `program(s)' are ignored anywhere in an entry; they can be used
  260. # to make it resemble English. The punctuation characters `,' `;' and
  261. # '=' are also ignored.
  262. #
  263. #
  264. ## Here's an example for monitoring an apache web-server on port
  265. ## HTTP and HTTPS, Sybase Database Server and various filesystems:
  266. #
  267. ## [NB! Check and edit for your system and uncomment below]
  268. #
  269. ## Poll at 2-minute intervals.
  270. # set daemon 120
  271. #
  272. ## Set syslog logging.
  273. # set logfile syslog facility log_daemon
  274. #
  275. ## Set localhost as a fall back server if the primary and backup mailserver
  276. ## fails.
  277. # set mailserver mail.bar.baz,
  278. # backup.bar.baz port 10025,
  279. # localhost
  280. #
  281. ## Set a default mail from-address for all alert messages emitted by monit.
  282. # set mail-format { from: monit@foo.bar }
  283. #
  284. ## Send alert to system admin on any event
  285. # set alert sysadm@foo.bar
  286. #
  287. ## Make monit start its web-server.
  288. set httpd port 2812
  289. use address localhost # and only accept connection from localhost
  290. allow localhost # allow localhost to connect to the server and
  291. allow admin:monit # user 'admin' with password 'monit'
  292. #
  293. # check process apache with pidfile /usr/local/apache/logs/httpd.pid
  294. # start program = "/etc/init.d/httpd start"
  295. # stop program = "/etc/init.d/httpd stop"
  296. # if failed host www.tildeslash.com port 80 protocol http
  297. # and request "/monit/next.html" then restart
  298. # if failed port 443 type tcpssl proto http with timeout 15 seconds
  299. # then restart
  300. # if cpu is greater than 60% for 2 cycles then alert
  301. # if cpu > 80% for 5 cycles then restart
  302. # if totalmem > 200.0 MB for 5 cycles then restart
  303. # if children > 250 then restart
  304. # if loadavg(5min) greater than 10 for 8 cycles then stop
  305. # if 3 restarts within 5 cycles then timeout
  306. # group server
  307. #
  308. #
  309. # check file apache_bin with path /usr/local/apache/bin/httpd
  310. # if failed checksum and
  311. # expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
  312. # if failed permission 755 then unmonitor
  313. # if failed uid root then unmonitor
  314. # if failed gid root then unmonitor
  315. # alert security@foo.bar on {
  316. # checksum, permission, uid, gid, unmonitor
  317. # } with the mail-format { subject: Alarm! }
  318. # group server
  319. #
  320. #
  321. # check process sybase with pidfile /var/run/sybase.pid
  322. # start program = "/etc/init.d/sybase start"
  323. # stop program = "/etc/init.d/sybase stop"
  324. # if failed port 4001 then restart
  325. # if 2 restarts within 3 cycles then timeout
  326. # group server
  327. # mode passive
  328. # depends on datafs
  329. #
  330. #
  331. # check device datafs with path /dev/sdb1
  332. # start program = "/bin/mount /data"
  333. # stop program = "/bin/umount /data"
  334. # if failed permission 660 then unmonitor
  335. # if failed uid root then unmonitor
  336. # if failed gid disk then unmonitor
  337. # if space usage > 80% then alert
  338. # if space usage > 99% then stop
  339. # if inode usage > 80% then alert
  340. # if inode usage > 99% then stop
  341. # group server
  342. #
  343. #
  344. # check device rootfs with path /dev/sda1
  345. # if failed permission 660 then unmonitor
  346. # if failed uid root then unmonitor
  347. # if failed gid disk then unmonitor
  348. # if space usage > 3 GB then alert
  349. # if inode usage > 30000 then alert
  350. # mode passive
  351. #
  352. #
  353. # check file database with path /data/mydatabase.db
  354. # if failed permission 700 then alert
  355. # if failed uid data then alert
  356. # if failed gid data then alert
  357. # if timestamp > 15 minutes then alert
  358. # if size > 100 MB then alert
  359. # else if recovered then exec "/check/my/db"
  360. #
  361. #
  362. # check directory bin with path /bin
  363. # if failed permission 755 then unmonitor
  364. # if failed uid 0 then unmonitor
  365. # if failed gid 0 then unmonitor
  366. #
  367. #
  368. # check host myserver with address 192.168.1.1
  369. # if failed icmp type echo with timeout 3 seconds then alert
  370. # if failed port 3306 then alert
  371. # if failed port 80 protocol http then alert
  372. # if failed port 443 type tcpssl protocol http
  373. # with timeout 15 seconds then alert
  374. # if failed host virtual.web.org port 80 protocol http
  375. # and request "/help/info.html" then alert
  376. #
  377. # include /etc/monit/mysql.monitrc
  378. # include /etc/monit/mail/*.monitrc
  379. #
  380. # check file foobar with path /somewhere
  381. # include /etc/monit/defaultfile.monitrc
  382. #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement