Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / xymon.aug
1 (*
2 Xymon configuration
3 By Jason Kincl - 2012
4 *)
5
6 module Xymon =
7   autoload xfm
8
9 let empty = Util.empty
10 let eol = Util.eol
11 let word = Rx.word
12 let space = Rx.space
13 let ip = Rx.ip 
14 let del_ws_spc = Util.del_ws_spc
15 let value_to_eol = store /[^ \t][^\n]+/
16 let eol_no_spc = Util.del_str "\n"
17
18 let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# "
19 let include = [ key /include|dispinclude|netinclude|directory/ . del_ws_spc . value_to_eol . eol_no_spc ]
20 let title = [ key "title" . del_ws_spc . value_to_eol . eol_no_spc ]
21
22 (* Define host *)
23 let tag = del_ws_spc . [ label "tag" . store /[^ \n\t]+/ ] 
24 let host_ip = [ label "ip" . store ip ]
25 let host_hostname =  [ label "fqdn" . store word ]
26 let host_colon = del /[ \t]*#/ " #"
27 let host = [ label "host" . host_ip . del space " " . host_hostname . host_colon . tag* . eol ] 
28
29 (* Define group-compress and group-only *)
30 let group_extra = del_ws_spc . value_to_eol . eol_no_spc . (comment | empty | host | title)*
31 let group = [ key "group" . group_extra ]
32 let group_compress = [ key "group-compress" . group_extra ]
33 let group_sorted = [ key "group-sorted" . group_extra ]
34
35 let group_only_col = [ label "col" . store Rx.word ]
36 let group_only_cols = del_ws_spc . group_only_col . ( Util.del_str "|" . group_only_col )*
37 let group_only = [ key "group-only" . group_only_cols . group_extra ]
38
39 (* Have to use namespacing because page's title overlaps plain title tag *)
40 let page_name = store word
41 let page_title = [ label "pagetitle" . del_ws_spc . value_to_eol . eol_no_spc ]
42 let page_extra = del_ws_spc . page_name . (page_title | eol_no_spc) . (comment | empty | title | include | host)* 
43                                                                      . (group | group_compress | group_sorted | group_only)*
44 let page = [ key /page|subpage/ . page_extra ]
45
46 let subparent_parent = [ label "parent" . store word ]
47 let subparent = [ key "subparent" . del_ws_spc . subparent_parent . page_extra ]
48
49 let ospage = [ key "ospage" . del_ws_spc . store word . del_ws_spc . [ label "ospagetitle" . value_to_eol . eol_no_spc ] ]
50
51 let lns = (empty | comment | include | host | title | ospage )* . (group | group_compress | group_sorted | group_only)* . (page | subparent)*
52
53 let filter = incl "/etc/xymon/hosts.cfg" . incl "/etc/xymon/pages.cfg"
54
55 let xfm = transform lns filter
56