Print Friendly
Comments

Evaluation of Text Results

The following task types implement alerts conditional on examination of one or more lines of text;

The following criteria may be configured for each alert level;

  • Contains the fragment {Literal Fragment}
  • Does not contain the fragment {Literal Fragment}
  • Matches the expression {Regular Expression}
  • Does not match the expression {Regular Expression}
  • Is numerically equal to {Numeric Comparison}
  • Is numerically not equal to {Numeric Comparison}
  • Is numerically less than {Numeric Comparison}
  • Is numerically more than {Numeric Comparison}

Literal Fragment

Performs a case-sensitive scan of each line for the text provided with an alert set or cleared based on whether the text was found on at least one line examined. Leading, trailing and internal whitespace in the comparison value is preserved and thus significant in the search.

Regular Expression

A search based on a .NET regular expression entered without the leading or trailing slash. The source is always evaluated line-by-line in case-sensitive mode but may include provision for mixed case in the expression. As a very basic example, the following will match the text 'Error' in upper, lower or title case;

ERROR|error|Error

Again, an alert is set or cleared based on whether the expression was matched on one or more lines examined.

Numeric Comparison

Coalesces the source into a single numeric result and sets an alert based on whether this is under, over or equal to the comparison value. Often it will be sufficient to a enter a simple numeric threshold but a number of optional parameters can be added around this value (separately or in combination) to guide the resolution of the source to a single number. The full syntax is;

[{Regular Expression}/][+][[{Line Select}:{Value Select}]]{Real Number}[?]

Regular Expression: Used to refine the extraction of numbers in each line, in particular to suit different locales. The expression should be entered without a leading slash but uses a trailing slash to separate it from what follows. If the expression returns captured groups the last group is assumed to contain the numeric value (if no groups are captured the whole match is parsed as a number). If no expression is provided the default used is;

[+-]?\d+(?:,[0-9]{3})*\.?\d*

Delta Flag [+]: A '+' sign (or '±' as it is saved) included here indicates the number should be compared to that arrived at on the prior task evaluation and the comparison should be performed on the difference between them. A typical use case would be testing the change over the task frequency of an incrementing SNMP counter. No comparison will be performed at the first evaluation as a value is recorded to compare with at the next.

Line & Value Selector: Entered as a pair (within square brackets, separated by a colon) this field specifies which of multiple numeric values on multiple lines should be considered. Each may be an ordinal index (i.e. 1, 2, 3...) specifying a particular line/value or one of the following;

  • 1st: Compare with the first numeric line/value found.
  • Nth: Compare with the last numeric line/value found.
  • Min: Compare with the smallest numeric line/value found.
  • Max: Compare with the largest numeric line/value found.
  • Sum: Compare with the total numeric line/value found.
  • Avg: Compare with the average numeric line/value found.

If a selector is not included the default behaviour is equivalent to [1st:1st] (compare with the first numeric value on the first line that contains one).

Real Number (Required): A positive or negative numeric value to compare against. Values less than one must be entered with a 0 before the decimal separator.

Optional Flag [?]: By default an alert will be set if the evaluation could not find a numeric value to compare with. If a selector identitifies a specific line:value an alert will be set if that value is absent from that line. Less specific selectors will yield an alert if no value could be matched on any line. Suppress alerts based on a missing value by appending a '?'.

Evaluation Testing

Text evaluations may be trialed (complex comparisons should be) using the Evaluate Text utility (in Options > General);

Type, paste or read (up to 32K characters) from a file, a block of text to evaluate and then specify a condition to compare it with. Click the Test button (or press [Enter]) to view the outcome with text considered in the evaluation highlighted;

ERRORED: The evaluation failed either because the anticipated text was not found or the comparison value is invalid. An alert would be set - click the REPORT link to see the cause of the error as it would be described in a notification.

MATCHED: The condition was matched. An alert would be set - click the REPORT link to see how the match would be described in a notification.

UNRESOLVED: The evaluation completed without error but the delta comparison requires a previous value to compare with. An alert may or may not be set depending on the outcome of the immediately prior task evaluation.

NOT MATCHED: The condition was not matched. No alert would be set.

28 August 2016