Error: "Unable to parse condition expression..."
Time-series data for the monitored resource is being collected, but no alerts are triggered for the condition. In the Web UI, the Agent Details page displays the following error:
Unable to parse condition expression, invalid condition syntax <condition>
<condition> is the condition expression that has the error.
For example:
Unable to parse condition expression, invalid condition syntax: rate /rest/v1/system/interfaces/*?attributes=link_resets per and 10 seconds > 1
In addition, the switch event logs might contain errors related to the rule that contains the condition. You can enter the
show event -d hpe-policyd
command to display events related to the Aruba Network Analytics Engine scripts.
For example:
switch# show event -d hpe-policyd 2018-0one-09:09:21:49.906768|hpe-policyd|5504|LOG_ERR|AMM|-|Error executing NAE action CLI belonging to condition system_resource_monitor.1.0.default.condition_7 and agent system_resource_monitor.1.0.default due to Command failed: non-zero exit status.
The cause is one of the following:
There is a syntax error in the condition expression.
Condition expressions can include operators, functions, and keywords—all of which must be in the required sequence. For example:
Correct syntax:
r.condition('{} > {}', [value,threshold])
Incorrect syntax:
r.condition('> {} {}', [value,threshold])
There is a mismatch between the number of parameters passed to the condition expression and the number of parameters expected.
For example, the following expression expects two inputs but is only passed one input:
r.condition('{} > {}', [value])
When the inputs to a function are a string and an array, the Python interpreter does not detect mismatches in parameters and values. For example, according to the Python interpreter, the expression
r.condition('>', [])
could be valid, so it does not return a syntax error during script validation. However when the script is run, the expression has no meaning because the comparator has no values to compare, so the "Unable to parse condition expression..." error is returned.