3 Parses nagios-nrpe configuration files.
5 Author: Marc Fournier <marc.fournier@camptocamp.com>
8 This file is licensed under the LGPL v2+, like the rest of Augeas.
19 let word = /[^=\n\t ]+/
22 let item_re = /[^#=\n\t\/ ]+/ - (/command\[[^]\/\n]+\]/ | "include" | "include_dir")
25 nrpe.cfg usually has many entries defining commands to run
27 > command[check_foo]=/path/to/nagios/plugin -w 123 -c 456
28 > command[check_bar]=/path/to/another/nagios/plugin --option
31 let obrkt = del /\[/ "[" in
32 let cbrkt = del /\]/ "]" in
34 [ obrkt . key /[^]\/\n]+/ . cbrkt . eq
35 . store /[^\n]+/ . del /\n/ "\n" ]
42 > allow_bash_command_substitution=0
44 let item = [ key item_re . eq . store word . eol ]
49 nrpe.cfg can include more than one file or directory of files
51 > include=/path/to/file1.cfg
52 > include=/path/to/file2.cfg
54 let include = [ key "include" .
55 [ label "file" . eq . store word . eol ]
59 > include_dir=/path/to/dir/
61 let include_dir = [ key "include_dir" .
62 [ label "dir" . eq . store word . eol ]
67 Nrpe comments must start at beginning of line *)
68 let comment = Util.comment_generic /#[ \t]*/ "# "
70 (* blank lines and empty comments *)
71 let empty = Util.empty
75 let lns = ( command | include | include_dir | item | comment | empty ) *
79 let filter = incl "/etc/nrpe.cfg" .
80 incl "/etc/nagios/nrpe.cfg"
82 let xfm = transform lns (filter)