From 1dead94e52e987c7f915037ad5c75e58366239d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Chac=C3=B3n?= Date: Thu, 25 May 2023 18:14:27 -0600 Subject: [PATCH] Fixed division by zero --- src/graphInfluxDB.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphInfluxDB.py b/src/graphInfluxDB.py index 7f4e2b78..cafe7dec 100644 --- a/src/graphInfluxDB.py +++ b/src/graphInfluxDB.py @@ -301,7 +301,7 @@ def getParentNodeBandwidthStats(parentNodes, subscriberCircuits): if circuit['stats']['sinceLastQuery']['packetsSentDownload'] and circuit['stats']['sinceLastQuery']['packetsSentUpload']: packetsSentTotalAggregate += (circuit['stats']['sinceLastQuery']['packetsSentDownload'] + circuit['stats']['sinceLastQuery']['packetsSentUpload']) circuitsMatched += 1 - if (packetsSentDownloadAggregate > 0) and (packetsSentUploadAggregate > 0): + if (packetsSentDownloadAggregate > 0) and (packetsSentUploadAggregate > 0) and (packetsSentTotalAggregate > 0): #overloadFactorDownloadSinceLastQuery = float(round((thisNodeDropsDownload/packetsSentDownloadAggregate)*100.0, 3)) #overloadFactorUploadSinceLastQuery = float(round((thisNodeDropsUpload/packetsSentUploadAggregate)*100.0, 3)) overloadFactorTotalSinceLastQuery = float(round((thisNodeDropsTotal/packetsSentTotalAggregate)*100.0, 1))