Parses xymon alerting files
Author: Francois Maillard fmaillard@gmail.com
| Xymon_Alerting | Parses xymon alerting files |
| 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. |
| Examples | The 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 | |
| macrodefinition | A string that starts with $ and that is assigned something |
| FILTERS | |
| page | The page filter definition |
| expage | The expage filter definition |
| group | The group filter definition |
| exgroup | The exgroup filter definition |
| host | The host filter definition |
| exhost | The exhost filter definition |
| service | The service filter definition |
| exservice | The exservice filter definition |
| color | The color filter definition |
| time | The time filter definition |
| duration | The duration filter definition |
| recover | The recover filter definition |
| notice | The notice filter definition |
| filters | Filters are made out of any of the above filter definitions |
| RECIPIENTS | |
| The mail recipient definition | |
| script | The script recipient definition |
| ignore | The ignore recipient definition |
| format | The format recipient definition |
| repeat | The repeat recipient definition |
| unmatched | The unmatched recipient definition |
| stop | The stop recipient definition |
| macro | The macro recipient definition |
| recipients | Recipients are made out of any of the above recipient definitions |
| RULES | |
| rule | Rules are made of filters and then recipients sperarated by a whitespace |
| lns | The Xymon_Alerting lens |
| filter |
This lens applies to /etc/xymon/alerts.d/*.cfg and /etc/xymon/alerts.cfg. See filter.
The Test_Xymon_Alerting file contains various examples and tests.
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 ]
A string that starts with $ and that is assigned something
let macrodefinition = [ key /\$[^ =\t\n#\/]+/ . equal . store /.*/ . eol ]
The page filter definition
let page = [ ws . key "PAGE" . equal . store_word . ws ]
The expage filter definition
let expage = [ ws . key "EXPAGE" . equal . store_word . ws ]
The group filter definition
let group = [ ws . key "GROUP" . equal . store_word . ws ]
The exgroup filter definition
let exgroup = [ ws . key "EXGROUP" . equal . store_word . ws ]
The host filter definition
let host = [ ws . key "HOST" . equal . store_word . ws ]
The exhost filter definition
let exhost = [ ws . key "EXHOST" . equal . store_word . ws ]
The service filter definition
let service = [ ws . key "SERVICE" . equal . store_word . ws ]
The exservice filter definition
let exservice = [ ws . key "EXSERVICE" . equal . store_word . ws ]
The color filter definition
let color = [ ws . key "COLOR" . equal . store_word . ws ]
The time filter definition
let time = [ ws . key "TIME" . equal . store_word . ws ]
The duration filter definition
let duration = [ ws . key "DURATION" . [ label "operator" . comparison ] . [ label "value" . store_word ] . ws ]
The recover filter definition
let recover = [ ws . key "RECOVER" . ws ]
The notice filter definition
let notice = [ ws . key "NOTICE" . ws ]
Filters are made out of any of the above filter definitions
let filters = page | expage | group | exgroup | host | exhost | service | exservice | color | time | duration | recover | notice
The mail recipient definition
let mail = [ key "MAIL" . ws . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]
The script recipient definition
let script = [ key "SCRIPT" . ws . [ label "script" . store_word ] . ws . [ label "recipient" . store_word ] . ws . [ label "filters" . filters* ] . ws_or_eol ]
The ignore recipient definition
let ignore = [ key "IGNORE" . ws . [ label "filters" . filters* ] . ws_or_eol ]
The format recipient definition
let format = [ key "FORMAT" . equal . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]
The repeat recipient definition
let repeat = [ key "REPEAT" . equal . store_word . ws . [ label "filters" . filters* ] . ws_or_eol ]
The unmatched recipient definition
let unmatched = [ key "UNMATCHED" . ws . [ label "filters" . filters* ] . ws_or_eol ]
The stop recipient definition
let stop = [ key "STOP" . ws . [ label "filters" . filters* ] . ws_or_eol ]
The macro recipient definition
let macro = [ key /\$[^ =\t\n#\/]+/ . ws . [ label "filters" . filters* ] . ws_or_eol ]
Recipients are made out of any of the above recipient definitions
let recipients = mail | script | ignore | format | repeat | unmatched | stop | macro
Rules are made of filters and then recipients sperarated by a whitespace
let rule = [ seq "rules" . [ label "filters" . filters+ ] . ws_or_eol . [ label "recipients" . ( recipients )+ ] . eol ]
The Xymon_Alerting lens
let lns = ( rule | macrodefinition | include | empty | comment )*