3 Parses nagios-nrpe configuration files.
5 Author: Marc Fournier <marc.fournier@camptocamp.com>
8 This file is licensed under the LGPLv2+, like the rest of Augeas.
19 let word = /[^=\n\t ]+/
23 nrpe.cfg usually has many entries defining commands to run
25 > command[check_foo]=/path/to/nagios/plugin -w 123 -c 456
26 > command[check_bar]=/path/to/another/nagios/plugin --option
29 let obrkt = del /\[/ "[" in
30 let cbrkt = del /\]/ "]" in
32 [ obrkt . key /[^]\/\n]+/ . cbrkt . eq
33 . store /[^\n]+/ . del /\n/ "\n" ]
39 let item_re = "server_port"
48 | "connection_timeout"
49 | "allow_weak_random_seed"
55 let item = [ key item_re . eq . store word . eol ]
61 nrpe.cfg can include more than one file or directory of files
63 > include=/path/to/file1.cfg
64 > include=/path/to/file2.cfg
66 let include = [ key "include" .
67 [ label "file" . eq . store word . eol ]
71 > include_dir=/path/to/dir/
73 let include_dir = [ key "include_dir" .
74 [ label "dir" . eq . store word . eol ]
79 Nrpe comments must start at beginning of line *)
80 let comment = Util.comment_generic /#[ \t]*/ "# "
82 (* blank lines and empty comments *)
83 let empty = Util.empty
87 let lns = ( command | item | include | include_dir | comment | empty ) *
91 let filter = Util.stdexcl .
92 incl "/etc/nrpe.cfg" .
93 incl "/etc/nagios/nrpe.cfg"
95 let xfm = transform lns (filter)