1 (* Monit module for Augeas
2 Author: Free Ekanayaka <free@64studio.com>
4 Reference: man monit (1), section "HOW TO MONITOR"
6 "A monit control file consists of a series of service entries and
7 global option statements in a free-format, token-oriented syntax.
9 Comments begin with a # and extend through the end of the line. There
10 are three kinds of tokens in the control file: grammar keywords, numbers
11 and strings. On a semantic level, the control file consists of three
14 1. Global set-statements
15 A global set-statement starts with the keyword set and the item to
18 2. Global include-statement
19 The include statement consists of the keyword include and a glob
22 3. One or more service entry statements.
23 A service entry starts with the keyword check followed by the
32 (************************************************************************
34 *************************************************************************)
37 let comment = Util.comment
38 let empty = Util.empty
40 let sto_to_spc = store Rx.space_in
41 let sto_no_spc = store Rx.no_spaces
44 let value = Build.key_value_line word spc sto_to_spc
46 (************************************************************************
48 *************************************************************************)
51 let set = Build.key_value "set" spc value
53 (* include statement *)
54 let include = Build.key_value_line "include" spc sto_to_spc
56 (* service statement *)
57 let service = Build.key_value "check" spc (Build.list value spc)
59 let entry = (set|include|service)
61 (************************************************************************
63 *************************************************************************)
65 let lns = (comment|empty|entry) *
67 let filter = incl "/etc/monit/monitrc"
70 let xfm = transform lns filter