Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / monit.aug
1 (* Monit module for Augeas
2  Author: Free Ekanayaka <free@64studio.com>
3
4  Reference: man monit (1), section "HOW TO MONITOR"
5
6  "A monit control file consists of a series of service entries and
7   global option statements in a free-format, token-oriented syntax.
8
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
12   types of statements:
13
14   1. Global set-statements
15       A global set-statement starts with the keyword set and the item to
16       configure.
17
18   2. Global include-statement
19       The include statement consists of the keyword include and a glob
20       string.
21
22   3. One or more service entry statements.
23        A service entry starts with the keyword check followed by the
24        service type"
25
26 *)
27
28 module Monit =
29
30    autoload xfm
31
32 (************************************************************************
33  *                           USEFUL PRIMITIVES
34  *************************************************************************)
35
36 let spc        = Sep.space
37 let comment    = Util.comment
38 let empty      = Util.empty
39
40 let sto_to_spc = store Rx.space_in
41 let sto_no_spc = store Rx.no_spaces
42
43 let word       = Rx.word
44 let value      = Build.key_value_line word spc sto_to_spc
45
46 (************************************************************************
47  *                               ENTRIES
48  *************************************************************************)
49
50 (* set statement *)
51 let set        = Build.key_value "set" spc value
52
53 (* include statement *)
54 let include    = Build.key_value_line "include" spc sto_to_spc
55
56 (* service statement *)
57 let service    = Build.key_value "check" spc (Build.list value spc)
58
59 let entry      = (set|include|service)
60
61 (************************************************************************
62  *                                LENS
63  *************************************************************************)
64
65 let lns        = (comment|empty|entry) *
66
67 let filter     = incl "/etc/monit/monitrc"
68                . incl "/etc/monitrc"
69
70 let xfm        = transform lns filter