|
|
This appendix defines the syntax of the rules file language.
alphachar = a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z number = 0|1|2|3|4|5|6|7|8|9stringliteral : "string of text"numliteral : integer1 | real2regexp : stringliteral3name = alphachar { alphachar | number | _ }4 element-name = name field-name = nameelement : $element-name | $( element-name )field : @field-name | @( field-name )property : %property %ServerName%OMNIHOME %LogFile %HostNamelist-of-elements : { element } ...variable : element | field | propertyrulesfile : tabledef statement-liststatements := [ statement | ifstatement ] ...expression : | stringliteral
| variable
| string( numexpression )
| extract( expression, regexp )
| lookup( expression, tablename )
| expression + expression
tabledef :
| table tablename = stringliteral
| table tablename = { { stringliteral , stringliteral }
[ ,{ stringliteral , stringliteral } ]... }
numexpression : | int( expression )
| real( expression )
| numliteral
| numexpression + numexpression
| numexpression - numexpression
| numexpression * numexpression
| numexpression / numexpression
| numexpression & numexpression
| numexpression | numexpression
| numexpression ^ numexpression
| numexpression >> numexpression
| numexpression << numexpression
statement : variable = expression | numexpression
| remove( element )
| details( list-of-elements )
| discard
| recover
| upper( stringliteral )
| lower( stringliteral )
| length( stringliteral )
| ltrim( stringliteral )
| rtrim( stringliteral )
| substr( stringliteral , numliteral , numliteral )
| printable( stringliteral )
| setlog([ DEBUG | INFO | WARNING | ERROR | FATAL | numexpression ] )
| log([ DEBUG | INFO | WARNING | ERROR | FATAL | numexpression], expression )
| service (expression, GOOD | BAD | MARGINAL)
comparison : | match( expression , expression )
| nmatch( expression , expression )
| regmatch( expression , regexp )
| exists( variable )
| numexpression == numexpression
| numexpression [ != | <> ] numexpression
| numexpression < numexpression
| numexpression > numexpression
| numexpression <= numexpression
| numexpression >= numexpression
| comparison and comparison
| comparison or comparison
| not comparison
ifstatement : if ( comparison ) { statements }[ else [ ifstatement | { statements } ] ]
switch: switch( expression )
{
| case "stringliteral":
rules
| ...
| default
rules
}
Is a reference to any field that exists in the alerts.status table, which makes up the core of the alert record.
Is a reference to any element which may have been attached to the event. These element names depend on which elements the Info Mediator developer adds.
Can reference and retrieve the value of any Info Mediator property. The subsequent named properties refer to internal variables which can be referenced. Properties and variables can not be modified within the rules file.
All variables are stored as strings, however, to aid numeric operations, these strings can be converted into numeric values so they can be compared and manipulated.
The switch statement has the same syntax as C. You must supply a default label. No two case statements can have the same label. It does not support break/continue or fall through.
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Posted: Wed Mar 24 13:46:02 PST 1999
Copyright 1989-1999©Cisco Systems Inc.