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
FILTERS
pageThe page filter definition
expageThe expage filter definition
groupThe group filter definition
exgroupThe exgroup filter definition
hostThe host filter definition
exhostThe exhost filter definition
serviceThe service filter definition
exserviceThe exservice filter definition
colorThe color filter definition
timeThe time filter definition
durationThe duration filter definition
recoverThe recover filter definition
noticeThe notice filter definition
filtersFilters are made out of any of the above filter definitions
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
recipientsRecipients are made out of any of the above recipient definitions
RULES
ruleRules are made of filters 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 = del /=/ "="

ws

let ws = del /[ \t]+?/ " "

eol

let eol = del /\n/ "\n"

ws_or_eol

let ws_or_eol = del /[ \t\n]+?/ " "

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#\/]+/ . equal . store /.*/ . eol ]

A string that starts with $ and that is assigned something

FILTERS

page

let page = [ ws . key "PAGE" . equal . store_word . ws ]

The page filter definition

expage

let expage = [ ws . key "EXPAGE" . equal . store_word . ws ]

The expage filter definition

group

let group = [ ws . key "GROUP" . equal . store_word . ws ]

The group filter definition

exgroup

let exgroup = [ ws . key "EXGROUP" . equal . store_word . ws ]

The exgroup filter definition

host

let host = [ ws . key "HOST" . equal . store_word . ws ]

The host filter definition

exhost

let exhost = [ ws . key "EXHOST" . equal . store_word . ws ]

The exhost filter definition

service

let service = [ ws . key "SERVICE" . equal . store_word . ws ]

The service filter definition

exservice

let exservice = [ ws . key "EXSERVICE" . equal . store_word . ws ]

The exservice filter definition

color

let color = [ ws . key "COLOR" . equal . store_word . ws ]

The color filter definition

time

let time = [ ws . key "TIME" . equal . store_word . ws ]

The time filter definition

duration

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

The duration filter definition

recover

let recover = [ ws . key "RECOVER" . ws ]

The recover filter definition

notice

let notice = [ ws . key "NOTICE" . ws ]

The notice filter definition

filters

let filters = page | expage | group | exgroup | host | exhost | service | exservice | color | time | duration | recover | notice

Filters are made out of any of the above filter definitions

RECIPIENTS

mail

let mail = [ key "MAIL" . ws . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]

The mail recipient definition

script

let script = [ key "SCRIPT" . ws . [ label "script" . store_word ] . ws . [ label "recipient" . store_word ] . ws . [ label "filters" . filters* ] . ws_or_eol ]

The script recipient definition

ignore

let ignore = [ key "IGNORE" . ws . [ label "filters" . filters* ] . ws_or_eol ]

The ignore recipient definition

format

let format = [ key "FORMAT" . equal . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]

The format recipient definition

repeat

let repeat = [ key "REPEAT" . equal . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]

The repeat recipient definition

unmatched

let unmatched = [ key "UNMATCHED" . ws . [ label "filters" . filters* ] . ws_or_eol ]

The unmatched recipient definition

stop

let stop = [ key "STOP" . ws . [ label "filters" . filters* ] . ws_or_eol ]

The stop recipient definition

macro

let macro = [ key /\$[^ =\t\n#\/]+/ . ws . [ label "filters" . filters* ] . ws_or_eol ]

The macro recipient definition

recipients

let recipients = 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" . [ label "filters" . filters+ ] . ws_or_eol . [ label "recipients" . ( recipients )+ ] . eol ]

Rules are made of filters 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 = del /=/ "="
let ws = del /[ \t]+?/ " "
let eol = del /\n/ "\n"
let ws_or_eol = del /[ \t\n]+?/ " "
let comment = Util.comment
let empty = Util.empty
let include = [ key "include" . ws . store_word . eol ]
let macrodefinition = [ key /\$[^ =\t\n#\/]+/ . equal . store /.*/ . eol ]
A string that starts with $ and that is assigned something
let page = [ ws . key "PAGE" . equal . store_word . ws ]
The page filter definition
let expage = [ ws . key "EXPAGE" . equal . store_word . ws ]
The expage filter definition
let group = [ ws . key "GROUP" . equal . store_word . ws ]
The group filter definition
let exgroup = [ ws . key "EXGROUP" . equal . store_word . ws ]
The exgroup filter definition
let host = [ ws . key "HOST" . equal . store_word . ws ]
The host filter definition
let exhost = [ ws . key "EXHOST" . equal . store_word . ws ]
The exhost filter definition
let service = [ ws . key "SERVICE" . equal . store_word . ws ]
The service filter definition
let exservice = [ ws . key "EXSERVICE" . equal . store_word . ws ]
The exservice filter definition
let color = [ ws . key "COLOR" . equal . store_word . ws ]
The color filter definition
let time = [ ws . key "TIME" . equal . store_word . ws ]
The time filter definition
let duration = [ ws . key "DURATION" . [ label "operator" . comparison ] . [ label "value" . store_word ] . ws ]
The duration filter definition
let recover = [ ws . key "RECOVER" . ws ]
The recover filter definition
let notice = [ ws . key "NOTICE" . ws ]
The notice filter definition
let filters = page | expage | group | exgroup | host | exhost | service | exservice | color | time | duration | recover | notice
Filters are made out of any of the above filter definitions
let mail = [ key "MAIL" . ws . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]
The mail recipient definition
let script = [ key "SCRIPT" . ws . [ label "script" . store_word ] . ws . [ label "recipient" . store_word ] . ws . [ label "filters" . filters* ] . ws_or_eol ]
The script recipient definition
let ignore = [ key "IGNORE" . ws . [ label "filters" . filters* ] . ws_or_eol ]
The ignore recipient definition
let format = [ key "FORMAT" . equal . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]
The format recipient definition
let repeat = [ key "REPEAT" . equal . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]
The repeat recipient definition
let unmatched = [ key "UNMATCHED" . ws . [ label "filters" . filters* ] . ws_or_eol ]
The unmatched recipient definition
let stop = [ key "STOP" . ws . [ label "filters" . filters* ] . ws_or_eol ]
The stop recipient definition
let macro = [ key /\$[^ =\t\n#\/]+/ . ws . [ label "filters" . filters* ] . ws_or_eol ]
The macro recipient definition
let recipients = mail | script | ignore | format | repeat | unmatched | stop | macro
Recipients are made out of any of the above recipient definitions
let rule = [ seq "rules" . [ label "filters" . filters+ ] . ws_or_eol . [ label "recipients" . ( recipients )+ ] . eol ]
Rules are made of filters and then recipients sperarated by a whitespace
let lns = ( rule | macrodefinition | include | empty | comment )*
The Xymon_Alerting lens
Close