3 Parses /etc/{nagios{3,},icinga}/objects/*.cfg
5 Authors: Sebastien Aperghis-Tramoni <sebastien@aperghis.net>
6 Raphaƫl Pinson <raphink@gmail.com>
9 This file is licenced under the LGPL v2+, like the rest of Augeas.
14 About: Configuration files
16 This lens applies to /etc/{nagios{3,},icinga}/objects/*.cfg. See <filter>.
19 module NagiosObjects =
26 let keyword = key /[A-Za-z0-9_]+/
28 (* optional, but preferred, whitespace *)
29 let opt_ws = del Rx.opt_space " "
31 (* define an empty line *)
32 let empty = Util.empty
34 (* define a comment *)
35 let comment = Util.comment_generic /[ \t]*[#;][ \t]*/ "# "
39 let field_name = keyword in
40 let field_value = store Rx.space_in in
41 [ Util.indent . field_name . ws
44 (* define an object *)
46 let object_type = keyword in
48 . Util.del_str "define" . ws
49 . object_type . opt_ws
50 . Util.del_str "{" . eol
51 . ( empty | comment | object_field )*
52 . Util.indent . Util.del_str "}" . eol ]
55 let lns = ( empty | comment | object_def )*
57 let filter = incl "/etc/nagios3/objects/*.cfg"
58 . incl "/etc/nagios/objects/*.cfg"
59 . incl "/etc/icinga/objects/*.cfg"
61 let xfm = transform lns filter