mirror of
https://github.com/librenms/librenms-agent.git
synced 2024-05-09 09:54:52 +00:00
Add divide by zero check (#191)
On several servers (Ubuntu 18.04) DEMAND_DATA_TOTAL is 0 currently and is causing an error Traceback (most recent call last): File "/usr/local/bin/zfs-linux", line 178, in <module> sys.exit(main(sys.argv[1:])) File "/usr/local/bin/zfs-linux", line 76, in main DATA_DEMAND_PERCENT = DEMAND_DATA_HITS / DEMAND_DATA_TOTAL * 100 ZeroDivisionError: division by zero
This commit is contained in:
committed by
Tony Murray
parent
381cc2466a
commit
d49fe954df
@@ -73,7 +73,7 @@ def main(args):
|
||||
CACHE_HIT_PERCENT = ARC_HITS / ARC_ACCESSES_TOTAL * 100
|
||||
CACHE_MISS_PERCENT = ARC_MISSES / ARC_ACCESSES_TOTAL * 100
|
||||
ACTUAL_HIT_PERCENT = REAL_HITS / ARC_ACCESSES_TOTAL * 100
|
||||
DATA_DEMAND_PERCENT = DEMAND_DATA_HITS / DEMAND_DATA_TOTAL * 100
|
||||
DATA_DEMAND_PERCENT = DEMAND_DATA_HITS / DEMAND_DATA_TOTAL * 100 if DEMAND_DATA_TOTAL != 0 else 0
|
||||
|
||||
DATA_PREFETCH_PERCENT = PREFETCH_DATA_HITS / PREFETCH_DATA_TOTAL * 100 if PREFETCH_DATA_TOTAL != 0 else 0
|
||||
|
||||
|
Reference in New Issue
Block a user