Resource Graph properties throws exception if label starts with a number

Description

Hi,

With the 2019.1.5 version, we are having problems with some of our graphs where we draw graphs that are including multiple nodes in a single graph. To define unique labels from different nodes, we are using the foreign ids. Here is an example:

DEF:8C32095E_A731_435C_9FBF_F3AF9F005FFB_bwSNMPProcessMetricsGCPauseTimeAvgLastInt_rawdef={rrd1}:bwSNMPProcessMetric:AVERAGE \

 

What we have observed is that whenever we are dealing with a node whose foreign id starts with a number instead of a letter, we get the following exception:

Caused by: org.apache.commons.jexl2.JexlException$Parsing: C32095E_A731_435C_9FBF_F3AF9F005FFB_bwSNMPProcessMetricsGCPauseTimeAvgLastInt_rawdef@1:2 parsing error near '... Ambiguous st ...'

        at org.apache.commons.jexl2.parser.JexlParser.jjtreeCloseNodeScope(JexlParser.java:126) ~[commons-jexl-2.1.1.jar:2.1.1]

        at org.apache.commons.jexl2.parser.Parser.ExpressionStatement(Parser.java:274) ~[commons-jexl-2.1.1.jar:2.1.1]

        at org.apache.commons.jexl2.parser.Parser.Statement(Parser.java:140) ~[commons-jexl-2.1.1.jar:2.1.1]

        at org.apache.commons.jexl2.parser.Parser.JexlScript(Parser.java:72) ~[commons-jexl-2.1.1.jar:2.1.1]

        at org.apache.commons.jexl2.parser.Parser.parse(Parser.java:24) ~[commons-jexl-2.1.1.jar:2.1.1]

        at org.apache.commons.jexl2.JexlEngine.parse(JexlEngine.java:1248) ~[commons-jexl-2.1.1.jar:2.1.1]

        at org.apache.commons.jexl2.JexlEngine.createExpression(JexlEngine.java:435) ~[commons-jexl-2.1.1.jar:2.1.1]

        at org.apache.commons.jexl2.JexlEngine.createExpression(JexlEngine.java:419) ~[commons-jexl-2.1.1.jar:2.1.1]

        at org.opennms.netmgt.measurements.impl.JEXLExpressionEngine.applyExpressions(JEXLExpressionEngine.java:111) ~[org.opennms.features.measurements.impl-25.0.0-SNAPSHOT.jar:?]

 

Note that dashes in the label don’t seem to be accepted either.

 

For example this works:

DEF:BE4F9D54_3083_4F45_8418_7392265FA840_bwSNMPProcessMetricsGCPauseTimeAvgLastInt_rawdef={rrd1}:bwSNMPProcessMetric:AVERAGE \

 

Were you aware of this restriction? Is that intentional? If not, then could you please fix it? Otherwise, please advise how to handle this problem.

 

Thanks

Acceptance / Success Criteria

None

Attachments

1

Lucidchart Diagrams

Activity

Show:

Gulen Buyukbayram August 25, 2020 at 1:49 PM

Hi Patrick, your workaround to add node_ to the variable name seems to work. 

 

Regarding the documentation, the JEXL documentation is good, but what I am struggling is the lack of mentioning this significant change in any of the opennms release notes (from meridian 2015 to 2019). While testing, I found out about its implication to the Resource Graphs, but what other opennms functionality is affected by moving to JEXL expression? This is not clear at all.

Gulen Buyukbayram August 17, 2020 at 11:11 PM

thanks Patrick, I will try this tomorrow and let you know.

Patrick Schweizer August 11, 2020 at 10:29 PM

,

the pull request improves the error message in case a variable is defined that isn't allowed by JEXL. It didn't change the behavior itself.
The documentation to JEXL can be found here: https://commons.apache.org/proper/commons-jexl/reference/syntax.html

Does this solve / clarify your problem?
Please let me know if you need more assistance.

Cheers Patrick

Gulen Buyukbayram August 6, 2020 at 4:14 AM

Thanks, I haven't seen reference to this page in the opennms documentation. Could you point me to the Release Notes describing these changes  so I could test all the scenarios affected by such change? 

I will try your suggestion and see if that works. I will let you know in a few days.

Patrick Schweizer August 5, 2020 at 10:17 PM

Fixed

Details

Assignee

Reporter

HB Grooming Date

HB Backlog Status

Sprint

Affects versions

Priority

PagerDuty

Created July 7, 2020 at 1:49 PM
Updated August 25, 2020 at 1:49 PM
Resolved August 11, 2020 at 10:29 PM