File: nrpe.aug

package info (click to toggle)
augeas 1.8.0-1+deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 13,496 kB
  • ctags: 7,528
  • sloc: ansic: 73,151; sh: 7,434; yacc: 524; makefile: 429; lex: 210; perl: 42; pascal: 27
file content (85 lines) | stat: -rw-r--r-- 1,827 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
(*
Module: Nrpe
  Parses nagios-nrpe configuration files.

Author: Marc Fournier <marc.fournier@camptocamp.com>

About: License
  This file is licensed under the LGPL v2+, like the rest of Augeas.
*)

module Nrpe =
  autoload xfm


let eol = Util.eol
let eq = Sep.equal

(* View: word *)
let word = /[^=\n\t ]+/

let words = word . ( / +/ . word )*

(* View: item_re *)
let item_re = /[^#=\n\t\/ ]+/ - (/command\[[^]\/\n]+\]/ | "include" | "include_dir")

(* View: command
    nrpe.cfg usually has many entries defining commands to run

    > command[check_foo]=/path/to/nagios/plugin -w 123 -c 456
    > command[check_bar]=/path/to/another/nagios/plugin --option
*)
let command =
  let obrkt = del /\[/ "[" in
  let cbrkt = del /\]/ "]" in
    [ key "command" .
    [ obrkt . key /[^]\/\n]+/ . cbrkt . eq
            . store /[^\n]+/ . del /\n/ "\n" ]
    ]


(* View: item
     regular entries

     > allow_bash_command_substitution=0
*)
let item = [ key item_re . eq . store words . eol ]

(* View: include
    An include entry.

    nrpe.cfg can include more than one file or directory of files

    > include=/path/to/file1.cfg
    > include=/path/to/file2.cfg
*)
let include = [ key "include" .
  [ label "file" . eq . store word . eol ]
]

(* View: include_dir
    > include_dir=/path/to/dir/
*)
let include_dir = [ key "include_dir" .
  [ label "dir" . eq . store word . eol ]
]


(* View: comment
    Nrpe comments must start at beginning of line *)
let comment = Util.comment_generic /#[ \t]*/ "# "

(* blank lines and empty comments *)
let empty = Util.empty

(* View: lns
    The Nrpe lens *)
let lns = ( command | include | include_dir | item | comment | empty ) *

(* View: filter
    File filter *)
let filter = incl "/etc/nrpe.cfg" .
             incl "/etc/nagios/nrpe.cfg"

let xfm = transform lns (filter)