Nested conditional constructs give you the ability to specify any number of conditions that must be true for action execution to occur.
Rules
Observe the following rules when nesting conditional constructs:
Each nested conditional construct must have its own IF and ENDIF clauses.
You can nest conditional constructs up to 32 levels.
Example
This example shows a nested conditional construct that extracts the number of users currently active from the matched message in token position 2. It then checks to see whether the count has changed since the last time the message was matched. If it has changed, the new count is reported in an attribute change event report.
An additional check is made to determine whether the count has exceeded the maximum user threshold. If the threshold has been exceeded (that is, if the condition is true), a message is logged with the current count. Finally, the count is stored in PrevUserCount and used the next time this pattern is matched.
SET UserCount = # \2\ IF UserCount != PrevUserCount ACTION EVENT-REPORT "TYPE = AC | CLASS = host |" \ "INSTANCE=\_HOSTID\ | User_Count = \UserCount\" IF UserCount > MaxUserCount ACTION EVENT-REPORT "TYPE = LG|CLASS = host |" \ "INSTANCE = \_HOSTID\ | APPL = sample-db |" \ "TEXT = User count of \UserCount\ on \_HOSTID\" ENDIF ENDIF SET PrevUserCount = UserCount