Xymon_Alerting

Parses xymon alerting files

Author: Francois Maillard fmai.nosp@m.llard@gmai.nosp@m.l.com

Summary
Xymon_AlertingParses xymon alerting files
ReferenceThis lens tries to keep as close as possible to `man 5 alerts.cfg` where possible.
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Not supportedFile inclusion are not followed
Configuration filesThis lens applies to /etc/xymon/alerts.d/*.cfg and /etc/xymon/alerts.cfg.
ExamplesThe Test_Xymon_Alerting file contains various examples and tests.
USEFUL PRIMITIVES
store_word
comparison The greater and lesser than operators
equal
ws
eol
ws_or_eol
comment
empty
include
MACRO DEFINITION
macrodefinitionA string that starts with $ and that is assigned something
flagA flag value
kw_wordA key=value value
FILTERS
pageThe (ex)?page filter definition
groupThe (ex)?group filter definition
hostThe (ex)?host filter definition
serviceThe (ex)?service filter definition
colorThe color filter definition
timeThe time filter definition
durationThe duration filter definition
recoverThe recover filter definition
noticeThe notice filter definition
rule_filterFilters are made out of any of the above filter definitions
filtersOne or more filters
filters_optZero, one or more filters
kw_word_filters_optA kw_word entry with optional filters
flag_filters_optA flag with optional filters
RECIPIENTS
mailThe mail recipient definition
scriptThe script recipient definition
ignoreThe ignore recipient definition
formatThe format recipient definition
repeatThe repeat recipient definition
unmatchedThe unmatched recipient definition
stopThe stop recipient definition
macroThe macro recipient definition
recipientRecipients are made out of any of the above recipient definitions
RULES
ruleRules are made of rule_filter and then recipients sperarated by a whitespace
lnsThe Xymon_Alerting lens
filter

Reference

This lens tries to keep as close as possible to `man 5 alerts.cfg` where possible.

License

This file is licenced under the LGPL v2+, like the rest of Augeas.

Lens Usage

To be documented

Not supported

File inclusion are not followed

Configuration files

This lens applies to /etc/xymon/alerts.d/*.cfg and /etc/xymon/alerts.cfg.  See filter.

Examples

The Test_Xymon_Alerting file contains various examples and tests.

USEFUL PRIMITIVES

store_word

let store_word = store /[^ =\t\n#]+/

comparison The greater and lesser than operators

equal

let equal = Sep.equal

ws

let ws = Sep.space

eol

let eol = Util.eol

ws_or_eol

let ws_or_eol = del /([ \t]+|[ \t]*\n[ \t]*)/ " "

comment

let comment = Util.comment

empty

let empty = Util.empty

include

let include = [ key "include" . ws . store_word . eol ]

MACRO DEFINITION

macrodefinition

let macrodefinition = [ key /\$[^ =\t\n#\/]+/ . Sep.space_equal . store Rx.space_in . eol ]

A string that starts with $ and that is assigned something

flag

let flag (kw:string) = Build.flag kw

A flag value

kw_word

let kw_word (kw:regexp) = Build.key_value kw equal store_word

A key=value value

FILTERS

page

let page = kw_word /(EX)?PAGE/

The (ex)?page filter definition

group

let group = kw_word /(EX)?GROUP/

The (ex)?group filter definition

host

let host = kw_word /(EX)?HOST/

The (ex)?host filter definition

service

let service = kw_word /(EX)?SERVICE/

The (ex)?service filter definition

color

let color = kw_word "COLOR"

The color filter definition

time

let time = kw_word "TIME"

The time filter definition

duration

let duration = [ key "DURATION" . [ label "operator" . comparison ] . [ label "value" . store_word ] ]

The duration filter definition

recover

let recover = flag "RECOVER"

The recover filter definition

notice

let notice = flag "NOTICE"

The notice filter definition

rule_filter

let rule_filter = page | group | host | service | color | time | duration | recover | notice

Filters are made out of any of the above filter definitions

filters

let filters = [ label "filters" . Build.opt_list rule_filter ws ]

One or more filters

filters_opt

let filters_opt = [ label "filters" . (ws . Build.opt_list rule_filter ws)? ]

Zero, one or more filters

kw_word_filters_opt

let kw_word_filters_opt (kw:string) = [ key kw . equal . store_word . filters_opt ]

A kw_word entry with optional filters

flag_filters_opt

let flag_filters_opt (kw:string) = [ key kw . filters_opt ]

A flag with optional filters

RECIPIENTS

mail

let mail = [ key "MAIL" . ws . store_word . filters_opt ]

The mail recipient definition

script

let script = [ key "SCRIPT" . ws . [ label "script" . store_word ] . ws . [ label "recipient" . store_word ] . filters_opt ]

The script recipient definition

ignore

let ignore = flag_filters_opt "IGNORE"

The ignore recipient definition

format

let format = kw_word_filters_opt "FORMAT"

The format recipient definition

repeat

let repeat = kw_word_filters_opt "REPEAT"

The repeat recipient definition

unmatched

let unmatched = flag_filters_opt "UNMATCHED"

The unmatched recipient definition

stop

let stop = flag_filters_opt "STOP"

The stop recipient definition

macro

let macro = [ key /\$[^ =\t\n#\/]+/ . filters_opt ]

The macro recipient definition

recipient

let recipient = mail | script | ignore | format | repeat | unmatched | stop | macro

Recipients are made out of any of the above recipient definitions

RULES

rule

let rule = [ seq "rules" . filters . ws_or_eol . recipients . eol ]

Rules are made of rule_filter and then recipients sperarated by a whitespace

lns

let lns = ( rule | macrodefinition | include | empty | comment )*

The Xymon_Alerting lens

filter

Provides unit tests and examples for the Xymon_Alerting lens.
let store_word = store /[^ =\t\n#]+/
let equal = Sep.equal
let ws = Sep.space
let eol = Util.eol
let ws_or_eol = del /([ \t]+|[ \t]*\n[ \t]*)/ " "
let comment = Util.comment
let empty = Util.empty
let include = [ key "include" . ws . store_word . eol ]
let macrodefinition = [ key /\$[^ =\t\n#\/]+/ . Sep.space_equal . store Rx.space_in . eol ]
A string that starts with $ and that is assigned something
let flag (kw:string) = Build.flag kw
A flag value
let kw_word (kw:regexp) = Build.key_value kw equal store_word
A key=value value
let page = kw_word /(EX)?PAGE/
The (ex)?page filter definition
let group = kw_word /(EX)?GROUP/
The (ex)?group filter definition
let host = kw_word /(EX)?HOST/
The (ex)?host filter definition
let service = kw_word /(EX)?SERVICE/
The (ex)?service filter definition
let color = kw_word "COLOR"
The color filter definition
let time = kw_word "TIME"
The time filter definition
let duration = [ key "DURATION" . [ label "operator" . comparison ] . [ label "value" . store_word ] ]
The duration filter definition
let recover = flag "RECOVER"
The recover filter definition
let notice = flag "NOTICE"
The notice filter definition
let rule_filter = page | group | host | service | color | time | duration | recover | notice
Filters are made out of any of the above filter definitions
let filters = [ label "filters" . Build.opt_list rule_filter ws ]
One or more filters
let filters_opt = [ label "filters" . (ws . Build.opt_list rule_filter ws)? ]
Zero, one or more filters
let kw_word_filters_opt (kw:string) = [ key kw . equal . store_word . filters_opt ]
A kw_word entry with optional filters
let flag_filters_opt (kw:string) = [ key kw . filters_opt ]
A flag with optional filters
let mail = [ key "MAIL" . ws . store_word . filters_opt ]
The mail recipient definition
let script = [ key "SCRIPT" . ws . [ label "script" . store_word ] . ws . [ label "recipient" . store_word ] . filters_opt ]
The script recipient definition
let ignore = flag_filters_opt "IGNORE"
The ignore recipient definition
let format = kw_word_filters_opt "FORMAT"
The format recipient definition
let repeat = kw_word_filters_opt "REPEAT"
The repeat recipient definition
let unmatched = flag_filters_opt "UNMATCHED"
The unmatched recipient definition
let stop = flag_filters_opt "STOP"
The stop recipient definition
let macro = [ key /\$[^ =\t\n#\/]+/ . filters_opt ]
The macro recipient definition
let recipient = mail | script | ignore | format | repeat | unmatched | stop | macro
Recipients are made out of any of the above recipient definitions
let rule = [ seq "rules" . filters . ws_or_eol . recipients . eol ]
Rules are made of rule_filter and then recipients sperarated by a whitespace
let lns = ( rule | macrodefinition | include | empty | comment )*
The Xymon_Alerting lens
Close