Problem: A lot of the log entries mentioned below spam my collectd.log file. Afaiu 2 situations can cause an aritmethicException. At least this is what I've googled:
Division of a number by Zero which is not defined and an integer.
Non-terminating long decimal numbers byBig Decimal.
Expected outcome:
I am not sure if this is a general problem or maybe caused due to my setup or monitored nodes. But both situations above sound for me OpenNMS should check the values better to avoid causing so many exceptions. At least my collectd log is full of these entries which makes it really hard to check the log file in general.
Log example: ``` 2022-06-15 16:09:32,243 WARN [Collectd-Thread-102-of-250] o.o.n.t.ThresholdEntity: Error evaluating: threshold: {evaluator=HIGH, dsName=(ifInErrors/((ifHCInUcastPkts+ifHCInMulticastPkts)+ifHCInBroadcastPkts)-ifInDiscards)*100, dsType=if, evaluators=[{ds=(ifInErrors/((ifHCInUcastPkts+ifHCInMulticastPkts)+ifHCInBroadcastPkts)-ifInDiscards)*100, value=10, rearm=9, trigger=10}]} and evaluator: org.opennms.netmgt.threshd.ThresholdEvaluatorHighLow$ThresholdEvaluatorStateHighLow@48f7363b org.opennms.netmgt.threshd.ThresholdExpressionException: Error while evaluating expression (ifInErrors/((ifHCInUcastPkts+ifHCInMulticastPkts)+ifHCInBroadcastPkts)-ifInDiscards)*100: org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate@167![1,77]: '(ifInErrors / ((ifHCInUcastPkts + ifHCInMulticastPkts) + ifHCInBroadcastPkts) - ifInDiscards) * 100;' divide error at org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate(ExpressionConfigWrapper.java:170) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.ExpressionConfigWrapper.interpolateAndEvaluate(ExpressionConfigWrapper.java:182) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.ThresholdEntity$1$2.get(ThresholdEntity.java:300) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.AbstractThresholdEvaluatorState.getValueForExpressionThreshold(AbstractThresholdEvaluatorState.java:356) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.AbstractThresholdEvaluatorState.evaluate(AbstractThresholdEvaluatorState.java:323) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.ThresholdEntity$1.lambda$visit$1(ThresholdEntity.java:311) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.ThresholdEntity.evaluateAndCreateEvents(ThresholdEntity.java:320) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.ThresholdingSetImpl.applyThresholds(ThresholdingSetImpl.java:319) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.ThresholdingSetImpl.applyThresholds(ThresholdingSetImpl.java:538) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.ThresholdingVisitorImpl.completeResource(ThresholdingVisitorImpl.java:159) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.collectd.SnmpCollectionResource.visit(SnmpCollectionResource.java:166) ~[opennms-services-30.0.0.jar:?] at org.opennms.netmgt.collectd.SnmpCollectionSet.visit(SnmpCollectionSet.java:321) ~[opennms-services-30.0.0.jar:?] at org.opennms.netmgt.threshd.ThresholdingSessionImpl.acceptCollection(ThresholdingSessionImpl.java:107) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.threshd.ThresholdingSessionImpl.accept(ThresholdingSessionImpl.java:70) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:440) ~[opennms-services-30.0.0.jar:?] at org.opennms.netmgt.collectd.CollectableService.doRun(CollectableService.java:354) ~[opennms-services-30.0.0.jar:?] at org.opennms.netmgt.collectd.CollectableService.lambda$run$0(CollectableService.java:328) ~[opennms-services-30.0.0.jar:?] at org.opennms.core.logging.Logging.withPrefix(Logging.java:71) ~[org.opennms.core.logging-30.0.0.jar:?] at org.opennms.netmgt.collectd.CollectableService.run(CollectableService.java:321) ~[opennms-services-30.0.0.jar:?] at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:179) ~[org.opennms.core.daemon-30.0.0.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?] at org.opennms.core.concurrent.LogPreservingThreadFactory$3.run(LogPreservingThreadFactory.java:124) ~[opennms-util-30.0.0.jar:?] at java.lang.Thread.run(Thread.java:829) ~[?:?] Caused by: org.apache.commons.jexl2.JexlException: org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate@167![1,77]: '(ifInErrors / ((ifHCInUcastPkts + ifHCInMulticastPkts) + ifHCInBroadcastPkts) - ifInDiscards) * 100;' divide error at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:702) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTDivNode.jjtAccept(ASTDivNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:416) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTAdditiveNode.jjtAccept(ASTAdditiveNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:473) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1356) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTReferenceExpression.jjtAccept(ASTReferenceExpression.java:31) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1317) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTReference.jjtAccept(ASTReference.java:18) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1183) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTMulNode.jjtAccept(ASTMulNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.interpret(Interpreter.java:232) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.ExpressionImpl.evaluate(ExpressionImpl.java:65) ~[commons-jexl-2.1.1.jar:2.1.1] at org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate(ExpressionConfigWrapper.java:167) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] ... 23 more Caused by: java.lang.ArithmeticException: / at org.apache.commons.jexl2.JexlArithmetic.divide(JexlArithmetic.java:432) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:696) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTDivNode.jjtAccept(ASTDivNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:416) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTAdditiveNode.jjtAccept(ASTAdditiveNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:473) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1356) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTReferenceExpression.jjtAccept(ASTReferenceExpression.java:31) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1317) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTReference.jjtAccept(ASTReference.java:18) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1183) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.parser.ASTMulNode.jjtAccept(ASTMulNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.Interpreter.interpret(Interpreter.java:232) ~[commons-jexl-2.1.1.jar:2.1.1] at org.apache.commons.jexl2.ExpressionImpl.evaluate(ExpressionImpl.java:65) ~[commons-jexl-2.1.1.jar:2.1.1] at org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate(ExpressionConfigWrapper.java:167) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?] ... 23 more ```
Problem: A lot of the log entries mentioned below spam my collectd.log file.
Afaiu 2 situations can cause an aritmethicException. At least this is what I've googled:
Division of a number by Zero which is not defined and an integer.
Non-terminating long decimal numbers byBig Decimal.
Expected outcome:
I am not sure if this is a general problem or maybe caused due to my setup or monitored nodes.
But both situations above sound for me OpenNMS should check the values better to avoid causing so many exceptions. At least my collectd log is full of these entries which makes it really hard to check the log file in general.
Log example:
```
2022-06-15 16:09:32,243 WARN [Collectd-Thread-102-of-250] o.o.n.t.ThresholdEntity: Error evaluating: threshold: {evaluator=HIGH, dsName=(ifInErrors/((ifHCInUcastPkts+ifHCInMulticastPkts)+ifHCInBroadcastPkts)-ifInDiscards)*100, dsType=if, evaluators=[{ds=(ifInErrors/((ifHCInUcastPkts+ifHCInMulticastPkts)+ifHCInBroadcastPkts)-ifInDiscards)*100, value=10, rearm=9, trigger=10}]} and evaluator: org.opennms.netmgt.threshd.ThresholdEvaluatorHighLow$ThresholdEvaluatorStateHighLow@48f7363b
org.opennms.netmgt.threshd.ThresholdExpressionException: Error while evaluating expression (ifInErrors/((ifHCInUcastPkts+ifHCInMulticastPkts)+ifHCInBroadcastPkts)-ifInDiscards)*100: org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate@167![1,77]: '(ifInErrors / ((ifHCInUcastPkts + ifHCInMulticastPkts) + ifHCInBroadcastPkts) - ifInDiscards) * 100;' divide error
at org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate(ExpressionConfigWrapper.java:170) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ExpressionConfigWrapper.interpolateAndEvaluate(ExpressionConfigWrapper.java:182) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ThresholdEntity$1$2.get(ThresholdEntity.java:300) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.AbstractThresholdEvaluatorState.getValueForExpressionThreshold(AbstractThresholdEvaluatorState.java:356) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.AbstractThresholdEvaluatorState.evaluate(AbstractThresholdEvaluatorState.java:323) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ThresholdEntity$1.lambda$visit$1(ThresholdEntity.java:311) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ThresholdEntity.evaluateAndCreateEvents(ThresholdEntity.java:320) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ThresholdingSetImpl.applyThresholds(ThresholdingSetImpl.java:319) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ThresholdingSetImpl.applyThresholds(ThresholdingSetImpl.java:538) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ThresholdingVisitorImpl.completeResource(ThresholdingVisitorImpl.java:159) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.collectd.SnmpCollectionResource.visit(SnmpCollectionResource.java:166) ~[opennms-services-30.0.0.jar:?]
at org.opennms.netmgt.collectd.SnmpCollectionSet.visit(SnmpCollectionSet.java:321) ~[opennms-services-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ThresholdingSessionImpl.acceptCollection(ThresholdingSessionImpl.java:107) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.threshd.ThresholdingSessionImpl.accept(ThresholdingSessionImpl.java:70) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
at org.opennms.netmgt.collectd.CollectableService.doCollection(CollectableService.java:440) ~[opennms-services-30.0.0.jar:?]
at org.opennms.netmgt.collectd.CollectableService.doRun(CollectableService.java:354) ~[opennms-services-30.0.0.jar:?]
at org.opennms.netmgt.collectd.CollectableService.lambda$run$0(CollectableService.java:328) ~[opennms-services-30.0.0.jar:?]
at org.opennms.core.logging.Logging.withPrefix(Logging.java:71) ~[org.opennms.core.logging-30.0.0.jar:?]
at org.opennms.netmgt.collectd.CollectableService.run(CollectableService.java:321) ~[opennms-services-30.0.0.jar:?]
at org.opennms.netmgt.scheduler.LegacyScheduler$1.run(LegacyScheduler.java:179) ~[org.opennms.core.daemon-30.0.0.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
at org.opennms.core.concurrent.LogPreservingThreadFactory$3.run(LogPreservingThreadFactory.java:124) ~[opennms-util-30.0.0.jar:?]
at java.lang.Thread.run(Thread.java:829) ~[?:?]
Caused by: org.apache.commons.jexl2.JexlException: org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate@167![1,77]: '(ifInErrors / ((ifHCInUcastPkts + ifHCInMulticastPkts) + ifHCInBroadcastPkts) - ifInDiscards) * 100;' divide error
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:702) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTDivNode.jjtAccept(ASTDivNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:416) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTAdditiveNode.jjtAccept(ASTAdditiveNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:473) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1356) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTReferenceExpression.jjtAccept(ASTReferenceExpression.java:31) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1317) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTReference.jjtAccept(ASTReference.java:18) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1183) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTMulNode.jjtAccept(ASTMulNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.interpret(Interpreter.java:232) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.ExpressionImpl.evaluate(ExpressionImpl.java:65) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate(ExpressionConfigWrapper.java:167) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
... 23 more
Caused by: java.lang.ArithmeticException: /
at org.apache.commons.jexl2.JexlArithmetic.divide(JexlArithmetic.java:432) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:696) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTDivNode.jjtAccept(ASTDivNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:416) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTAdditiveNode.jjtAccept(ASTAdditiveNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:473) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1356) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTReferenceExpression.jjtAccept(ASTReferenceExpression.java:31) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1317) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTReference.jjtAccept(ASTReference.java:18) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.visit(Interpreter.java:1183) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.parser.ASTMulNode.jjtAccept(ASTMulNode.java:18) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.Interpreter.interpret(Interpreter.java:232) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.apache.commons.jexl2.ExpressionImpl.evaluate(ExpressionImpl.java:65) ~[commons-jexl-2.1.1.jar:2.1.1]
at org.opennms.netmgt.threshd.ExpressionConfigWrapper.evaluate(ExpressionConfigWrapper.java:167) ~[org.opennms.features.collection.thresholding.impl-30.0.0.jar:?]
... 23 more
```