|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: NagiosConfig
|
|
Packit Service |
a2ae7a |
Parses /etc/{nagios{3,},icinga}/*.cfg
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Authors: Sebastien Aperghis-Tramoni <sebastien@aperghis.net>
|
|
Packit Service |
a2ae7a |
Raphaƫl Pinson <raphink@gmail.com>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: License
|
|
Packit Service |
a2ae7a |
This file is licenced under the LGPL v2+, like the rest of Augeas.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Lens Usage
|
|
Packit Service |
a2ae7a |
To be documented
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Configuration files
|
|
Packit Service |
a2ae7a |
This lens applies to /etc/{nagios{3,},icinga}/*.cfg. See <filter>.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module NagiosCfg =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: Utility variables/functions
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
(* View: param_def
|
|
Packit Service |
a2ae7a |
define a field *)
|
|
Packit Service |
a2ae7a |
let param_def =
|
|
Packit Service |
a2ae7a |
let space_in = /[^ \t\n][^\n=]*[^ \t\n]|[^ \t\n]/
|
|
Packit Service |
a2ae7a |
in key /[A-Za-z0-9_]+/
|
|
Packit Service |
a2ae7a |
. Sep.opt_space . Sep.equal . Sep.opt_space
|
|
Packit Service |
a2ae7a |
. store space_in
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: macro_def
|
|
Packit Service |
a2ae7a |
Macro line, as used in resource.cfg *)
|
|
Packit Service |
a2ae7a |
let macro_def =
|
|
Packit Service |
a2ae7a |
let macro = /\$[A-Za-z0-9]+\$/
|
|
Packit Service |
a2ae7a |
in let macro_decl = Rx.word | Rx.fspath
|
|
Packit Service |
a2ae7a |
in key macro . Sep.space_equal . store macro_decl
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: Entries
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
(* View: param
|
|
Packit Service |
a2ae7a |
Params can have sub params *)
|
|
Packit Service |
a2ae7a |
let param =
|
|
Packit Service |
a2ae7a |
[ Util.indent . param_def
|
|
Packit Service |
a2ae7a |
. [ Sep.space . param_def ]*
|
|
Packit Service |
a2ae7a |
. Util.eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: macro *)
|
|
Packit Service |
a2ae7a |
let macro = [ Util.indent . macro_def . Util.eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: Lens
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
(* View: entry
|
|
Packit Service |
a2ae7a |
Define the accepted entries, such as param for regular configuration
|
|
Packit Service |
a2ae7a |
files, and macro for resources.cfg .*)
|
|
Packit Service |
a2ae7a |
let entry = param
|
|
Packit Service |
a2ae7a |
| macro
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: lns
|
|
Packit Service |
a2ae7a |
main structure *)
|
|
Packit Service |
a2ae7a |
let lns = ( Util.empty | Util.comment | entry )*
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: filter *)
|
|
Packit Service |
a2ae7a |
let filter = incl "/etc/nagios3/*.cfg"
|
|
Packit Service |
a2ae7a |
. incl "/etc/nagios/*.cfg"
|
|
Packit Service |
a2ae7a |
. incl "/etc/icinga/*.cfg"
|
|
Packit Service |
a2ae7a |
. excl "/etc/nagios3/commands.cfg"
|
|
Packit Service |
a2ae7a |
. excl "/etc/nagios/commands.cfg"
|
|
Packit Service |
a2ae7a |
. excl "/etc/nagios/nrpe.cfg"
|
|
Packit Service |
a2ae7a |
. incl "/etc/icinga/commands.cfg"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|